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/payment.php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'mail/Exception.php';
require 'mail/PHPMailer.php';
require 'mail/SMTP.php';?>
<div id="infoPayment">
	<form method="POST" id="paymentPc">
	<table>
		<thead>
			<th align="left"><h3>Thông tin mua hàng</h3> </th>
			<th align="left"><h3>Thanh toán</h3></th>
		</thead>
		<tr>
			<td><input type="email" name="email" placeholder="Email" value="<?php if(isset($_SESSION['id'])){ echo $_SESSION['mail']; } ?>"></td>
			<td><div class="method"><input class="radio" type="radio" name="method" value="0" checked="1">Tiền mặt</div></td>
		</tr>
		<tr>
			<td><input type="text" name="name" placeholder="Họ và tên" value="<?php if(isset($_SESSION['id'])){ echo $_SESSION['name']; } ?>"></td>
			<td><div class="method"><input class="radio" type="radio" name="method" value="2">Bảo Kim</div></td>
		</tr>
		<tr>
			<td><input type="text" name="phone" placeholder="Số điện thoại" value="<?php if(isset($_SESSION['id'])){ echo $_SESSION['phone']; } ?>"></td>
			<td><div class="method"><input class="radio" type="radio" name="method" value="1">Chuyển khoản</div></td>
		</tr>
		<tr>
			<td><input type="text" name="addStr" placeholder="Địa chỉ"></td>
			<td rowspan="3"><div id="infoBank">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></td>
		</tr>
		<tr>
<?php
$stmt=$conn->prepare("SELECT * FROM province ORDER BY id ASC");
$stmt->execute();
$province=$stmt->fetchAll(PDO::FETCH_ASSOC);
?>			
			<td><select name="addPro" id="addPro">
				<option>--- Chọn tỉnh thành ---</option>
				<?php foreach ($province as $province) { ?>
					<option value="<?php echo $province['id'] ?>"><?php echo $province['_name']; ?></option>
				<?php }?>
			</select></td>
		</tr>
		<tr>
			<td><select name="addDis" id="addDis">
				<option>--- Chọn quận huyện ---</option>
			</select></td>
		</tr>
		<tr>
			<td colspan="2" align="center"><br><button type="submit" name="payMent">Đặt hàng</button></td>
		</tr>
	</table>
	</form>
	<form method="POST" id="paymentMobile" hidden>
	<table>
		<thead>
			<th align="left"><h3>Thông tin mua hàng</h3> </th>
		</thead>
		<tr>
			<td><input type="email" name="email" placeholder="Email" value="<?php if(isset($_SESSION['id'])){ echo $_SESSION['mail']; } ?>"></td>
		</tr>
		<tr>
			<td><input type="text" name="name" placeholder="Họ và tên" value="<?php if(isset($_SESSION['id'])){ echo $_SESSION['name']; } ?>"></td>
		</tr>
		<tr>
			<td><input type="text" name="phone" placeholder="Số điện thoại" value="<?php if(isset($_SESSION['id'])){ echo $_SESSION['phone']; } ?>"></td>
		</tr>
		<tr>
			<td><input type="text" name="addStr" placeholder="Địa chỉ"></td>
		</tr>
		<tr>
<?php
$stmt=$conn->prepare("SELECT * FROM province ORDER BY id ASC");
$stmt->execute();
$province=$stmt->fetchAll(PDO::FETCH_ASSOC);
?>			
			<td><select name="addPro" id="addProM">
				<option>--- Chọn tỉnh thành ---</option>
				<?php foreach ($province as $province) { ?>
					<option value="<?php echo $province['id'] ?>"><?php echo $province['_name']; ?></option>
				<?php }?>
			</select></td>
		</tr>
		<tr>
			<td><select name="addDis" id="addDisM">
				<option>--- Chọn quận huyện ---</option>
			</select></td>
		</tr>
		<thead>
			<th align="left"><h3>Thanh toán</h3></th>
		</thead>
		<tr>
			<td><div class="method"><input class="radio" type="radio" name="method" value="0" checked="1">Tiền mặt</div></td>
		</tr>
		<tr>
			<td><div class="method"><input class="radio" type="radio" name="method" value="2">Bảo Kim</div></td>
		</tr>
		<tr>
			<td><div class="method"><input class="radio" type="radio" name="method" value="1">Chuyển khoản</div></td>
		</tr>
		<tr>
			<td><div id="infoBankM">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></td>
		</tr>
		<tr>
			<td colspan="2" align="center"><br><button type="submit" name="payMent">Đặt hàng</button></td>
		</tr>
	</table>
	</form>
