Размер файла: 3.74Kb
<?
include "config.inc";
$db = @mysql_connect("localhost", "$databaseuser", "$databasepasswd");
@mysql_select_db("$databasename",$db);
if ($removeall != "") {
setcookie ("basket", "");
header("Location: basket.php");
}
if ($remove != 0){
$items = explode("&", $basket);
for ($i = 0; $i < count($items)-1; $i++) {
if ($remove != $i+1) {
$newbasket = $newbasket.$items[$i]."&";
}
}
setcookie ("basket", "$newbasket");
header ("Location: basket.php");
}
?>
<html>
<head>
<title><? echo $ashopname ?> - ваша корзина</title>
</head>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#235C87" VLINK="#235C87" ALINK="#F70404">
<table width="75%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr align="center">
<td> <img src="images/logo.gif" width="208" height="70">
<hr noshade>
<font size="2" face="Arial, Helvetica, sans-serif"></font>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="40%" valign="top">
<p><font size="2" face="Arial, Helvetica, sans-serif"> <a
href="checkout.php">Сделать заказ.</a></font></p>
</td>
<td width="20%" align="center"> </td>
<td width="40%" valign="top">
<p><font size="2" face="Arial, Helvetica, sans-serif"><a href="main.php">Продожить
выбор!</a></font></p>
<p> </p>
</td>
</tr>
</table>
<p><font size="2" face="Arial, Helvetica, sans-serif"><b>
Ваша корзина содержит следующее...</b></font></p>
<p>
<table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolor="#000000">
<tr align="center">
<td>
<table border=1 bordercolor="#9f9f9f" cellspacing="0" cellpadding="5">
<tr>
<td><b><font face="geneva,arial" size="2">Товар</font></b></td>
<td><b><font face="geneva,arial" size="2">Цена</font></b></td>
<td><b><font face="geneva,arial" size="2">Всего</font></b></td>
<td><b><font face="geneva,arial" size="2">Удалить</font></b></td></tr>
<?
$subtotal = 0;
$items = explode("&", $basket);
for ($i = 0; $i < count($items)-1; $i++) {
// Get this products name and price from the database...
$sql="SELECT name, price FROM product WHERE productid=$items[$i]";
$result = @mysql_query("$sql",$db);
if (@mysql_num_rows($result) == 0) {
$name = "Error";
$pris = 0;
} else {
$name = @mysql_result($result, 0, "name");
$price = @mysql_result($result, 0, "price");
$subtotal += $price;
}
echo "
<tr><td align=middle>
<FONT SIZE=\"2\" FACE=\"Geneva,Arial\">$name</FONT></td>
<td>
<FONT SIZE=\"2\" FACE=\"Geneva,Arial\">$price</FONT></td>
<td align=right><FONT SIZE=\"2\" FACE=\"Geneva,Arial\">$subtotal</FONT></td>
<td align=right><FONT SIZE=\"2\" FACE=\"Geneva,Arial\"><A
HREF=\"basket.php?remove=",$i+1,"\">Удалить этот товар</A></FONT></td></tr>";
}
echo "
<tr><td align=right BGCOLOR=\"#B3B3B3\" colspan=2>
<b><FONT FACE=\"Geneva,Arial\" SIZE=\"2\">Итого</FONT></b></td>
<td align=right><INPUT TYPE=HIDDEN NAME=\"sum\" VALUE=\"$subtotal\">
<FONT FACE=\"Geneva,Arial\" SIZE=\"2\">$subtotal</FONT></td></tr></TABLE>";
?>
<p>
<form action="basket.php" method="get">
<input type="hidden" name="removeall" value="true">
<input type="submit" name="clear" value="Очистить вашу корзину">
</form>
</p>
</td>
</tr>
</table>
<p></p>
</td>
</tr>
</table>
</body>
</html>