hmmm..well i am customizing a shopping cart that i got...it is the index.php . this is the full code. since it is the first page that the user sees, im not exactly sure where the variable is coming from.
<?
require("Cart.php");
DBinfo();
Brand();
Root();
$link = mysql_connect("$DBHost", "$DBUser", "$DBPass")
or die ('Cannot connect to the MySQL server.');
mysql_select_db ("$DBName")
or die ('Cannot connect to the database.');
$old=date("z")-1;
mysql_query("DELETE FROM Users WHERE Date < $old");
$result=mysql_query("SELECT CartItemsID,Date FROM CartItems");
while ($row=mysql_fetch_row($result)) {
$CII=$row[0];
$CDa=$row[1];
$pieces=explode(":",$CDa);
$DCHK=$pieces[1];
if ($DCHK < $old) {
mysql_query("DELETE FROM CartItems WHERE CartItemsID = '$CII'");
}
}
if ($UID != "") {
$result=mysql_query("SELECT * FROM Users WHERE User='$UID'");
$num=mysql_num_rows($result);
if ($num == "0") {
$dt=date("YmdHis");
$UID="$dt".$SERVER['REMOTE_ADDR'];
$date=date("z");
mysql_query("INSERT INTO Users VALUES ('$UID','$date')");
Header("Location: ".$SERVER['PHP_SELF']."?UID=$UID");
}
}
if ($UID == "") {
$dt=date("YmdHis");
$UID="$dt".$SERVER['REMOTE_ADDR'];
$date=date("z");
mysql_query("INSERT INTO Users VALUES ('$UID','$date')");
Header("Location: ".$SERVER['PHP_SELF']."?UID=$UID");
}
commonHeader("$Company","Select a category");
$result=mysql_query("SELECT * FROM Category ORDER BY Category");
fontFace("Arial","Select a category:<br><br>");
echo "<ul>";
while ($row = mysql_fetch_row($result)) {
$Cat=$row[0];
$CatID=$row[1];
fontFace("Arial","<li><a href='$Relative/items.php?CA=$CatID&UID=$UID'>$Cat</a></li>");
}
echo "</ul>";
commonFooter($Relative,$UID);
mysql_close($link);
?>