</div>
<?php
if(isset($_POST['priceProduct'])){
	$priceProduct=$_POST['priceProduct'];
	$_SESSION['priceProduct']=$priceProduct;
	$idProduct=$_POST['idProduct'];
	$_SESSION['idProduct']=$idProduct;
	$amountProduct=$_POST['amountProduct'];
	$_SESSION['amountProduct']=$amountProduct;
	$nameProduct=$_POST['nameProduct'];
	$_SESSION['nameProduct']=$nameProduct;
}
if(empty($_SESSION['idProduct'])){
		header("location:collections.php");
}
if(isset($_POST['payMent'])){
	if(empty($_POST['email'])){
		$errors[]="Vui lòng nhập email";
	}
	if(empty($_POST['name'])){
		$errors[]="Vui lòng nhập họ tên";
	}
	if(empty($_POST['phone'])){
		$errors[]="Vui lòng nhập số điện thoại";
	}
	if(empty($_POST['addStr'])){
		$errors[]="Vui lòng nhập địa chỉ";
	}
	if(empty($_POST['addStr'])){
		$errors[]="Vui lòng nhập địa chỉ";
	}
	if(empty($_POST['addDis'])){
		$errors[]="Vui lòng chọn quận";
	}
	if(empty($_POST['addPro'])){
		$errors[]="Vui lòng chọn thành phố";
	}
	if(empty($errors)){
		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";
		}
		$stmt=$conn->prepare("SELECT _name FROM province WHERE id='".$_POST['addPro']."' ");
		$stmt->execute();
		$city=$stmt->fetch(PDO::FETCH_ASSOC);
		$addr=$_POST['addStr'].", ".$_POST['addDis'].", ".$city['_name'];
		$stmt=$conn->prepare("INSERT INTO customer(name,email,phone,addr) VALUES(:name,:email,:phone,:addr)");
		$stmt->bindParam(":name",$_POST['name'],PDO::PARAM_STR);
		$stmt->bindParam(":email",$_POST['email'],PDO::PARAM_STR);
		$stmt->bindParam(":phone",$_POST['phone'],PDO::PARAM_STR);
		$stmt->bindParam(":addr",$addr,PDO::PARAM_STR);
		$stmt->execute();
		if(isset($_SESSION['id'])){
			$customer=$_SESSION['id'];
			$isMember=1;
		}else{
			$stmt=$conn->prepare("SELECT id FROM customer ORDER BY id DESC");
			$stmt->execute();
			$idCustomer=$stmt->fetch(PDO::FETCH_ASSOC);
			$customer=$idCustomer['id'];
			$isMember=0;
		}
		$now=date("Y-m-d H:i:s");;
		$idProduct=$_SESSION['idProduct'];
		$priceProduct=$_SESSION['priceProduct'];
		$amountProduct=$_SESSION['amountProduct'];
		$nameProduct=$_SESSION['nameProduct'];
		$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",$now,PDO::PARAM_STR);
		$stmt->bindParam(":isMember",$isMember,PDO::PARAM_INT);
		$stmt->execute();
$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($_POST['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');
$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 ".$_POST['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'>".$_POST['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'>".$_POST['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 </td>
					<td style='padding:5px'>".$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>
				<tr>
					<td style='padding:10px' align='center'>".$_SESSION['nameProduct']."</td>
					<td style='padding:10px' align='center'>".$_SESSION['amountProduct']."</td>
					<td style='padding:10px' align='right'><span class='price'>".number_format($_SESSION['priceProduct'])." đ</span></td>
					<td style='padding:10px' align='right'><span class='price'>".number_format($_SESSION['amountProduct']*$_SESSION['priceProduct'])." đ</span></td>
				</tr>
			</tbody></table>
			<br>
			<p align='center'>Chân thành cảm ơn ".$_POST['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!";
}
$_SESSION['idProduct']="";
$_SESSION['nameProduct']="";
$_SESSION['priceProduct']="";
$_SESSION['amountProduct']="";			
success("Đặt hàng",$_SESSION['url']);
	}else{
		notice($errors);
	}

}

AnonSec - 2021 | Recode By D7net