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/taladonnuch.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/taladonnuch.com/cart/cart_confirm_220262.php
<?php include('../include/meta.php');?>
<?php include('../include/head.php');?>
<?php include('../include/menu.php');?>
    

<div class="container div_main p_top40">
    <div class="row">
      <div class="col-md-12" align="center">
      		<div class="text_header">รายการสั่งซื้อของคุณ</div>
            <div ><a href="#" class="font_pro_all"> คุณสามมารภเพิ่มจำนาวนสินค้า หรือลดจะนวนสินค้าได้ที่</a> <img src="../image/icon_add.jpg" width="11" height="11"> <img src="../image/icon_delete.jpg" width="11" height="11"></div>
      </div>
    </div>
</div>



<?php



if(isset($_POST['shipping']))
{
	$_SESSION['shipping_id'] = $_POST['shipping'];	
}

$list_sp = array('table'=>'shipping','where'=>'status = 1 AND id = "'.$_SESSION['shipping_id'].'"');				  
$view_sp = $view_db->view($list_sp);
$row_sp = $view_db->q($view_sp);
?>
<div class="container div_main p_top40">
    <div class="row">
      <div class="col-md-12">
      <table width="100%" border="0" class="tb_cart_list tb_com">
          <tr align="center">
            <td width="15%">รูปสินค้า</td>
            <td align="left">ชื่อสินค้า / รหัส</td>
            <td width="10%"></td>
            <td width="7%">ขนาด</td>
            <td width="10%">จำนวน</td>
            <td width="10%">ราคารวม</td>
          </tr>
          <?php
		  $total='';
          $num = 0;
          foreach( $_SESSION["cart"] as $key => $value ) 
		  {
			$num_mod = $num % 2;
			
			$sql_pro = array('table'=>'product','where'=>"id = '". $_SESSION["cart"][$key]['id']."'");
			$view_pro = $view_db->view($sql_pro);
			$row_pro = $view_db->q($view_pro);
			
			$sql_pros = array('table'=>'product_size','where'=>"product_id = '". $_SESSION["cart"][$key]['id']."' AND size = '".$_SESSION["cart"][$key]['sz']."'");
			$view_pros = $view_db->view($sql_pros);
			$row_pros = $view_db->q($view_pros);
			
			
			
			?>
            <tr align="center" <?php if($num_mod == 1){ ?>class="td_cart_2"<?php }?>>
                <td><div class="pro_img_2"><img src="../redbag/product/thumb/<?php echo $row_pro['image']?>" width="85" class="img_res img_nocopy"></div></td>
                <td align="left">
                <div style="font-weight:bold;"><?php echo $row_pro['name']?></div>
                <div style="color:#8b8a8a;">รหัสสินค้า : <?php echo $row_pro['code']?></div>
                </td>
                <td><?php echo number_format( $row_pros['price'], 2, '.', '' );?> บาท</td>
                <td><?php echo $_SESSION["cart"][$key]['sz'] ?></td>
                <td><?php echo $_SESSION["cart"][$key]['item'] ?></td>
                <td><?php $price = $row_pros['price'] * $_SESSION["cart"][$key]['item'];?><?php echo number_format( $price, 2, '.', '' );?> บาท</td>
            </tr>
            <?php
			$_SESSION["cart"][$key]['price'] = $price;
			$total = $total +  $price;
			$num++;	  
		  }
		  $total_all = $total + $row_sp['price'];
		  ?>
           <tr class="td_cart_2 tr_15">
            <td colspan="2"></td>
            <td align="right" style="padding:15px;font-weight:bold;" colspan="2">ราคารวมทั้งหมด</td>
            <td align="left" style="padding:15px;color:#f68236;" colspan="2"><?php echo number_format( $total, 2, '.', '' );?> บาท</td>
          </tr>
        
          <?php
		  	$i=0;
		    $date_today = date('Y-m-d');
			$sql_promo = array('table'=>'promotion','where'=>" ( from_date <= '".$date_today."' AND to_date >=  '".$date_today."'  ) AND status = 1 ORDER BY type DESC");
			$view_promo = $view_db->view($sql_promo);
			$result_promo = $view_db->q_re($view_promo);
			unset($_SESSION["discount"]);
			while($row_promo = $view_db->q_ro($result_promo))
			{
				
				if($row_promo['type'] == 2)
				{
					if($row_promo['money'] <= $total)
					{
						$name_promotion =  $row_promo['name'];
						
						 ?>
                         <tr class="td_cart_2">
                            <td colspan="1"  style="width:1px;"></td>
                            <td align="right" style="padding:15px;font-weight:bold;color:#F00;" colspan="3"><?php echo $name_promotion ;?></td>
                         <?php
						 $ch_idproduct_promo = 0; 
						 foreach( $_SESSION["cart"] as $key => $value ) 
						 {
							 if($row_promo['id_pro_pm'] == $_SESSION["cart"][$key]['id']) 
							 {
								$ch_idproduct_promo = 1;
								$id_pd2 = $_SESSION["cart"][$key]['id'];
								$sql_pro_price = array('table'=>'product_size','where'=>"product_id = '". $_SESSION["cart"][$key]['id']."'");
								$view_pro_price = $view_db->view($sql_pro_price);
								$row_pro_price = $view_db->q($view_pro_price);
								$promo_price = $row_pro_price['price'];
							 }
						 }
						 if ($ch_idproduct_promo == 1) 
						 {
								$discount = $promo_price - $row_promo['id_pro_pm_price'];
								$total_all = $total_all - $discount;
								$_SESSION["discount"][$i]['id'] = $row_promo['id'];
								$_SESSION["discount"][$i]['type'] = $row_promo['type'];
								$_SESSION["discount"][$i]['name'] = $name_promotion;
								$_SESSION["discount"][$i]['amount'] = $discount;
								$_SESSION["discount"][$i]['id_pd'] = $id_pd2;	
								?>
								 <td align="left"  style="padding:15px;color:#f68236;" colspan="2"><?php echo number_format( $discount, 2, '.', '' );?> บาท</td>
								<?php
						 }
						 else
						 {
							 ?>
                                 <td align="left"  style="padding:15px;color:#f68236;" colspan="2">
                                  <form name="myform_promo" action="add_promotion.php" method="post">
								  <input type="checkbox" name="check_promo" value="<?php echo $row_promo['id_pro_pm']?>" onClick="submit_promotion()" id="check_promo"> ใช้สิทธิ์แลกซื้อ
                                  <input type="hidden" name="promo_type" value="2">
                                  <input type="hidden" name="promo_type_id" value="<?php echo $row_promo['id'];?>">
								 </form>
                                  </td>
                                 <?php 
								
						 }
						 ?> 
                        </tr>
                         <?php
					}
				}
				if($row_promo['type'] == 3)
				{
					$arr_id_pro = explode(',',$row_promo['id_pro']);
					$ch_idproduct_promo_3 = 0; 
					$ch_idproduct_promo_3_idpro = 0; 
					foreach( $_SESSION["cart"] as $key => $value ) 
					{
						if (in_array($_SESSION["cart"][$key]['id'], $arr_id_pro))
						{
							$ch_idproduct_promo_3 = 1; 
						}
						if ($_SESSION["cart"][$key]['id'] == $row_promo['id_pro_pm'])
						{
							$ch_idproduct_promo_3_idpro = 1;//สินค้าแลกซื้อ
							$id_pd3 = $_SESSION["cart"][$key]['id'];
							$sql_pro_price = array('table'=>'product_size','where'=>"product_id = '". $_SESSION["cart"][$key]['id']."'");
							$view_pro_price = $view_db->view($sql_pro_price);
							$row_pro_price = $view_db->q($view_pro_price);
							$promo_price3 = $row_pro_price['price'];
						}
					}
					
					if ($ch_idproduct_promo_3 == 1)
					{
						$name_promotion3 =  $row_promo['name'];
						if($ch_idproduct_promo_3_idpro == 1)
						{
							$discount3 = $promo_price3 - $row_promo['id_pro_pm_price'];
							$total_all = $total_all - $discount3;
							 $_SESSION["discount"][$i]['id'] = $row_promo['id'];
							 $_SESSION["discount"][$i]['type'] = $row_promo['type'];
							 $_SESSION["discount"][$i]['name'] = $name_promotion3;
							 $_SESSION["discount"][$i]['amount'] = $discount3;
							 $_SESSION["discount"][$i]['id_pd'] = $id_pd3;
							?>
							 <tr class="td_cart_2">
								<td colspan="1"  style="width:1px;"></td>
								<td align="right" style="padding:15px;font-weight:bold;color:#F00;" colspan="3"><?php echo $name_promotion3;?></td>
								<td align="left"  style="padding:15px;color:#f68236;" colspan="2"><?php echo number_format( $discount3, 2, '.', '' );?> บาท</td>
							</tr>
							<?php
						}
						else
						{
							?>
                             <tr class="td_cart_2">
								<td colspan="1"  style="width:1px;"></td>
								<td align="right" style="padding:15px;font-weight:bold;color:#F00;" colspan="3"><?php echo $name_promotion3 ;?></td>
								<td align="left"  style="padding:15px;color:#f68236;" colspan="2">
                                 <form name="myform_promo3" action="add_promotion.php" method="post">
								  <input type="checkbox" name="check_promo" value="<?php echo $row_promo['id_pro_pm']?>" onClick="submit_promotion3()" id="check_promo"> ใช้สิทธิ์แลกซื้อ
                                  <input type="hidden" name="promo_type" value="3">
                                   <input type="hidden" name="promo_type_id" value="<?php echo $row_promo['id'];?>">
								 </form>
                                </td>
							</tr>
                            <?php
						}
					}
				}
				if($row_promo['type'] == 1)
				{
					if($row_promo['money'] <= $total)
					{
						$name_promotion =  $row_promo['name'];
						$total = $total - $promo_price - $promo_price3;//ไม่คิดราคาจากโปรอื่น
						$discount = $total*$row_promo['discount']/100;
						$total_all = $total_all - $discount;
						 $_SESSION["discount"][$i]['id'] = $row_promo['id'];
						 $_SESSION["discount"][$i]['name'] = $name_promotion;
						 $_SESSION["discount"][$i]['amount'] = $discount;
						 $_SESSION["discount"][$i]['type'] = $row_promo['type'];
						?>
                         <tr class="td_cart_2">
                            <td colspan="1"  style="width:1px;"></td>
                            <td align="right" style="padding:15px;font-weight:bold;color:#F00;" colspan="3"><?php echo $name_promotion ;?>
                            <br><span style="font-size:14px;color:#999;"> *ไม่คิดรวมกับจากโปรโมชั่นอื่น </span>
                            </td>
                            <td align="left"  style="padding:15px;color:#f68236;" colspan="2"><?php echo number_format( $discount, 2, '.', '' );?> บาท</td>
                        </tr>
                        <?php
					}
				}
				
				if($row_promo['type'] == 4)
				{
					$price_promo4=0;
					$arr_id_type = explode(",",$row_promo['id_type']);
					$i_4=1;
					$id_type_c = count($arr_id_type);
					foreach( $arr_id_type as $key => $value ) 
					{
						if($i_4==1 && $id_type_c > 1 )
						{
							$type_id = ' type_id = ' . '"'.$value.'" OR ';
							
						}
						else if($i_4 > 1 && $id_type_c <> $i_4 )
						{
							$type_id = $type_id.' type_id = ' . '"'.$value.'" OR ';
						}
						else if($i_4 > 1 && $id_type_c == $i_4 )
						{
							$type_id = $type_id . ' type_id = ' . '"'.$value.'"';
						}
						else
						{
							$type_id = ' type_id = ' . '"'.$value.'"';
						}
						
						$i_4++;
					}
					$type_id = ' AND (' . $type_id .')';
					
					
					 foreach( $_SESSION["cart"] as $key => $value ) 
					 {
						$sql_pro = array('table'=>'product','where'=>"id = '". $_SESSION["cart"][$key]['id']."' AND texture_id = '".$row_promo['id_texture']."'" . $type_id);
						$view_pro = $view_db->view($sql_pro);
						$row_pro = $view_db->q($view_pro);
						
						
						if($row_pro['id'])
						{
							$sql_pros = array('table'=>'product_size','where'=>"product_id = '". $_SESSION["cart"][$key]['id']."' AND size = '".$_SESSION["cart"][$key]['sz']."'");
							$view_pros = $view_db->view($sql_pros);
							$row_pros = $view_db->q($view_pros);	
							
							$price  =   $row_pros['price'] * $_SESSION["cart"][$key]['item'];
							$price_promo4 = $price_promo4 + $price;
						}
						
					 }		
					 $discount=0;			
					if($price_promo4 > 0)
					{
						$name_promotion =  $row_promo['name'];
						$discount = $price_promo4*$row_promo['discount']/100;
						$discount = ceil($discount);
						$total_all = $total_all - $discount;
						 $_SESSION["discount"][$i]['id'] = $row_promo['id'];
						 $_SESSION["discount"][$i]['name'] = $name_promotion;
						 $_SESSION["discount"][$i]['amount'] = $discount;
						 $_SESSION["discount"][$i]['type'] = $row_promo['type'];
						?>
                         <tr class="td_cart_2">
                            <td colspan="1"  style="width:1px;"></td>
                            <td align="right" style="padding:15px;font-weight:bold;color:#F00;" colspan="3"><?php echo $name_promotion ;?>
                            <br><span style="font-size:14px;color:#999;"> *ไม่คิดรวมกับจากโปรโมชั่นอื่น </span>
                            </td>
                            <td align="left"  style="padding:15px;color:#f68236;" colspan="2"><?php echo number_format( $discount, 2, '.', '' );?> บาท</td>
                        </tr>
                        <?php
					}
				}
					
				$i++;
			}
		  ?>
            <tr class="td_cart_2">
            <td colspan="2"  style="width:1px;"></td>
            <td align="right" style="padding:15px;font-weight:bold;" colspan="2"><?php echo $row_sp['name']?></td>
            <td align="left"  style="padding:15px;color:#f68236;" colspan="2"><?php echo number_format( $row_sp['price'], 2, '.', '' );?> บาท</td>
          </tr>
          
          
          <tr class="td_cart_2">
            <td colspan="2"></td>
            <td align="right" style="padding:15px;font-weight:bold;" colspan="2">ยอดชำระทั้งหมด</td>
            <td align="left" style="padding:15px;color:#f68236;" colspan="2"><?php echo number_format( $total_all, 2, '.', '' );?> บาท</td>
          </tr>
        </table>



      <table width="100%" border="0" class="tb_cart_list tb_moblie">
          <tr align="center">
            <td width="15%"></td>
            <td align="left"></td>
            <td width="10%"></td>
          </tr>
          
          <?php
		  $total = '';
		$num = 0;
		foreach( $_SESSION["cart"] as $key => $value ) 
		{
			$num_mod = $num % 2;
			
			$sql_pro = array('table'=>'product','where'=>"id = '". $_SESSION["cart"][$key]['id']."'");
			$view_pro = $view_db->view($sql_pro);
			$row_pro = $view_db->q($view_pro);
			
			$sql_pros = array('table'=>'product_size','where'=>"product_id = '". $_SESSION["cart"][$key]['id']."' AND size = '".$_SESSION["cart"][$key]['sz']."'");
			$view_pros = $view_db->view($sql_pros);
			$row_pros = $view_db->q($view_pros);
			?>
            <tr align="center" <?php if($num_mod == 1){ ?>class="td_cart_2"<?php }?>>
                <td><div class="pro_img_2"><img src="../redbag/product/thumb/<?php echo $row_pro['image']?>" width="85" class="img_res img_nocopy"></div></td>
                <td align="left" style="padding-left:5px;">
                    <div style="font-weight:bold;"><?php echo $row_pro['name']?></div>
                    <div style="color:#8b8a8a;">รหัสสินค้า : <?php echo $row_pro['code']?></div>
                    <div style="color:#8b8a8a;">ขนาด : <?php echo $_SESSION["cart"][$key]['sz'] ?></div>
                    <div style="color:#8b8a8a;">ราคา : <?php echo number_format( $row_pros['price'], 2, '.', '' );?> บาท</div>
                    
                </td>
                <td>
                จำนวน <br>
                <?php echo $_SESSION["cart"][$key]['item'] ?>
                <div style="font-weight:bold;margin-top:25px;" ><?php $price = $row_pros['price'] * $_SESSION["cart"][$key]['item'];?><?php echo number_format( $price, 2, '.', '' );?> บาท</div>
                </td>
          </tr>
            <?php
		$_SESSION["cart"][$key]['price'] = $price;
		$total = $total +  $price;
		$num++;	
		}
		$total_all = $total + $row_sp['price'];
	  ?>
          
        
          <tr align="left" class="td_cart_2">
            <td style="padding:15px;font-weight:bold;" colspan="2">ราคารวมทั้งหมด</td>
            <td style="padding:15px;color:#f68236;width:50%"><?php echo number_format( $total, 2, '.', '' );?> บาท</td>
          </tr>
           <?php
		  	$i=0;
		    $date_today = date('Y-m-d');
			$sql_promo = array('table'=>'promotion','where'=>" ( from_date <= '".$date_today."' AND to_date >=  '".$date_today."'  ) AND status = 1 ORDER BY type DESC");
			$view_promo = $view_db->view($sql_promo);
			$result_promo = $view_db->q_re($view_promo);
			//unset($_SESSION["discount"]);
			while($row_promo = $view_db->q_ro($result_promo))
			{
				if($row_promo['type'] == 1)
				{
					if($row_promo['money'] <= $total)
					{
						$name_promotion =  $row_promo['name'];
						$total = $total - $promo_price - $promo_price3;//ไม่คิดราคาจากโปรอื่น
						$discount = $total*$row_promo['discount']/100;
						$total_all = $total_all - $discount;
						 $_SESSION["discount"][$i]['id'] = $row_promo['id'];
						 $_SESSION["discount"][$i]['name'] = $name_promotion;
						 $_SESSION["discount"][$i]['amount'] = $discount;
						 $_SESSION["discount"][$i]['type'] = $row_promo['type'];
						 ?>
						 <tr align="left" class="td_cart_2">
                            <td style="padding:15px;font-weight:bold;color:#F00;" colspan="2"><?php echo $name_promotion ;?></td>
                            <td style="padding:15px;color:#f68236;width:50%"><?php echo number_format( $discount, 2, '.', '' );?> บาท</td>
                          </tr>
						 <?php
					}
				}
				
				
				
				
				if($row_promo['type'] == 2)
				{
					if($row_promo['money'] <= $total)
					{
						$name_promotion =  $row_promo['name'];
						 ?>
                          <tr align="left" class="td_cart_2">
                            <td style="padding:15px;font-weight:bold;color:#F00;" colspan="2"><?php echo $name_promotion?></td>
                         <?php
						  $ch_idproduct_promo = 0; 
						 foreach( $_SESSION["cart"] as $key => $value ) 
						 {
							 if($row_promo['id_pro_pm'] == $_SESSION["cart"][$key]['id']) 
							 {
								$ch_idproduct_promo = 1;
								$id_pd2 = $_SESSION["cart"][$key]['id'];
								$sql_pro_price = array('table'=>'product_size','where'=>"product_id = '". $_SESSION["cart"][$key]['id']."'");
								$view_pro_price = $view_db->view($sql_pro_price);
								$row_pro_price = $view_db->q($view_pro_price);
								$promo_price = $row_pro_price['price'];
							 }
						 }
						 if ($ch_idproduct_promo == 1) 
						 {
								$discount = $promo_price - $row_promo['id_pro_pm_price'];
								$total_all = $total_all - $discount;
								$_SESSION["discount"][$i]['id'] = $row_promo['id'];
								$_SESSION["discount"][$i]['type'] = $row_promo['type'];
								$_SESSION["discount"][$i]['name'] = $name_promotion;
								$_SESSION["discount"][$i]['amount'] = $discount;
								$_SESSION["discount"][$i]['id_pd'] = $id_pd2;	
								?>
                                 <td style="padding:15px;color:#f68236;width:50%"><?php echo number_format( $discount, 2, '.', '' );?> บาท</td>
								<?php
						 }
						 else
						 {
							 ?>
                              <td style="padding:15px;color:#f68236;width:50%">
                               <form name="myform_promo2" action="add_promotion.php" method="post">
								  <input type="checkbox" name="check_promo" value="<?php echo $row_promo['id_pro_pm']?>" onClick="submit_promotion2()" id="check_promo"> ใช้สิทธิ์แลกซื้อ
                                  <input type="hidden" name="promo_type" value="2">
                                   <input type="hidden" name="promo_type_id" value="<?php echo $row_promo['id'];?>">
								 </form>
                              
                              </td>
                               
                                 <?php 
						 }
						 ?> 
                        </tr>
                         <?php
					}
				}
				if($row_promo['type'] == 3)
				{
					$arr_id_pro = explode(',',$row_promo['id_pro']);
					$ch_idproduct_promo_3 = 0; 
					$ch_idproduct_promo_3_idpro = 0; 
					foreach( $_SESSION["cart"] as $key => $value ) 
					{
						if (in_array($_SESSION["cart"][$key]['id'], $arr_id_pro))
						{
							$ch_idproduct_promo_3 = 1; 
						}
						if ($_SESSION["cart"][$key]['id'] == $row_promo['id_pro_pm'])
						{
							$ch_idproduct_promo_3_idpro = 1;//สินค้าแลกซื้อ
							$id_pd3 = $_SESSION["cart"][$key]['id'];
							$sql_pro_price = array('table'=>'product_size','where'=>"product_id = '". $_SESSION["cart"][$key]['id']."'");
							$view_pro_price = $view_db->view($sql_pro_price);
							$row_pro_price = $view_db->q($view_pro_price);
							$promo_price3 = $row_pro_price['price'];
						}
					}
					if ($ch_idproduct_promo_3 == 1)
					{
						if($ch_idproduct_promo_3_idpro == 1)
						{
							$discount3 = $promo_price3 - $row_promo['id_pro_pm_price'];
							$total_all = $total_all - $discount3;
							 $_SESSION["discount"][$i]['id'] = $row_promo['id'];
							 $_SESSION["discount"][$i]['type'] = $row_promo['type'];
							 $_SESSION["discount"][$i]['name'] = $name_promotion3;
							 $_SESSION["discount"][$i]['amount'] = $discount3;
							 $_SESSION["discount"][$i]['id_pd'] = $id_pd3;
							?>
                             <tr align="left" class="td_cart_2">
                                <td style="padding:15px;font-weight:bold;" colspan="2"><?php echo $name_promotion3 ?></td>
                                <td style="padding:15px;color:#f68236;width:50%">
                                <?php echo number_format( $discount3, 2, '.', '' );?> บาท
                                </td>
                              </tr>
							<?php
						}
						else
						{
							?>
                              <tr align="left" class="td_cart_2">
                                <td style="padding:15px;font-weight:bold;color:#F00;" colspan="2"><?php echo $name_promotion3 ?></td>
                                <td style="padding:15px;color:#f68236;width:50%">
                                <form name="myform_promo4" action="add_promotion.php" method="post">
                                    <input type="checkbox" name="check_promo" value="<?php echo $row_promo['id_pro_pm']?>" onClick="submit_promotion4()" id="check_promo"> ใช้สิทธิ์แลกซื้อ
                                    <input type="hidden" name="promo_type" value="3">
                                    <input type="hidden" name="promo_type_id" value="<?php echo $row_promo['id'];?>">
								 </form>
                                </td>
                              </tr>
                            <?php
						}
					}
				}
				
				
				
				if($row_promo['type'] == 4)
				{
					$price_promo4=0;
					$arr_id_type = explode(",",$row_promo['id_type']);
					$i_4=1;
					$id_type_c = count($arr_id_type);
					foreach( $arr_id_type as $key => $value ) 
					{
						if($i_4==1 && $id_type_c > 1 )
						{
							$type_id = ' type_id = ' . '"'.$value.'" OR ';
						}
						else if($i_4 > 1 && $id_type_c <> $i_4 )
						{
							$type_id = $type_id.' type_id = ' . '"'.$value.'" OR ';
						}
						else if($i_4 > 1 && $id_type_c == $i_4 )
						{
							$type_id = $type_id . ' type_id = ' . '"'.$value.'"';
						}
						else
						{
							$type_id = ' type_id = ' . '"'.$value.'"';
						}
						$i_4++;
					}
					$type_id = ' AND (' . $type_id .')';
					
					
					 foreach( $_SESSION["cart"] as $key => $value ) 
					 {
						$sql_pro = array('table'=>'product','where'=>"id = '". $_SESSION["cart"][$key]['id']."' AND texture_id = '".$row_promo['id_texture']."'" . $type_id);
						$view_pro = $view_db->view($sql_pro);
						$row_pro = $view_db->q($view_pro);						
						if($row_pro['id'])
						{
							$sql_pros = array('table'=>'product_size','where'=>"product_id = '". $_SESSION["cart"][$key]['id']."' AND size = '".$_SESSION["cart"][$key]['sz']."'");
							$view_pros = $view_db->view($sql_pros);
							$row_pros = $view_db->q($view_pros);	
							
							$price  =   $row_pros['price'] * $_SESSION["cart"][$key]['item'];
							$price_promo4 = $price_promo4 + $price;
						}
					 }		
					 $discount =0;			
					if($price_promo4 > 0)
					{
						$name_promotion =  $row_promo['name'];
						$discount = $price_promo4*$row_promo['discount']/100;
						$discount = ceil($discount);
						$total_all = $total_all - $discount;
						 $_SESSION["discount"][$i]['id'] = $row_promo['id'];
						 $_SESSION["discount"][$i]['name'] = $name_promotion;
						 $_SESSION["discount"][$i]['amount'] = $discount;
						 $_SESSION["discount"][$i]['type'] = $row_promo['type'];
						?>
                         <tr align="left" class="td_cart_2">
                            <td style="padding:15px;font-weight:bold;color:#F00;" colspan="2"><?php echo $name_promotion ;?>
                            <br><span style="font-size:14px;color:#999;"> *ไม่คิดรวมกับจากโปรโมชั่นอื่น </span>
                            </td>
                            <td style="padding:15px;color:#f68236;width:50%"><?php echo number_format( $discount, 2, '.', '' );?> บาท</td>
                          </tr>
                        <?php
					}
				}
				$i++;
			}
			
		  ?>
            <tr align="left" class="td_cart_2">
            <td style="padding:15px;font-weight:bold;" colspan="2"><?php echo $row_sp['name']?></td>
            <td style="padding:15px;color:#f68236;width:50%"><?php echo number_format( $row_sp['price'], 2, '.', '' );?> บาท</td>
          </tr>
            <tr align="left" class="td_cart_2">
            <td style="padding:15px;font-weight:bold;" colspan="2">ยอดชำระทั้งหมด</td>
            <td style="padding:15px;color:#f68236;width:50%"><?php echo number_format( $total_all, 2, '.', '' );?> บาท</td>
          </tr>
        </table>
      
      		
      </div>
    </div>
