<?php
echo'<div style="text-align: center;"><br>
		<br><br>
		<big style="font-weight: bold; font-family: Courier New;">	
			<big>
				<big>
					'.$_SESSION['nume_folder'].'<br />
				</big>
			</big>
		</big>
			<br />';

	echo'
		<img id="foto" alt="Site in Constructie" src="img/loader.gif" align="middle"><br>
		<big style="font-weight: bold; font-family: Courier New;">
			<big>
				<big>
					<br /><br /><br /><br />
					WebSite-ul se construieste<br /><br />
					Va rugam asteptati<br /><br />
					Multumim<br>
				</big>
			</big>
		</big>
	</div>';
$verificare_nume = file_exists( 'portofoliu/'.$_SESSION['nume_folder'] );
if($verificare_nume == ''){mkdir('portofoliu/'.$_SESSION['nume_folder'], 0777);}

// start scrie index.php
$index = '<?php session_start(); include "session.php" ; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HTML>
 <HEAD>
 <TITLE>'.$_SESSION['nume_folder'].' - '.$_SESSION['nume_slogan'].'</TITLE>
	<META NAME="Keywords" CONTENT="'.$_SESSION['nume_folder'].' - '.$_SESSION['nume_slogan'].'" />
	<META NAME="Description" CONTENT="'.$_SESSION['nume_folder'].' - '.$_SESSION['nume_slogan'].'" />  
	<META http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<META NAME="Generator" CONTENT="">
	<META NAME="Author" CONTENT="">
	<meta name = "language" content = "ro" /> 
	<meta name = "revisit-after" content = "1 day" /> 
	<meta name = "document-rating" content = "General" />
	<link rel="stylesheet" href="style.css"  type="text/css" media="screen" />
	<script src="nicEdit/nicEdit.js" type="text/javascript"></script>
	<script>bkLib.onDomLoaded(function(){var myInstance = new nicEditor().panelInstance("textareacontinut");myInstance.addEvent("blur", function() {});});</script>
	
 </HEAD>
<BODY>
	<table class="all" >
		<tr>
			<td colspan="2" ><?php include "header.php"; ?>	</td>
		</tr>
		<tr>
			<td colspan="2" id="td"><?php include "meniu_orizontal.php"; ?></td>
		</tr>
		<tr>
			<td id="stanga">
					<?php include "continut.php"; ?>
			</td>
			<td id="dreapta">
					<?php include "dreapta.php"; ?>
			</td>
		</tr>
		<tr>
			<td id="footer" colspan="2">
				<?php include "footer.php"; ?> 
			</td>
		</tr>
	</table> 
</BODY>
</HTML>';	
$fila1= 'portofoliu/'.$_SESSION['nume_folder'].'/index.php'; 
$handle=fopen($fila1, "w+");
fwrite($handle, $index);
// end scrie index.php
//================================
// start scrie header.php
$header = '
<table id="casetaheader">
	<tr>
		<td id="headerstanga">
			<?php
				echo"'.$_SESSION['nume_slogan'].'";
			?>	
		</td>
		<td id="headerdreapta">
			<?php
				echo"'.$_SESSION['nume_antet'].'";
			?>						
		</td>
	<tr>
