index.php gdzie tak naprawde wszystko sie dzieje...
<?php
if (file_exists("./inc/config.php")) include_once "./inc/config.php"; else echo "<script> alert(\"Pojawił się problem z bazą danych.\"); </script>"; include_once "./inc/niceUrl.php";
include_once "./class/NUrl.class.php";
$niceUrl = new NUrl();
$menuArr2 = menuTree();
foreach ($menuArr2 as $mA) {
$menuBottom .= "<a href=\"".$niceUrl->Url("page=".$mA["id"]."&name=".strtolower(str_replace(" ","_",str_replace("&","and",$mA["name"]))))."\">".$mA["name"]."</a> | "; }
$menuBottom = substr($menuBottom,0
,-3
); }
$message = "";
if($_GET["name"]=="contact" && $_POST["action"]=="send") {
include("./class/class.phpmailer.php");
include("./class/class.smtp.php");
$contentMail = "Imię i nazwisko (lub nazwa): <b>".$_POST["name"]."</b><br>
Telefon: <b>".$_POST["phone"]."</b><br>
Adres email: <b>".$_POST["mail"]."</b><br><br>
Treść zapytania:<br><b>".$_POST["question"]."</b>";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable smtp authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "serwer.com"; // sets gmail as the smtp server
$mail->Port = 465; // set the smtp port
$mail->Username = "*****@**********"; // gmail username
$mail->Password = "******"; // gmail password
$mail->From = "*****@**********";
$mail->FromName = "moja stronka";
$mail->Subject = "Informacja ze strony mojas_tronka";
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($contentMail);
$mail->AddAddress("*****@**********","Nie wiem");
$mail->IsHTML(true); // send as html
if ($mail->Send()) {
$message = "<div class=\"d5MessageOK\">Wysłano wiadomość</div>";
} else {
$message = "<div class=\"d5MessageERROR\">Wystąpił problem z wysłaniem wiadomości.</div>";
}
} elseif($_GET["name"]=="testimonials" && $_POST["action"]=="save") {
$nowaOpinia = $_POST;
$nowaOpinia["add_date"] = date("U"); queryInsert("testimonials",$nowaOpinia);
include("./class/class.phpmailer.php");
include("./class/class.smtp.php");
$contentMail = "Na stronie pojawiła się nowa opinia. Wpis czeka na akceptację lub odrzucenie w panelu administracyjnym.<br><br>
Imię i nazwisko (lub nazwa): <b>".$_POST["name"]."</b><br>
Treść:<br><b>".$_POST["content"]."</b><br><br>
Aby przejść do panelu wejdź tu: <a href=\"http://www.stronka.xyz\">www.stronka.xyz</a>";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable smtp authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "serwer.com"; // sets gmail as the smtp server
$mail->Port = 465; // set the smtp port
$mail->Username = "*****@**********"; // gmail username
$mail->Password = "******"; // gmail password
$mail->From = "*****@**********";
$mail->FromName = "moja stronka";
$mail->Subject = "Informacja ze strony mojas_tronka";
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($contentMail);
$mail->AddAddress("*****@**********","Nie wiem");
$mail->IsHTML(true); // send as html
if ($mail->Send()) {
$message = "<div class=\"d5MessageOK\">Wysłano opinię. W trosce o jakość wypowiedzi wpis musi jeszcze zostać zatwierdzony przez administrację, może to potrwać kilka dni.</div>";
} else {
$message = "<div class=\"d5MessageERROR\">Wystąpił problem z wysłaniem opinii.</div>";
}
}}
$losowaOpinia = getRecordRand
("testimonials",array("act"=>1
)); $roundTest = $losowaOpinia[0]["content"]."<br>
<span class=\"dTsign\">".$losowaOpinia[0]["name"]."</span>";
} else {
$roundTest = " ";
}
if(!$_GET["page"]) $_GET["page"]=4;
$stronaArr = getRecord("content",$_GET["page"]);
$tplArr = getRecord("templates",$stronaArr["template"]);
$testimonials="";
if($stronaArr["template"]==16) {
$listaOpinii = getList
("testimonials",array("act"=>1
));
foreach($listaOpinii as $lO){
$wiersz .= "<div style=\"padding-top:8px;\">
<div class=\"dTcontent\">".$lO["content"]."</div>
<div class=\"dTest1\">
<div class=\"dTa\">Add Date: <span>".date("d-m-Y H:i",$lO["add_date"])."</span></div> <div class=\"dTb\">Name: <span>".$lO["name"]."</span></div>
<div style=\"clear:both;\"></div>
</div>
</div>";
}
$testimonials = "<div class=\"dTest\">".$wiersz."</div>";
}
}
$co = Array("{menuTop}","{menuBottom}","{tpl}","{content}","{page}","{message}","{testimonials}","{roundTest}","{contactFormAction}","{testimonialsFormAction}"); $naCo = Array($menuTop,$menuBottom,$tpl,$stronaArr["content"],$_GET["page"],$message,$testimonials,$roundTest,$contactFormAction,$testimonialsFormAction);
?>
sam template po wugenerowaniu przez serwer wyglada tak:
<form action="36,contact.html" method="POST"> <input type="hidden" name="action" value="send"> <div class="d5Cl1">Name:
</div> <div class="d5Cl2"><input type="text" name="name"></div> <div class="d5Cl1">Phone:
</div> <div class="d5Cl2"><input type="text" name="phone"></div> <div class="d5Cl1">E-mail:
</div> <div class="d5Cl2"><input type="text" name="mail"></div> <div class="d5Cline" style="height:120px;"> <div class="d5Cl3">Question:
</div> <input type="submit" value="Send" style="margin-left:300px;">