</div>

<script type="text/javascript">
function submit_promotion()
{
  document.myform_promo.submit();
}
function submit_promotion2()
{
  document.myform_promo2.submit();
}
function submit_promotion3()
{
  document.myform_promo3.submit();
}
function submit_promotion4()
{
  document.myform_promo4.submit();
}
</script>

<div class="container div_main">
    <div class="row">
      <div class="col-md-12" align="center">
            
            <div style="padding-top:60px;">   <img src="../image/icon_graph.png" width="97" height="22"> </div>
            
            <div class="line"></div>
      </div>
    </div>
</div>

<?php
if(isset($row_sp['price'])){$_SESSION["shipping"] = $row_sp['price'];}
if(isset($_POST['name'])){$_SESSION['ship_addr']['name']=$_POST['name'];}
if(isset($_POST['lastname'])){$_SESSION['ship_addr']['lastname']=$_POST['lastname'];}
if(isset($_POST['address'])){$_SESSION['ship_addr']['address']=$_POST['address'];}

if(isset($_POST['province'])){$_SESSION['ship_addr']['province']=$_POST['province'];}
if(isset($_POST['zip'])){$_SESSION['ship_addr']['zip']=$_POST['zip'];}
if(isset($_POST['phone'])){$_SESSION['ship_addr']['phone']=$_POST['phone'];}
if(isset($_POST['mail'])){$_SESSION['ship_addr']['mail']=$_POST['mail'];}