</table>';	
$fila1= 'portofoliu/'.$_SESSION['nume_folder'].'/header.php'; 
$handle=fopen($fila1, "w+");
fwrite($handle, $header);
// end scrie header.php
//================================
// start scrie session.php
$session = '<?php
	$_SESSION[\'nume_slogan\'] = \''.$_SESSION['nume_slogan'].'\';
	$_SESSION[\'nume_antet\'] = \''.$_SESSION['nume_antet'].'\';
	
	$_SESSION[\'nume_pag1\'] = \''.$_SESSION['nume_pag1'].'\';
	$_SESSION[\'nume_pag2\'] = \''.$_SESSION['nume_pag2'].'\';
	$_SESSION[\'nume_pag3\'] = \''.$_SESSION['nume_pag3'].'\';
	$_SESSION[\'nume_pag4\'] = \''.$_SESSION['nume_pag4'].'\';
	$_SESSION[\'nume_pag5\'] = \''.$_SESSION['nume_pag5'].'\';
	
	$_SESSION[\'textareacontinut1\'] = \''.$_SESSION['textareacontinut1'].'\';
	$_SESSION[\'textareacontinut2\'] = \''.$_SESSION['textareacontinut2'].'\';
	$_SESSION[\'textareacontinut3\'] = \''.$_SESSION['textareacontinut3'].'\';
	$_SESSION[\'textareacontinut4\'] = \''.$_SESSION['textareacontinut4'].'\';
	$_SESSION[\'textareacontinut5\'] = \''.$_SESSION['textareacontinut5'].'\';
	
	$_SESSION[\'nume_utilizator\'] = \''.$_SESSION['nume_utilizator'].'\';
	$_SESSION[\'parola\'] = \''.$_SESSION['parola'].'\';
	$_SESSION[\'email\'] = \''.$_SESSION['email'].'\';  
?>
';	
$fila1= 'portofoliu/'.$_SESSION['nume_folder'].'/session.php'; 
$handle=fopen($fila1, "w+");
fwrite($handle, $session);
// end scrie session.php
//================================
// start scrie style.css
$style = 'body{
	background-color: #FFFFFF;
	background: url(img/bg_.jpg) repeat fixed center top;
	font-family: Verdana, Courier new, arial;
	font-size: 14px;
	color: #000000; 
	text-align: left;
}
p {
	text-indent: 20px;
	margin-top:8px; 
	margin-bottom:8px; 
}
.all{
	width: 1000px; 
	padding: 4px;
	vertical-align:top;
	text-align:left;
	margin-left:auto;
	margin-right:auto; 
	border: solid thin #7D85DA;
		-webkit-border-radius: .4em;
		-moz-border-radius: .4em;
		border-radius: .4em;
		-webkit-box-shadow: 1px 1px 1px #ffffff; 
		box-shadow: 1px 1px 20px #7D85DA;
}
#header{
	width:100%; 
	height:200px;
	text-align: center;
	vertical-align: middle;
	font-family: Verdana, Courier new, arial;
	font-size: 18px;
	color: #000000; 
	border: solid thin #ffffff;
		-webkit-border-radius: .4em;
		-moz-border-radius: .4em;
		border-radius: .4em;
		-webkit-box-shadow: 1px 1px 1px #ffffff; 
		box-shadow: 1px 1px 20px #ffffff;
}
#casetaheader{
	width:100%; 
	vertical-align: middle;
}
#headerstanga{
	width:250px; 
	height:200px;
	margin-right:10px; 
	text-align: center;
	line-height: 1.5;
	vertical-align: middle;
	padding: 8px;
	border: solid thin #7D85DA;
		-webkit-border-radius: .4em;
		-moz-border-radius: .4em;
		border-radius: .4em;
}
#headerdreapta{
	height:200px;
	padding: 8px;
	text-align: center;
	font-family: Verdana, Courier new, arial;
	font-size: 16px;
	font-weight: bold;
	color: #000000; 
	border: solid thin #7D85DA;
		-webkit-border-radius: .4em;
		-moz-border-radius: .4em;
		border-radius: .4em;
}
#butonmeniu{  
	width:160px;
	float: left;
	font-family: arial;
	font-size: 16px;
	text-align: center;
	padding: 15px;
	margin-top: 10px;
	margin-left: 4px;
	margin-bottom: 10px;
	background-color : #F8FFEC;
	border: solid thin #7D85DA;
		-webkit-border-radius: .4em;
		-moz-border-radius: .4em;
		border-radius: .4em;
}
#stanga{
	width:680px; 
	height: 800px;
	padding: 20px;
	vertical-align: top;
	margin-top: 4px;
	line-height: 18px;
	background-color: #FFFFFF;
	border: solid thin #7D85DA;
		-webkit-border-radius: .4em;
		-moz-border-radius: .4em;
		border-radius: .4em;
}
#numepagina{
	font-family: Verdana, Courier new, arial;
	font-size: 22px;
	font-weight: bold;
	color: #000000; 
}
#dreapta{
	vertical-align: top;
	margin-top: 4px;
	margin-bottom: 4px;
	background-color: #FFFFFF;
	border: solid thin #7D85DA;
		-webkit-border-radius: .4em;
		-moz-border-radius: .4em;
		border-radius: .4em;
}
#formular{
	
}
#codsecuritate{
	width:60px;
	font-family: Verdana, Courier new, arial;
	font-size: 14px;
	color: #000000; 
	padding: 6px;
	text-align: left;
	background-color : #F8FFEC;
	border: solid thin #c1c1c1;
	-webkit-border-radius: .4em;
	-moz-border-radius: .4em;
	border-radius: .4em;
	-webkit-box-shadow: 1px 1px 1px #ffffff; 
	box-shadow: 1px 1px 10px #ffffff;
}
#campdreapta{
	width:220px;
	font-family: Verdana, Courier new, arial;
	font-size: 14px;
	color: #000000; 
	padding: 6px;
	text-align: left;
	background-color : #F8FFEC;
	border: solid thin #c1c1c1;
	-webkit-border-radius: .4em;
	-moz-border-radius: .4em;
	border-radius: .4em;
	-webkit-box-shadow: 1px 1px 1px #ffffff; 
	box-shadow: 1px 1px 10px #ffffff;
}

#textareadreapta{
	width:228px;
	height: 200px;
	font-family: Verdana, Courier new, arial;
	font-size: 14px;
	color: #000000; 
	text-align: left;
	background-color : #F8FFEC;
	border: solid thin #c1c1c1;
	-webkit-border-radius: .4em;
	-moz-border-radius: .4em;
	border-radius: .4em;
	-webkit-box-shadow: 1px 1px 1px #ffffff; 
	box-shadow: 1px 1px 10px #ffffff;
}
#butonsubmit{
	padding: 15px;
	margin: 10px;
	text-align:center;
	line-height: 20px;
	font-family: Verdana, Courier new, arial;
	font-size: 14px;
	color: blue; 
	background-color: #F8FFEC;
	border: solid thin blue;
		-webkit-border-radius: .4em;
		-moz-border-radius: .4em;
		border-radius: .4em;
}
#footer{
	width:100%; 
	height:40px;
	margin:10px; 
	text-align: center;
	vertical-align: middle;
	font-family: Verdana, Courier new, arial;
	font-size: 14px;
	color: #000000; 
	background-color: #FFFFFF;
	border: solid thin #7D85DA;
		-webkit-border-radius: .4em;
		-moz-border-radius: .4em;
		border-radius: .4em;
}
a:link{
	text-decoration: none;
	color: #000000;
}
a:visited{
	text-decoration: none;
	color: blue;
}
a:hover{
	color: #000000;
	background-color: blue;
}
a:active{
	text-decoration: none;
	color: blue;
}';	
$fila1= 'portofoliu/'.$_SESSION['nume_folder'].'/style.css'; 
$handle=fopen($fila1, "w+");
fwrite($handle, $style);
// end scrie style.css
//================================
// start scrie meniu_orizontal.php
$meniu_orizontal = '<?php
echo\'
	<a href="index.php?pag=1" alt="'.$_SESSION['nume_folder'].' - \'.$_SESSION[\'nume_pag1\'].\'" title="'.$_SESSION['nume_folder'].' - \'.$_SESSION[\'nume_pag1\'].\'">
		<div id="butonmeniu">\'.$_SESSION[\'nume_pag1\'].\'</div>
	</a>
	<a href="index.php?pag=2" alt="'.$_SESSION['nume_folder'].' - \'.$_SESSION[\'nume_pag2\'].\'" title="'.$_SESSION['nume_folder'].' - \'.$_SESSION[\'nume_pag2\'].\'">
		<div id="butonmeniu">\'.$_SESSION[\'nume_pag2\'].\'</div>
	</a>
	<a href="index.php?pag=3" alt="'.$_SESSION['nume_folder'].' - \'.$_SESSION[\'nume_pag3\'].\'" title="'.$_SESSION['nume_folder'].' - \'.$_SESSION[\'nume_pag3\'].\'">
		<div id="butonmeniu">\'.$_SESSION[\'nume_pag3\'].\'</div>
	</a>
	<a href="index.php?pag=4" alt="'.$_SESSION['nume_folder'].' - \'.$_SESSION[\'nume_pag4\'].\'" title="'.$_SESSION['nume_folder'].' - \'.$_SESSION[\'nume_pag4\'].\'">
		<div id="butonmeniu">\'.$_SESSION[\'nume_pag4\'].\'</div>
	</a>
	<a href="index.php?pag=5" alt="'.$_SESSION['nume_folder'].' - \'.$_SESSION[\'nume_pag5\'].\'" title="'.$_SESSION['nume_folder'].' - \'.$_SESSION[\'nume_pag5\'].\'">
		<div id="butonmeniu">\'.$_SESSION[\'nume_pag5\'].\'</div>
	</a>\';
