0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
shop_old_structure(not used)
/
pages
/
[
Home
]
File: buy_product.php
<? if($_POST['quantity']=="") { ?> <SCRIPT language="JavaScript"> window.location="index.php"; </SCRIPT> <? } else { $temptable=session_id(); $q_create_table="CREATE TABLE IF NOT EXISTS ".$temptable." ( `temp_id` int(3) NOT NULL auto_increment, `catalog_id` int(5) NOT NULL , `product_id` int(5) NOT NULL , `quantity` int(5) NOT NULL, `rate` decimal(6,2) NOT NULL default '0.00', `per_product_weight` int(8) NOT NULL , `total_product_weight` int(8) NOT NULL , `price` decimal(6,2) NOT NULL default '0.00', PRIMARY KEY (`temp_id`))"; $r_create_table=mysql_query($q_create_table); $q_find="select * from tbl_temp where tmp_name='".$temptable."'"; $r_find=mysql_query($q_find); if(mysql_num_rows($r_find)==0) { $q_t_in="insert into tbl_temp (tmp_id, tmp_name, date) values(NULL, '".$temptable."', '".date('Y-m-d')."')"; $r_t_in=mysql_query($q_t_in); } $price=$_POST['quantity']*$_POST['rate']; $total_weight=$_POST['quantity']*$_POST['weight']; $q_insert="insert into ".$temptable." ( `temp_id`, `catalog_id`, `product_id`, `quantity`, `rate`, `per_product_weight`, `total_product_weight`, `price`) values( NULL, '".$_GET['cat']."', '".$_GET['product_id']."', '".$_POST['quantity']."', '".$_POST['rate']."', '".$_POST['weight']."', '".$total_weight."', '".$price."' )"; $r_insert=mysql_query($q_insert); ?> <SCRIPT language="JavaScript"> window.location="index.php?page=view_cart"; </SCRIPT> <? } ?>