/*$_SESSION['ship_addr']['alley']=$_POST['alley'];
$_SESSION['ship_addr']['road']=$_POST['road'];
$_SESSION['ship_addr']['zone']=$_POST['zone'];
$_SESSION['ship_addr']['area']=$_POST['area'];*/



?>

<div class="container div_main p_top40">
    <div class="row">
      <div class="col-md-12" align="center">
      		<div class="text_header">ที่อยู่จัดส่งสินค้า</div>
            <div style="text-decoration:underline;"> รายละเอียด</div>
            
            <div class="p_top20" style="font-weight:bold;">ชื่อที่อยู่จัดส่งสินค้า </div>
            <div class="p_top20" align="center">
            คุณ<?php echo $_SESSION['ship_addr']['name'] . ' ' . $_SESSION['ship_addr']['lastname']?> <br>
            <?php echo $_SESSION['ship_addr']['address'] ?> <?php echo $_SESSION['ship_addr']['province'] ?>  <?php echo $_SESSION['ship_addr']['zip'] ?> <br>
            โทร. <?php echo $_SESSION['ship_addr']['phone'] ?> <br>
           </div>
      </div>
    </div>
</div>

<link href="../include/Fullscreen-Loading/src/css/HoldOn.css" rel="stylesheet" type="text/css">
<script src="../include/Fullscreen-Loading/jquery-1.11.3.min.js"></script>
<script src="../include/Fullscreen-Loading/src/js/HoldOn.js"></script>
<script>
                            