?>
';	
$fila1= 'portofoliu/'.$_SESSION['nume_folder'].'/meniu_orizontal.php'; 
$handle=fopen($fila1, "w+");
fwrite($handle, $meniu_orizontal);
// end scrie meniu_orizontal.php
//================================
// start scrie continut.php
$continut = '
<?php
if ($_GET["pag"] == "" or $_GET["pag"] == "1"){
	echo\'<p id="numepagina">\'.$_SESSION[\'nume_pag1\'].\'</p>
		<br /
	<p>\'.$_SESSION[\'textareacontinut1\'].\'</p>\';
}
if ($_GET["pag"] == "2"){
	echo\'<p id="numepagina">\'.$_SESSION[\'nume_pag2\'].\'</p>
		<br />
	<p>\'.$_SESSION[\'textareacontinut2\'].\'</p>\';
}
if ($_GET["pag"] == "3"){
	echo\'<p id="numepagina">\'.$_SESSION[\'nume_pag3\'].\'</p>
		<br />
	<p>\'.$_SESSION[\'textareacontinut3\'].\'</p>\';
}
if ($_GET["pag"] == "4"){
	echo\'<p id="numepagina">\'.$_SESSION[\'nume_pag4\'].\'</p>
		<br />
	<p>\'.$_SESSION[\'textareacontinut4\'].\'</p>\';
}
if ($_GET["pag"] == "5"){
	echo\'<p id="numepagina">\'.$_SESSION[\'nume_pag5\'].\'</p>
		<br />
	<p>\'.$_SESSION[\'textareacontinut5\'].\'</p>\';
}
?>
';
	
