/Order.php
PHP | 301 lines | 262 code | 37 blank | 2 comment | 13 complexity | 977577db366660802fed474cef16a59f MD5 | raw file
- <?php
- session_start();
- include_once 'include/functions.php';
- include_once 'include/placeorder.php';
- require_once "cart.class.php";
- include('gloable.php');
- $cart = new cart();
- $cartsum=$_GET["cartsum"];
- $user = new User();
- $order = new Order();
- $uid = $_SESSION['uid'];
-
-
- if (!$user->get_session())
- {
- header("location:log in.php");
- }
- if ($_GET['q'] == 'logout')
- {
- $user->user_logout();
- header("location:log in.php");
- }
-
-
-
-
-
- if($_POST['order']) {
- $getarr = $cart->getItems();
- if(is_array($getarr)&&!empty($getarr))
- {
- $totalprice = $_POST['totalprice'];
- $date_time = time();
- $username = $_POST['name'];
- $address = $_POST['address'];
- $tel = $_POST['tel'];
- $remark = $_POST['remark'];
- $orderdate = $_POST['textfield8'];
- $date = $_POST['date'];
- $delivery = $_POST['radiobutton'];
-
- $db->insertAll('orders',"null','$uid','$username','$address','$tel','$totalprice','$date','$remark','$delivery");
-
- $sql = "select Order_id from orders order by Order_id DESC limit 0,1";
- $no_rows = $db->fetch_array($db->query($sql));
- $no_rows = $no_rows['Order_id'];
-
- foreach($getarr as $pkey=>$pval)
- {
- $shop_nums += $pval['num'];
- $total_price +=$pval['num']*$pval['Product_price'];
- if($pkey!=null)
- {
-
- $db->insertAll('order_detail',"null','$no_rows','".$pval['Product_name']."','".$pval['Product_images']."','".$pval['Product_infomation']."','".$pval['Product_price']."','".
- $pkey."','".$pval['num']."','$uid");
-
- }
- }
-
-
- unset($_SESSION['cart']);
- $db->Get_admin_msg("eshop.php",'add success');
- }
-
- }
-
-
-
-
- ?>
-
-
-
-
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <link rel="stylesheet" href="feature.css" type="text/css">
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>Order</title>
-
- </head>
-
- <body>
- <table width="101%" border="0" height="30" bgcolor="#FFFFFF">
- <tr>
- <td width="16%">Welcome to pets family! </td>
- <td width="7%"><a href="Register.php" style=" color:#3366CC;">Register</a></td>
- <td width="6%"><a href="log in.php" style=" color:#3366CC;">Sign in </a></td>
- <td width="61%"><a href="?q=logout" style=" color:#3366CC;">Sign out </a></td>
- <td width="10%"><a href="PersonalCenter.php" style=" color:#3366CC;">Personal Center </a></td>
- </tr>
- </table>
-
- <table width="100%" border="0">
- <tr>
- <td><a href="index.php"><img src="Untitled-2_??.gif" width=100% height="250" /></a>
- <?php include('header.php');?></td>
-
- </tr>
-
- </table>
- <h1 style=" color:#3366CC;"> Hello <?php $user->get_fullname($uid); ?></h1>
-
- <p > </p>
- <p align="center">
- <?php if ($_SERVER["REQUEST_METHOD"] == "POST")
- {
- $store = $order->orderuser($uid,$_POST['name'],$_POST['address'], $_POST['tel'], $_POST['remark'],$cartsum,$_POST['date'],$_POST['delivery']);
-
- if ($store)
- {
- // Registration Success
- echo 'Order submission successful !';
- } else
- {
- // Registration Failed
- echo 'Order is failed, please try again';
- }
- } ?>
- </p>
- <p> </p>
- <h1 align="center" style=" color:#3366CC;" >Make new order </h1>
- <p align="center" > </p>
-
- <form id="form2" name="form2" method="post" action="">
- <table width="65%" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFCC">
- <tr>
- <th height="349" colspan="2" scope="col"><table width="300" height="30" border="1" align="left" cellpadding="1" cellspacing="0" bordercolor="#554840">
- <tr>
- <th>Consignee Information:</th>
- </tr>
- </table>
- <p> </p>
- <p> </p>
- <table style="border:1px solid gray;" width="65%" cellpadding="3">
- <tr>
- <td width="20%" >Name:</td>
- <td width="80%" ><input name="name" type="text" size="30" maxlength="50" /> </td>
- </tr>
- <tr>
- <td >Address:</td>
- <td ><input name="address" type="text" size="30" />
- </span></td>
- </tr>
- <tr>
- <td >Tel:</td>
- <td >
- <input name="tel" type="text" size="30" />
- </span></td>
- </tr>
- <tr>
- <td height="87" class="STYLE8">Remark:</td>
- <td><strong>
- <label>
- <textarea name="remark" cols="35" rows="3"></textarea>
- </label>
- </strong></td>
- </tr>
- </table>
- <p> </p></th>
- </tr>
- <tr>
- <th height="222" colspan="2" scope="col"><table width="172" border="0" align="left" cellpadding="1" cellspacing="1">
- <tr>
- <th width="179" >Date:</th>
- </tr>
- </table>
- <p> </p>
- <p> </p>
- <p>If you not sure, we will start after we got your money. And always finish in 3 days. </p>
- <table width="65%" height="142" align="center" style="border:1px solid gray;">
- <tr>
- <th width="42%" height="45" >Order date:</th>
- <th width="58%" > <div align="left">
- <?php echo date("Y-m-d",time()+8*3600); ?>
- </div></th>
- </tr>
- <tr>
- <th height="89"><p >Require date(when you want your product): </p></th>
- <th scope="col"><p align="left" >
- <label>
- <input name="date" type="text" size="30" />
- </label>
-
- </p></th>
- </tr>
- </table></th>
- </tr>
- <tr>
- <th height="300" colspan="2" scope="col"><table width="278" border="0" align="left" cellpadding="1" cellspacing="0">
- <tr>
- <th width="276" scope="col">List of products:</th>
- </tr>
- </table>
- <p> </p>
- <p align="right">Now we have 9.5 discount if you bought over 100RMB </p>
- <table width="85%" border="0" align="center" cellpadding="0" cellspacing="1" bordercolor="#FFFFCC">
- <tr>
- <th width="104" height="28" bordercolor="#FF6600" scope="col"><div align="center" >
- <div align="center">Product ID </div>
- </div></th>
- <th width="104" height="28" bordercolor="#FF6600" scope="col"><div align="center" >
- <div align="center">images</div>
- </div></th>
- <th width="155" bordercolor="#FF6600" scope="col"><div align="center" >Product Name </div></th>
- <th width="124" bordercolor="#FF6600" scope="col"><div align="center" >Price</div></th>
- <th width="92" bordercolor="#FF6600" scope="col">Number</th>
- <th bordercolor="#FF6600" scope="col">Account</th>
- </tr>
- <?php
- $getarr = $_SESSION['cart'];;
- if(is_array($getarr)&&!empty($getarr))
- {
- $shop_nums = 0;
- $total_price= 0;
- foreach($getarr as $pkey=>$pval)
- {
- if($pkey!=null)
- {
-
-
- $shop_nums += $pval['num'];
- $total_price +=$pval['num']*$pval['Product_price'];
- ?>
- <tr>
- <td height="32" bordercolor="#FF6600"><div align="center"><?php echo $pkey?> </div></td>
- <td height="32" bordercolor="#FF6600"><div align="center"><img src="<?php echo $pval['Product_images']?>" width="100" height="100"/> </div></td>
- <td bordercolor="#FF6600"><div align="center"><?php echo $pval['Product_name']?> </div></td>
- <td bordercolor="#FF6600"><div align="center"><?php echo $pval['Product_price']?> </div></td>
- <th bordercolor="#FF6600" scope="col"><?php echo $pval['num']?> </th>
- <th bordercolor="#FF6600" scope="col"><?php echo $pval['Product_price']*$pval['num']?> </th>
- </tr>
- <?php
- }
- }
- }
- ?>
- <tr>
- <td height="32" colspan="4" bordercolor="#FF6600"></td>
- <td width="100" bordercolor="#FF6600" > </td>
- <input type="hidden" value="<?php echo $total_price;?>" name="totalprice">
- <td width="133" bordercolor="#FF6600"><div align="center">Total:<?php if($total_price >100) echo $total_price*0.95; else echo $total_price;?></div></td>
- </tr>
- </table></th>
- </tr>
- <tr>
- <th height="538" colspan="2" scope="col"><table width="310" border="0" align="left">
- <tr>
- <td width="304"><div align="center" >
- <div align="center"><span leftzone="0|9" rightzone="0|9" space="space">Payment and</span><span leftzone="9|12" rightzone="9|12" space="0| "> delivery:</span></div></td>
- </tr>
- </table>
- <p align="left" > </p>
- <p align="left" > </p>
- <p align="left" >In order to makesure products you already bought will not be making in time. Please pay 50% of totel money by remittance. You can see the Account Number in <a href="contactus.php" style=" color:#CC0033">contact us</a>.</p>
- <p align="left" > </p>
- <table width="85%" border="0" align="center"style="border:1px solid gray;">
- <tr>
- <td width="46%">
- <input type="radio" name="radiobutton" value="Get it by yourself" />
-
- Get it by yourself </td>
- <td width="54%" height="66" >
- You can pay remain money to us, see our address in <a href="contactus.php" style=" color:#CC0033">contact us</a> page. Please call us before you come. </td>
- </tr>
- <tr>
- <td class="STYLE8"><label>
- <input type="radio" name="radiobutton" value="Delivery company" />
- Delivery company
- </label></td>
- <td height="63" >
- We will help you call delivery company, you can pay the remain money to deliver. </td>
- </tr>
- </table>
- <p align="left" > </p>
- <p align="left" > </p>
- <p align="left" > </p>
- <h1 align="center" style=" color:#CC0033">We will make your products as soon as possible!</h1> </th>
- </tr>
- <tr>
- <th width="392" scope="col"> <input name="order" type="submit" value="Place the order!" /></th>
- <th width="459" scope="col"><input name="Submit" type="reset" value="Reset" /></th>
- </tr>
- </table>
- </form>
- <p> </p>
- <p> </p>
- <table width="95%" border="0" align="center" >
- <tr>
- <td width="53%" ><div align="right">Copyright 2011 Pets Family </div></td>
- <td width="16%" ><div align="center"><a href="sitemap.php" style=" color:#3366CC;">SITE MAP</a></div></td>
- <td width="31%" >e-mail: <a href="mailto:petsfamily@gmail.com" style=" color:#3366CC;">petsfamily@gmail.com</a></td>
- </tr>
-
- </table>
- <p> </p>
- </body>
- </html>