Location: PHPKode > scripts > ECW commerce shop > ecw-commerce-shop-6-03/user_orders.php
<?
require ("./conf.php");
if ($version=='1') 
{include ("./action.php");}
mysql_connect("$host_name","$db_user","$db_password");
mysql_select_db("$db_name");


require ("./lang.php");

echo "
$title
<script language=\"JavaScript\">
<!---
function detail(id)
 {
wl=window.open(\"./index.php?tid=\"+id+\"&c=more\",\"det\",\"toolbar=0,scrollbar,height=300,width=800\");
wl.focus();
}

var message = \"$lang[PTP]\";

function printpage() {
window.print();  
}


// -->
</script>
<form action=\"./user_orders.php\" method='POST'>
";

if ($killk!='')
{
$sql="select * from  $table_orders WHERE (id='$tid')";
$res=mysql_query("$sql");
@$usrc=mysql_fetch_array($res);

$arr_zam=split("\|",$usrc[18],20);
$allr=count($arr_zam); $allr--;
//echo ">>$allr>>";
$new_mass="";
for ($i=0; $i<$allr; $i++)
{
$tmp=split ("=",$arr_zam[$i],20);
$znarr=${"t".$i};
$new_mass=$new_mass.$tmp[0]."=".$znarr."|";
}
//echo "$new_mass";
$sql="update $table_orders SET f1='$new_mass' WHERE (id='$tid')";
mysql_query("$sql");
//echo mysql_errno().": ".mysql_error()."$sql<BR>";

$sql_ins="UPDATE $table_orders SET 
address='$address', phone='$phone',
company='$company',email='$email',breif='$breif',
cc_type='$cctype',cc_name='$ccname',
cc_expired='$ccexpired',cc_number='$ccnumber'
WHERE id='$tid'";
mysql_query("$sql_ins");
//echo mysql_errno().": ".mysql_error()."$sql_ins<BR>";

}



if ($tid!=''){$sql="select * from  $table_orders WHERE (id='$tid')";}
else
{$sql="select * from  $table_orders WHERE (login='$uorder')";}
$res=mysql_query("$sql");
@$usrc=mysql_fetch_array($res);

## if empty record
if ($usrc[0]=='')
{ if ($tid!=''){
  echo "<p><font color='#880000'>$lang[NOWI]# $tid</font><p>";
  }
  else{
 echo "<p><font color='#880000'>$lang[NOWL] $uorder</font><p>  ";
 }
 echo "<input type='button' value='$lang[Cw]' onclick='javascript:window.close();'>";
 exit;
 }
## end - if empty record

$arr_zam=split("\|", $usrc[18],20);
//$arr_zam$arr_zamecho ">>$arr_zam[10]";


if ($usrc[6]=='0') {$usrc[6]="-";}
echo "$action
     <table border='0' width=700 cellspacing=1 cellpading=1 bgcolor='#3399FF'>".
     "<tr><td class='menu'>$lang[Login]:</td><td class='menu'>$lang[Order] $lang[id]:</td>".
     "<td class='menu'>$lang[Address]:</td><td class='menu'>$lang[Breif]:</td></tr>".
     "<tr><td class='hd1'>$usrc[6]</td><td  class='hd1'>$usrc[0]</td><td  class='hd1'><input type='text' name='address' value='$usrc[9]' size=25></td><td  class='hd1'><input type='text' name='breif' value='$usrc[13]' size=25></td></tr>".
     "<td class='menu'>$lang[Email]:</td> <td class='menu'>$lang[Phone]:</td>".
     "<td class='menu'>$lang[Company]:</td>  <td class='menu'>$lang[Dataposted]:</td></tr>".
     "<td  class='hd1'><input type='text' name='email' value='$usrc[12]' size=25></td><td  class='hd1'><input type='text' name='phone' value='$usrc[10]' size=25></td><td  class='hd1'><input type='text' name='company' value='$usrc[11]' size=25></td><td  class='hd1'>$usrc[5]</td></tr>\n".
     "<td class='menu'>$lang[NameCreditCard]:</td> <td class='menu'>$lang[TypeCreditCard]:</td>".
     "<td class='menu'>$lang[ExpiredCreditCard]:</td>  <td class='menu'>$lang[NumberCreditCard]:</td></tr>".
     "<td  class='hd1'><input type='text' name='ccname' value='$usrc[15]' size=25></td><td  class='hd1'><input type='text' name='cctype' value='$usrc[14]' size=25></td><td  class='hd1'><input type='text' name='ccexpired' value='$usrc[16]' size=25></td><td  class='hd1'><input type='text' name='ccnumber' value='$usrc[17]' size=25></td></tr>\n";
echo "</table>";
echo "<table border=0 width=700><td>$lang[User]: <b>$usrc[8]</b>; $lang[order] #$lang[id] <b>$usrc[0]</td></tr></table>";

$sql="$usrc[2]";
$res=mysql_query("$sql");


echo "<table border=0 cellpading='1' align='center' cellspacing='1' width='700' bgcolor='#3399FF'>";
echo"<td class='menu'>$lang[id]:</td><td class='menu'>$lang[Title]:</td>
     <td class='menu'>$lang[Category]:</td><td class='menu'>$lang[Company]:</td>
     <td class='menu'>$lang[Price]: </td><td class='menu'>$lang[Number]: </td></tr>";
$n=0;$all=0;
while ( @$catt=mysql_fetch_array($res) )
 {
  $tpp=$zamovl[$catt[0]];
  $new=split("=", $arr_zam[$n],20);
  
if ($new[1]!='0')
      {
  echo "</tr><td class='hd1'>$catt[1]</td><td class='hd1'>$catt[2]</td><td class='hd1'>$catt[4]</td>".
       "<td class='hd1'>$catt[5]</td>".
       "<td class='hd1'>$catt[6]</td>".
       "<td class='hd1'><input type='text' name='t$n' value='$new[1]' size='3'></td>".
       "</tr>\n";
       }
$all=$all+$new[1]*$catt[6];
 $n++;
 }
// echo ">>$usrc[4] $sum*($usrc[4]/100)";
while (list ($key, $val) = each ($discount))
 {$ds=split (",",$key);
 if (($all>=$ds[0]) and ($all<=$ds[1]))
 {$ds_zn=$val;
 $zn=$all*($val/100);}
 }
$tot1=$all-$zn;

$tot=$usrc[3]-($usrc[3]*($usrc[4]/100));
echo "</table>";
echo "<table cellspacing='0' align='center' cellpading='0' width='700'>";
echo "<td width=395></td><td class=title>$lang[Totalprice]: </td><td class=title>$ $all</td></td></tr>".
     "<td width=395></td><td class=title>$lang[Discount]:  </td><td class=title>$ds_zn %</td></td></tr>".
     "<td width=395></td><td class=title>$lang[Pricewithdiscount]: </td><td class=title>$ $tot1</td></td></tr>";
echo "</table>
<input type='hidden' name='killk' value='$n'>
<input type='hidden' name='tid' value='$usrc[0]'>

$form
";
$sql="UPDATE $table_orders SET total='$all' WHERE id='$tid'";
mysql_query("$sql_ins");
//echo mysql_errno().": ".mysql_error()."$sql<BR>";


echo "<table border=0 width=700><td><center><input type='button' value='$lang[Cw]' onclick='javascript:window.close();'></center><p></td>";
echo "<td><form><input type=button value=\"$lang[PTP]\" onClick=\"printpage()\"></form></td></tr></table>";
?>
Return current item: ECW commerce shop