$fila1= 'portofoliu/'.$_SESSION['nume_folder'].'/continut.php'; 
$handle=fopen($fila1, "w+");
fwrite($handle, $continut);
// end scrie continut.php
//================================
// start scrie dreapta.php
$dreapta = '
<div id="formular">
<br /><br />
<CENTER>Va multumim pentru ca folositi<br />formularul de contact</CENTER>
<br /><br />
<TABLE align="center">
	<form action="" method="post">
		<TR>
			<TD align="left">Nume si prenume :</TD>
		</TR>
		<TR>		
			<TD align="right"><input id="campdreapta" type="text" name="name"></TD>
		</TR>
		<TR>
			<TD align="left">Adresa de email :</TD>
		</TR>
		<TR>		
			<TD align="right"><input id="campdreapta" type="text" name="email"></TD>
		</TR>
		<TR>
			<TD align="left">Nr telefon : </TD>
		</TR>
		<TR>		
			<TD align="right"><input id="campdreapta" type="text" name="phone"></TD>
		</TR>
		<TR>
			<TD align="left">Oras : </TD>
		</TR>
		<TR>		
			<TD align="right"><input id="campdreapta" type="text" name="oras"></TD>
		</TR>
		<tr>
			<td align="left">Detalii solicitare :</TD>
		</TR>
		<TR>		
			<TD align="right"><textarea id="textareadreapta" name="detalii"></textarea></td>
		</tr> 
		<TR>
			<TD align="left">Cod securitate: 6+2= 
				<input id="codsecuritate" type="text" name="cod_securitate" value=""></TD>
		</TR>
		<TR>
			<TD align="center">Toate campurile sunt obligatorii !</TD>
		</TR>
		<TR>
			<TD align="center"><input id="butonsubmit" type="submit" name="trimite_formular" value="Trimite solicitare"></TD>
		</TR>
	</form>
</TABLE>
</div>
';
	
