Advertisement
kemkriszt

1234

Sep 10th, 2014
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  1.                                                                                                                                         <?php
  2.     if(!empty($_POST['nume']) && !empty($_POST['email']) && !empty($_POST['adress']) && !empty($_POST['tel'])){
  3.        
  4.         include("getIP.php");
  5.         $con = new PDO('mysql:host=mysql5.hostbase.net;dbname=artclubl_luminita','_','');
  6.         $send = $con->prepare('SELECT * FROM tablouri WHERE clientIP=:ip');
  7.         $send->execute(array(":ip"=>get_client_ip()));
  8.        
  9.         if($send->rowCount()){
  10.             $nume = $_POST['nume'];
  11.             $email = $_POST['email'];
  12.             $adress = $_POST['adress'];
  13.             $tel = $_POST['tel'];
  14.             $comment = $_POST['comment'];
  15.             $cost = 0;
  16.             $method = $_POST['method'];
  17.            
  18.             $body="";
  19.             foreach($send as $row){
  20.                 $body= $body.",".$row['nume'];
  21.                 $cost+=$row['pret'];
  22.             }
  23.            
  24.             $body2 = "Nume:".$nume."<br/>"."Adress:".$adress."<br/>"."Tel.:".$tel."Method: ".$method."<br/><br/>".$body."<br/>"."Pret total: ".$cost."<br/><br/>"."Comment: ".$comment;
  25.            
  26.             require_once('../PHPMailer/class.phpmailer.php');
  27.             $mail_to_client = new PHPMailer();
  28.            
  29.             $mail_to_client->AddReplyTo('','ArtClub Lumir');
  30.             $mail_to_client->SetFrom("",'ArtClub Lumir');
  31.             $mail_to_client->AddAddress($email,'Client');
  32.             $mail_to_client->Subject ="Confirmarea Comenzii" ;
  33.             $mail_to_client->Body = $body2;
  34.            
  35.             $mail_to_lumir = new PHPMailer();
  36.            
  37.             $mail_to_lumir->SetFrom("",'ArtClub Lumir');
  38.             $mail_to_lumir->AddAddress("",'Client');
  39.             $mail_to_lumir->Subject = "Comanda";
  40.             $mail_to_lumir->Body = $body2;
  41.            
  42.             if($mail_to_client->Send() && $mail_to_lumir->Send()){
  43.                 $send= $con->prepare("UPDATE tablouri SET status=sold,clientIP=- WHERE clientIP=:ip");
  44.                 $send->execute(array(":ip"=>get_client_ip()));
  45.                 if($send){
  46.                     include("re.html");
  47.                 }else{
  48.                     echo"Error";
  49.                 }
  50.             }else{
  51.                 echo"Error";
  52.             }
  53.         }
  54.     }else{
  55.         include('final.html');
  56.         echo"<div style='width:100%;text-align:center;background-color:#663300'> Ceva lipse&#351;te</div>";
  57.     }
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement