include("$AP/htdocs/stores/cart/common.inc");
include("funcs.php3");
include("$CART/session.inc");
if (empty($form))
{
$form = $HTTP_REFERER;
}
$clid = test_id();
if (empty($clid))
$clid="namrick";
standard($clid,"Register");
$dbname = $clid;
if (!empty($action))
{
if (!test_email($email))
{
echo "
Badly formed email - Please resubmit
";
}
else
{
if (eregi("register",$action))
{
$query = "select id from register where email like '$email'";
$res = db_query($query);
$num = db_numrows($res);
$id = 0;
if ($num > 0)
$id = db_result($res,0,"id");
$comments = addslashes($comments);
$fcats = build_content($categories);
$query = "replace into register ";
$query .= "(id,clid,email,name,adda,addb,addc";
$query .= ",zipc,ctry,tel,fax";
$query .= ",categories,comments)";
$query .= " values";
$query .= "('$id','$clid','$email','$name','$adda','$addb','$add3'";
$query .= ",'$postal','$ctry','$tel','$fax'";
$query .= ",'$fcats','$comments')";
$res = db_query("$query");
echo "You have been registered";
echo "You should receive an email to confirm the registration
";
$mesg = "\nThank you for registering\n\n";
$mesg .= "To unregister go to http://$domain\n";
mail($email,"Store Registration","Registration for Information Noted");
if (!empty($form))
echo "Return to Previous Page";
foot($clid);
}
else
{
$query = "select * from register where email = '$email'";
$res = db_query("$query");
$num = @db_numrows($res);
if ($num <= 0)
{
echo "We have nothing with your email address
";
echo "Please Re-Register
";
}
else
{
if (eregi("remove",$action))
{
$res = db_query("delete from register where id like '$email'");
echo "You have been removed from our list
";
foot($clid);
}
else
{
$arr = mysql_fetch_object($res);
$ct = 0;
while (list($key,$val) = each($arr))
{
if (++$ct%2 == 1) continue;
$$key = $val;
}
}
}
}
}
}
if (empty($foot_set))
{
include "$CART/regform.inc";
foot($clid);
}
?>