$fila1= 'portofoliu/'.$_SESSION['nume_folder'].'/dreapta.php'; 
$handle=fopen($fila1, "w+");
fwrite($handle, $dreapta);
// end scrie dreapta.php
//================================
// start scrie footer.php
$footer = '
<!-- start contor vizitatori -->
<div id="contor">
	<!-- BEGIN: Powered by Supercounters.com -->
		<center>
			<script type="text/javascript" src="//widget.supercounters.com/ssl/online_i.js"></script><script type="text/javascript">sc_online_i(1460183,"ffffff","4b47b8");</script><br><noscript><a href="http://www.supercounters.com/">Free Online Counter</a></noscript>
		</center>
	<!-- END: Powered by Supercounters.com -->
</div>
<!-- end contor vizitatori 
//========================= -->
<?php
//start script trimite formular pe email
if($_POST[\'trimite_formular\']){

$to = $_SESSION[\'email\'];


if(($_POST["name"]!="")&&($_POST["email"]!="")&&($_POST["phone"]!="")&&($_POST["oras"]!="")&&($_POST["cod_securitate"]!="") and ($_POST["cod_securitate"] == "8")){
	
	$subject = "Solicitare de la site ".$_SERVER["SERVER_NAME"]."";
	$headers = "MIME-Version: 1.0"."\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1"."\r\n";
	$headers .= "From: ".$_POST[\'email\']."<".$_POST[\'email\'].">"."\r\n";

	$content = \'
		<TABLE width="800px" align="center" border="1" bgcolor="#ffffff" cellspacing="0" cellpadding="8">
			
				<TR><TD width="200px" align="left">Nume si prenume :</TD><TD>\'.$_POST[\'name\'].\'</TD></TR>
				<TR><TD align="left">Adresa de email : </TD><TD>\'.$_POST[\'email\'].\'</TD></TR>
				<TR><TD align="left">Nr telefon : </TD><TD>\'.$_POST[\'phone\'].\'</TD></TR>
				<TR><TD align="left">Oras : </TD><TD>\'.$_POST[\'oras\'].\'</TD></TR>
				<tr><td align="left">Detalii lucrare :</td><td>\'.$_POST[\'detalii\'].\'</td></tr> 
			
		</TABLE>\';
	
	mail($to , $subject, $content, $headers );
	
	echo "<script>alert(\'Solicitare trimisa cu succes . Va vom raspunde in cel mai scurt timp. Va multumim !\')</script>";
}
else{
	echo "<script>alert(\'Solicitare esuata ! Mesajul nu este complet ! Va rugam verificati. \')</script>";
}
echo "<script>location.replace(\'index.php\')</script>";
	}
//end script trimite formular pe email
?>
';
	
$fila1= 'portofoliu/'.$_SESSION['nume_folder'].'/footer.php'; 
$handle=fopen($fila1, "w+");
fwrite($handle, $footer);
// end scrie footer.php
//==============================
// start creaza arhiva zip a noului website
	$zip_website = new ZipArchive;
    $zip_website->open('portofoliu/'.$_SESSION['nume_folder'].'.zip',ZipArchive::CREATE|ZipArchive::OVERWRITE);
	$zip_website->addFromString($_SESSION['nume_folder'].'/continut.php',$continut);
	$zip_website->addFromString($_SESSION['nume_folder'].'/dreapta.php',$dreapta);
	$zip_website->addFromString($_SESSION['nume_folder'].'/footer.php',$footer);
	$zip_website->addFromString($_SESSION['nume_folder'].'/header.php',$header);
	$zip_website->addFromString($_SESSION['nume_folder'].'/index.php',$index);
	$zip_website->addFromString($_SESSION['nume_folder'].'/meniu_orizontal.php',$meniu_orizontal);
	$zip_website->addFromString($_SESSION['nume_folder'].'/session.php',$session);
	$zip_website->addFromString($_SESSION['nume_folder'].'/style.php',$style);
    $zip_website->close();
// end creaza arhiva zip a noului website
//==============================
// start muta arhiva zip a noului website
rename( 'portofoliu/'.$_SESSION['nume_folder'].'.zip', 'portofoliu/'.$_SESSION['nume_folder'].'/'.$_SESSION['nume_folder'].'.zip' );
// end muta arhiva zip a noului website
//==============================
?>