function testHoldon(themeName){
	HoldOn.open({
		theme:themeName,
		message:"<h4> กำลังโหลดข้อมูล </h4>"
	});
	
   /* setTimeout(function(){
		HoldOn.close();
	},5000);*/
}
function testHoldon_cl(themeName){
	/*HoldOn.open({
		theme:themeName,
		//message:"<h4> กำลังโหลดข้อมูล </h4>"
	});*/
	
    setTimeout(function(){
		HoldOn.close();
	},0);
}

</script>
<script>

function checkform_pm()
{
	if(document.from_pm.check.checked == false){alert("ขออภัยค่ะกรุณายืนยันข้อมูล");document.from_pm.check.focus();return false;}
	else
	{
		
		
		
			testHoldon('sk-circle');
			
			var params = 
			"pm_1="+document.querySelector('input[name=pm_1]:checked').value;
			
	
			
			var xmlhttp = new XMLHttpRequest();
			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				
						testHoldon_cl('sk-circle');
				
					//alert(xmlhttp.responseText);	
					
					//window.location.href = 'https://homhuan.com/car/'.xmlhttp.responseText;	
					
					/*if(xmlhttp.responseText == 'F')
					{
						window.location.href="http://homhuan.com";
					}
					else
					{
						window.location.href=xmlhttp.responseText;
					}*/
					
					
					window.location.href = xmlhttp.responseText;
					
								
					//document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
				}
			};
			
			xmlhttp.open("POST", "add_order.php", true);
			xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlhttp.send(params);
			
		
	}
	
	
}


