Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!empty($_POST['nume']) && !empty($_POST['email']) && !empty($_POST['adress']) && !empty($_POST['tel'])){
- include("getIP.php");
- $con = new PDO('mysql:host=mysql5.hostbase.net;dbname=artclubl_luminita','_','');
- $send = $con->prepare('SELECT * FROM tablouri WHERE clientIP=:ip');
- $send->execute(array(":ip"=>get_client_ip()));
- if($send->rowCount()){
- $nume = $_POST['nume'];
- $email = $_POST['email'];
- $adress = $_POST['adress'];
- $tel = $_POST['tel'];
- $comment = $_POST['comment'];
- $cost = 0;
- $method = $_POST['method'];
- $body="";
- foreach($send as $row){
- $body= $body.",".$row['nume'];
- $cost+=$row['pret'];
- }
- $body2 = "Nume:".$nume."<br/>"."Adress:".$adress."<br/>"."Tel.:".$tel."Method: ".$method."<br/><br/>".$body."<br/>"."Pret total: ".$cost."<br/><br/>"."Comment: ".$comment;
- require_once('../PHPMailer/class.phpmailer.php');
- $mail_to_client = new PHPMailer();
- $mail_to_client->AddReplyTo('','ArtClub Lumir');
- $mail_to_client->SetFrom("",'ArtClub Lumir');
- $mail_to_client->AddAddress($email,'Client');
- $mail_to_client->Subject ="Confirmarea Comenzii" ;
- $mail_to_client->Body = $body2;
- $mail_to_lumir = new PHPMailer();
- $mail_to_lumir->SetFrom("",'ArtClub Lumir');
- $mail_to_lumir->AddAddress("",'Client');
- $mail_to_lumir->Subject = "Comanda";
- $mail_to_lumir->Body = $body2;
- if($mail_to_client->Send() && $mail_to_lumir->Send()){
- $send= $con->prepare("UPDATE tablouri SET status=sold,clientIP=- WHERE clientIP=:ip");
- $send->execute(array(":ip"=>get_client_ip()));
- if($send){
- include("re.html");
- }else{
- echo"Error";
- }
- }else{
- echo"Error";
- }
- }
- }else{
- include('final.html');
- echo"<div style='width:100%;text-align:center;background-color:#663300'> Ceva lipseşte</div>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement