%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/riacommer/public_html/
Upload File :
Create Path :
Current File : /home/riacommer/public_html/checkout-post.php

<?php
session_start();
include_once("admin/api/db.php");
$dbssid = $_SESSION["ssid"];

$emailContent='';

if(!isset($_POST["fname"])){
	$dbssid='';
}

if($dbssid!=""){

include_once("phpmail.php");

$mem_email = $_SESSION["emailuid"];
$country = $_POST["country"];
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$contact = $_POST["contact"];
$company = $_POST["company"];
$address = $_POST["address"];
$city = $_POST["city"];

$customerProfile = '<table border="0"><tr><td>Country:</td><td>'.$country.'</td></tr>';
$customerProfile .= '<tr><td>First Name:</td><td>'.$fname.'</td></tr>';
$customerProfile .= '<tr><td>Last Name:</td><td>'.$lname.'</td></tr>';
$customerProfile .= '<tr><td>Email:</td><td>'.$mem_email.'</td></tr>';
$customerProfile .= '<tr><td>Contact:</td><td>'.$contact.'</td></tr>';
$customerProfile .= '<tr><td>Company:</td><td>'.$company.'</td></tr>';
$customerProfile .= '<tr><td>Address:</td><td>'.$address.'</td></tr>';
$customerProfile .= '<tr><td>City:</td><td>'.$city.'</td></tr>';
$customerProfile .= '</table>';

$emailContent = '<h3>Customer Enquiry Form</h3>'.$customerProfile;

$items='<table class="shop_table cart" border="1" cellpadding="4" cellspacing="0">
														<thead>
															<tr>
															<th class="product-rn">
																	#
																</th>
																<th class="product-thumbnail">
																	Image
																</th>
																<th class="product-name">
																	Product Name / Model
																</th>
																<th class="product-name">
																	Quantity
																</th>
															</tr>
														</thead>
														<tbody>';


$sql = "select p.*, e.id as eid, e.qty from sa_product p, enquiry e where e.product_id = p.id and e.sessionid='$dbssid'";
$mysql_result = mysql_query($sql, $connection);
$num_rows = mysql_num_rows($mysql_result);
$i=0;
if($num_rows>=1){
	while($row = mysql_fetch_array($mysql_result)){
		$i++;
		$pid = $row["id"];
		$eid = $row["eid"];
		$product_code = $row["product_code"];
		$product_name = $row["product_name"];
		$product_image = $row["product_image"];
		if($product_image!=""){
			$product_image_url = 'http://www.gasworld.com.my/contents/products/thumb_'.urlencode($product_image);
		}
		
		if(!file_exists($product_image_url)){
			$product_image_url = 'http://www.gasworld.com.my/contents/products/'.urlencode($row["product_image"]);
		}
		
		$qty = $row["qty"];
		
		$items .= '<tr class="cart_table_item">
																<td class="product-rn">
															
																		'.$i.'
																	
																</td>
																<td class="product-thumbnail">
																	<a href="http://www.gasworld.com.my/product-details.php?id='.$pid.'" target="_blank">
																		<img width="160" alt="" class="img-responsive" src="'.$product_image_url.'">
																	</a>
																</td>
																<td class="product-name">
																	<a href="http://www.gasworld.com.my/product-details.php?id='.$pid.'" target="_blank">'.$product_name.'<br />'.$product_code.'</a>
																</td>
																<td style="text-align:right;">
																	<div style="width:60px;">'.$qty.'</div>
																</td>
															</tr>';
		
		
	}
}
		$items .= '</tbody></table>';
		$emailContent .= '<br />'.$items;
		//echo $items;
		
		//echo '=========END OF EMAIL CONTENT==========';
		
		
		$from_email='noreply@gasworld.com.my';
		
		
		//start email send program
		//$from_email = "noreply@gasworld.com.my";
		
		//$to = "alfred2046@gmail.com"; //marketing email address
		$to = "marketing@gasworld.com.my"; //marketing email address
		
		
		//$from = "From: ".$from_email;
		$subject = "Product Enquiry";
		$headers = "Content-Type: text/html; charset=utf-8\n";
		
		$body = "Hi,<br /><br />";
		$body .= $emailContent;
		//$body .= $fname . ' ' . $lname . "<br /><br />";
		$body .= "==============================================<br /><br />";
		$body .= "This e-mail has been generated automatically based on product enquiry.<br /><br />";
		
		$mail->SetFrom($from_email, $from_email);
		
		//$mail->SetFrom($mem_email, $fname . ' ' . $lname);
		$mail->AddAddress($to, $to); //recipient
		$mail->AddReplyTo($mem_email, $fname.' '.$lname);
		$mail->Subject = $subject;
		$mail->Body    = $body;
		
		if($mail->Send()){
		
				$sql = "DELETE FROM enquiry WHERE sessionId='$dbssid'";
				mysql_query($sql);
		
			//$msg="Email sent out successfully!";
			header("Location: http://".$_SERVER['HTTP_HOST'].str_replace("\\", "", dirname($_SERVER['PHP_SELF']))."thanks.php?pgid=6&err=0");
		} else {
			//$msg="Error, email unable to send out, please go to search customer profile and send the activation email.";
				//$msg="Email Encounter Problem. Enquiry is failed to send. Please try again later.";
			header("Location: http://".$_SERVER['HTTP_HOST'].str_replace("\\", "", dirname($_SERVER['PHP_SELF']))."thanks.php?pgid=6&err=1");
		}	
		//end email send program
		
} else {
	echo '403 Forbidden';
}

?>

Zerion Mini Shell 1.0