</script>

 <form method="post" name="from_pm"> 

<div class="container div_main p_top40">
    <div class="row">
      <div class="col-md-12" align="center">
      		<div class="text_header">ช่องทางชำระเงินผ่าน ATM</div>
            <div style="font-weight:bold"> กรุณาโอนเงินเข้าบัญชีออมทรัพย์ ซื่อบัญชีคุณเพ็ญพักตร์ เพิ่มพัฒนากุล</div>
           
           <?php
			$list_pm = array('table'=>'paymentmethod','where'=>'status = 1 AND type = 1','order'=> "ORDER BY id ASC");				  
			$view_pm = $view_db->view($list_pm);
			$result_pm = $view_db->q_re($view_pm);
			$num=1;
			while($row_pm = $view_db->q_ro($result_pm))
			{
				?>
                 <div class="col-md-6 col-md-offset-3 <?php if($num==1){?>p_top40<?php }?>" align="left">
                  <div class="form-group">
                   <label class="radio-inline">
                      <input type="radio" name="pm_1"  value="<?php echo $row_pm['id']?>"  <?php if($num==1){?>checked<?php }?>>
                      &nbsp; <img src="../redbag/paymentmethod/<?php echo $row_pm['image']?>" width="36" height="36" >&nbsp;  <?php echo $row_pm['name']?>	&nbsp; <?php echo $row_pm['branch']?>  &nbsp; 	เลขที่ <?php echo $row_pm['number']?>
                    </label>
                  </div>
                 </div>
                <?php
				$num++;
			}
		   ?>
      </div>
    </div>
