MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/sb_web/b2680/childrendccom.domain.com/
File Upload :
Current < : /hermes/sb_web/b2680/childrendccom.domain.com/guestAccountCreateData.php

<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

include("includes/database.php");
include("functions/functions.php");

// Load Composer's autoloader
require "PHPMailer/vendor/autoload.php";

if(isset($_POST["send_guestName"])){
	
	$send_guestName = mysqli_real_escape_string($con, $_POST["send_guestName"]);
	$send_guestMobile = mysqli_real_escape_string($con, $_POST["send_guestMobile"]);
	$send_guestEmail = mysqli_real_escape_string($con, $_POST["send_guestEmail"]);
	$send_guestCity = mysqli_real_escape_string($con, $_POST["send_guestCity"]);
	$send_guestAddress = mysqli_real_escape_string($con, $_POST["send_guestAddress"]);
	$send_form_custAddCom = mysqli_real_escape_string($con, $_POST["send_form_custAddCom"]);
	$clientIPAddress = getIp();
	$invoice_no = time();
	
	$postComm = "";
	if($send_form_custAddCom == ""){
		$postComm = "";
	}else{
		$postComm = "<p><b>Additional Comment:</b> $send_form_custAddCom</p>";
	}
	
	$chk_email = mysqli_query($con, "select * from customers where customer_email = '$send_guestEmail'");
	$cnt_gstEmail = mysqli_num_rows($chk_email);
	
	if($cnt_gstEmail == 1){
		
		//getting the customer id
		$_rowQuery = mysqli_fetch_array($chk_email);
		$customer_id = $_rowQuery["customer_id"];
		//getting the customer id


		//getting the delivery rate
		$delivery_rate = 0;

		//getting product price & number of items
		$total = 0;
		$status = "Pending";
		$pmt_method = "cash_on_delivery";
		
		$ip = getIp();
		$run_price = mysqli_query($con, "select * from cart where ip_address = '$ip' AND customer_user_agent = '$customa_user_agent_id'");
		$count_pro = mysqli_num_rows($run_price);

		while($row_p = mysqli_fetch_array($run_price)){
			
			$prod_id = $row_p['product_id'];
			$prod_qty = $row_p['quantity'];
			
			$run_penq = mysqli_query($con, "insert into pending_orders (customer_id, invoice_no, product_id, quantity, order_status) values ('$customer_id','$invoice_no','$prod_id','$prod_qty','$status')");
			
			$run_pro_price = mysqli_query($con, "select * from product where product_id = '$prod_id'");
			
			while($row_price = mysqli_fetch_array($run_pro_price)){ 
				
				$product_price = array($row_price['product_price']);
				$values = array_sum($product_price);
				
				$total = $total + ($values * $prod_qty);
			}
			
		}

		$total = $total + $delivery_rate;
		
		$mail = new PHPMailer(true);
		$mail->isSMTP();
		$mail->isHTML(true);
		$mail->Host       = "mail.sugarsaltstation.com";
		$mail->SMTPAuth   = true;
		$mail->Username   = "developer@sugarsaltstation.com";
		$mail->Password   = 'MbszOo^C0c$A';
		$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
		$mail->Port       = 587;

		$mail->setFrom("support@babykish.ae", "BabyKish");
		$mail->addAddress($send_guestEmail, "Your Order from BabyKish!");
		$mail->addBCC("support@babykish.ae", "New Product Order");
		$mail->addCC("coadmuzik@gmail.com", "New Product Order");
		$mail->addReplyTo("support@babykish.ae", "BabyKish");

		// Content
		$mail->Subject = "Your Order from BabyKish!";
		$mail->Body    = "
			<html>
				<head>
					<style>
						h1, h2, h3, h4, h5, h6, p{
							margin-bottom: 10px;
						}
						hr{
							border-top: 1px solid rgba(0,0,0,0.1);
						}
						body{
							background: #f1f1f1;
							padding:1%;
							margin:auto;
							font-family: 'Quicksand', sans-serif;
						}
						.center {
							margin: auto;
							width: 98%;
							padding: 1%;
							background: #ffffff;
							border-radius: 10px;
						}
						.wizBtn{
							padding: 14px 20px;
							background: #f0d264;
							color: #333;
							text-decoration: none;
							border-radius: 12px;
							transition: all 1s ease;
						}
						.wizBtn:hover {
						-webkit-box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
						-moz-box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
						box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
						}
						.btnP{
							padding: 30px 0;
						}
					</style>
					<link href='https://fonts.googleapis.com/css2?family=Quicksand:wght@600&display=swap' rel='stylesheet' />
				</head>
				<body>
					<div class='center'>	
						<center>
							<img src='https://www.childrendc.com/images/logo.png' width='50%' style='margin:20px;' />
						</center><hr />
						<h2>Dear $send_guestName, <br>Thanks For Shopping With Us!</h2>
						
						<hr />
						<p><b>Total Amount Due:</b> $currency $total</p>
						<p><b>Your Order Reference Number is:</b> $invoice_no</p>
						<p><b>Total Products:</b> $count_pro</p>
						$postComm
						
						<hr />
						<h4>Important Points:</h4>
						<p>Please note that your order has been received by Us and we will get in touch with you soon to schedule your product delivery.</p>
						
						<p>To view your order history, please login to your personal user control panel from this link <br><a href='https://www.childrendc.com/client_access/'>User Control Panel</a>.</p>
						
						<h4>Thanks Again For Shopping With Us!</h4><hr />
						<p>Phone: <a href='tel:$wiscoy_phone1'>$wiscoy_phone1</a></p>
						<p>Email: <a href='mailto:$wiscoy_email1'>$wiscoy_email1</a></p>
						<p>Website: <a href='https://www.childrendc.com/'>www.childrendc.com</a></p>
					</div>
				</body>
			</html>
		";
		//send mail ends
		
		if(!$mail->send()){
			echo $mail->ErrorInfo;
		}else{
			$insert_order = "insert into customer_orders (customer_id, due_amount, invoice_no, total_products, order_date, order_status, payment_method, customer_address, customer_phone, customer_location, order_discount, total_amount, approval_status) values ('$customer_id','$total','$invoice_no','$count_pro',NOW(),'$status','$pmt_method','$send_guestAddress','$send_guestMobile','$send_guestCity','','','')";
			$run_order = mysqli_query($con, $insert_order);
			if($run_order){
				$empty_cart = "delete from cart where ip_address = '$ip' AND customer_user_agent = '$customa_user_agent_id'";
				$run_del = mysqli_query($con, $empty_cart);
				if($run_del){ echo "success"; }else{ echo "delete-problem"; }
			}else{ echo "customer-order-problem"; }
		}
		
	}else{
		
			$custInfo_query = "insert into customers(customer_ip, customer_user_agent, customer_name, customer_email, customer_pass, customer_address, customer_gender, customer_phone, customer_image, customer_location, actual_location, register_date, pescription_status) values('$clientIPAddress','$customa_user_agent_id','$send_guestName','$send_guestEmail','$send_guestMobile','$send_guestAddress','Male','$send_guestMobile','default.jpg','inside_region','$send_guestCity',NOW(),'')";
			$insert_custInfo = mysqli_query($con, $custInfo_query);
			
			if($insert_custInfo){
				
				//Creating the customer id
				$_runIDQu = mysqli_query($con, "select * from customers ORDER BY customer_id DESC LIMIT 1");
				$_rowQuery = mysqli_fetch_array($_runIDQu);
				$customer_id = $_rowQuery["customer_id"];
				//Creating the customer id


				//getting the delivery rate
				$delivery_rate = 0;

				//getting product price & number of items
				$total = 0;
				$status = "Pending";
				$pmt_method = "cash_on_delivery";
				
					
				$ip = getIp();
				$sel_price = "select * from cart where ip_address = '$ip' AND customer_user_agent = '$customa_user_agent_id'";
				$run_price = mysqli_query($con, $sel_price);
				$count_pro = mysqli_num_rows($run_price);

				while($row_p = mysqli_fetch_array($run_price)){
					
					$prod_id = $row_p['product_id'];
					$prod_qty = $row_p['quantity'];
					
					$pen_query = "insert into pending_orders (customer_id, invoice_no, product_id, quantity, order_status) values ('$customer_id','$invoice_no','$prod_id','$prod_qty','$status')";
					$run_penq = mysqli_query($con, $pen_query);
					
					$prod_price = "select * from product where product_id = '$prod_id'";
					$run_pro_price = mysqli_query($con, $prod_price);
					
					while($row_price = mysqli_fetch_array($run_pro_price)){ 
						
						$product_price = array($row_price['product_price']);
						$values = array_sum($product_price);
						
						$total = $total + ($values * $prod_qty);
					}
					
				}

				$total = $total + $delivery_rate;
				
				$mail = new PHPMailer(true);
				$mail->isSMTP();
				$mail->isHTML(true);
				$mail->Host       = "mail.sugarsaltstation.com";
				$mail->SMTPAuth   = true;
				$mail->Username   = "developer@sugarsaltstation.com";
				$mail->Password   = 'MbszOo^C0c$A';
				$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
				$mail->Port       = 587;

				$mail->setFrom("support@babykish.ae", "BabyKish");
				$mail->addAddress($send_guestEmail, "Your Order from BabyKish!");
				$mail->addBCC("support@babykish.ae", "New Product Order");
				$mail->addCC("coadmuzik@gmail.com", "New Product Order");
				$mail->addReplyTo("support@babykish.ae", "BabyKish");

				// Content
				$mail->Subject = "Your Order from BabyKish!";
        		$mail->Body    = "
        			<html>
        				<head>
        					<style>
        						h1, h2, h3, h4, h5, h6, p{
            						margin-bottom: 10px;
            					}
            					hr{
            					    border-top: 1px solid rgba(0,0,0,0.1);
            					}
            					body{
									background: #f1f1f1;
									padding:1%;
									margin:auto;
									font-family: 'Quicksand', sans-serif;
								}
								.center {
									margin: auto;
									width: 98%;
									padding: 1%;
									background: #ffffff;
									border-radius: 10px;
								}
                                .wizBtn{
                                	padding: 14px 20px;
                                	background: #f0d264;
                                	color: #333;
                                	text-decoration: none;
                                	border-radius: 12px;
                                	transition: all 1s ease;
                                }
                                .wizBtn:hover {
                                -webkit-box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
                                -moz-box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
                                box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
                                }
                                .btnP{
                                	padding: 30px 0;
                                }
        					</style>
        					<link href='https://fonts.googleapis.com/css2?family=Quicksand:wght@600&display=swap' rel='stylesheet' />
        				</head>
        				<body>
            				<div class='center'>	
            					<center>
									<img src='https://www.childrendc.com/images/logo.png' width='50%' style='margin:20px;' />
								</center><hr />
            					<h2>Dear $send_guestName, <br>Thanks For Shopping With Us!</h2>
								
            					<p>An account has been created for you with the information provided.</p>
								
            					<p>To Log into Your Account, please use the same email provided and your provided Phone number as login details.</p>
								
            					<hr />
            					<p>Below is your login details:</p>
            					<p>Email Address: $send_guestEmail</p>
            					<p>Password: $send_guestMobile</p>
								
            					<hr />
                				<p><b>Total Amount Due:</b> $currency $total</p>
                				<p><b>Your Order Reference Number is:</b> $invoice_no</p>
                				<p><b>Total Products:</b> $count_pro</p>
								$postComm
                				
								<hr />
								<h4>Important Points:</h4>
								<p>Please note that your order has been received by Us and we will get in touch with you soon to schedule your product delivery.</p>
								
								<p>To view your order history, please login to your personal user control panel from this link <br><a href='https://www.childrendc.com/client_access/'>User Control Panel</a>.</p>
						
								<h4>Thanks Again For Shopping With Us!</h4><hr />
								<p>Phone: <a href='tel:$wiscoy_phone1'>$wiscoy_phone1</a></p>
								<p>Email: <a href='mailto:$wiscoy_email1'>$wiscoy_email1</a></p>
								<p>Website: <a href='https://www.childrendc.com/'>www.childrendc.com</a></p>
            				</div>
        				</body>
        			</html>
        		";
        		//send mail ends
        		
        		if(!$mail->send()){
					echo $mail->ErrorInfo;
				}else{
					$insert_order = "insert into customer_orders (customer_id, due_amount, invoice_no, total_products, order_date, order_status, payment_method, customer_address, customer_phone, customer_location, order_discount, total_amount, approval_status) values ('$customer_id','$total','$invoice_no','$count_pro',NOW(),'$status','$pmt_method','$send_guestAddress','$send_guestMobile','$send_guestCity','','','')";
					$run_order = mysqli_query($con, $insert_order);
					if($run_order){
						$empty_cart = "delete from cart where ip_address = '$ip' AND customer_user_agent = '$customa_user_agent_id'";
						$run_del = mysqli_query($con, $empty_cart);
						if($run_del){ echo "success"; }else{ echo "delete-problem"; }
					}else{ echo "customer-order-problem"; }
				}
				
			}else{echo "customer-create-problem";}
	}
}
?>