</div>
<div class="container div_main p_top40">
    <div class="row">
      <div class="col-md-12" align="center">
      		<div class="text_header">ช่องทางชำระเงินผ่าน</div>
       </div>     
       <div class="col-md-6 col-md-offset-3 p_top40" align="center">    
           <div class="row">
           
           
           
           <?php
            $list_pm = array('table'=>'paymentmethod','where'=>'status = 1 AND type = 2','order'=> "ORDER BY id DESC");				  
			$view_pm = $view_db->view($list_pm);
			$result_pm = $view_db->q_re($view_pm);
			$num_rows = mysql_num_rows($result_pm);
			if($num_rows == 0)
			{
					?> พบกับรูปแบบการชำระเงินผ่านระบบเร็วๆนี้ <?php 
			}
			while($row_pm = $view_db->q_ro($result_pm))
			{
				?>
                <div class="col-md-12">
                <div class="form-group" align="left">
                 <label class="radio-inline">
                  <input type="radio" name="pm_1" value="<?php echo $row_pm['id']?>" >
                  <img src="../redbag/paymentmethod/<?php echo $row_pm['image']?>"  align="" class="img-responsive">
                  </label>
                </div>
                </div>
                <?php
			}
		   ?>
             
              
              <div class="col-md-12 p_top40">
              <div class="form-group" align="center"><br>
              	 <input type="checkbox" name="check" value="1"> ขอรับรองข้อความข้างต้นนี้เป็นความจริง<br>	 
                 <button type="button"  onClick="checkform_pm();" class="btn btn-default bn_send_mail">ยืนยันที่อยู่จัดส่ง</button>
              </div>
             </div>
           </div>
        </div>      
           
     
    </div>
</div>


</form>

<div id="txtHint"></div>
<div class="container div_main">
    <div class="row">
      <div class="col-md-12" align="center">
            <div class="line"></div>
      </div>
    </div>
</div>


<?php include('../themes/tap_footer.php');?>
<?php include('../themes/footer.php');?>
<?php include('../include/footer_js.php');?>

Anon7 - 2022
AnonSec Team