This is the entire code incase my problem lies in where I put the other codes in or something:
<?
session_start();
if(isset($HTTP_COOKIE_VARS["users_resolution"]))
$screen_res = $HTTP_COOKIE_VARS["users_resolution"];
else //means cookie is not found set it using Javascript
{
?>
<script language="javascript">
<!--
writeCookie();
function writeCookie()
{
var today = new Date();
var the_date = new Date("December 31, 2023");
var the_cookie_date = the_date.toGMTString();
var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie
}
//-->
</script>
<?
}
$ipforcookie = $_SERVER['REMOTE_ADDR'];
if(isset($_COOKIE['ipcookie']))
// If the cookie 'Joe2Torials is set, do the following;
$cookieip = $_COOKIE['ipcookie'];
else{
setcookie("ipcookie",$ipforcookie, time()-10);
$cookieip = $_COOKIE['ipcookie'];
}
?>
<?php
define('IN_RAFS', true);
include "./sessions.php";
include 'includes/header.php';
$page = "Register";
$adsense = "no";
if ( $_SESSION['username'] != NULL ) {
header("Location: index.php");
}
else {
// $username = ereg_replace("[^A-Za-z0-9]", "", strtolower(strip_tags($_POST['username'])));
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];
$enpassword = $_POST['password'];
$email = $_POST['email'];
$cemail = $_POST['cemail'];
$username = $email;
$robotkey = $_POST['rokey'];
$fullname = $_POST['fullname'];
$street = $_POST['street'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$cookieip = $_COOKIE['ipcookie'];
$referral = $_POST['referral'];
$item = $_POST['item'];
$ip = $_SERVER['REMOTE_ADDR'];
$time = time();
$key = md5($time);
$date = date("dgdijmzy");
$sid = session_id();
$signuptime = date("F j, Y, g:i a");
if ( $sid != NULL ) {
$get = "SELECT `key` FROM `robot` WHERE `sid` = '$sid'";
$rkey = @mysql_result(mysql_query($get), 0);
}
else {
}
if (isset($_GET['email'])) {
if (isset($_GET['referral'])) {
$referral = $_GET['referral'];
$referral_email = "SELECT `email` FROM `users` WHERE `id` = '$referral'";
$referral_email2 = @mysql_result(mysql_query($referral_email), 0);
$referral_text = "<BR>You are being referred by <B>" . $referral_email2 . "</B>";
}
else {
$referral = 0;
}
$tvars = array(
'EMAIL' => $_GET['email'],
'ITEM' => $_GET['item'],
'REFERRAL' => $referral,
'REFERRAL_EMAIL' => $referral_text,
'SID' => $sid
);
pparse('register_form');
exit;
}
if ($username != NULL && $password != NULL && $email != NULL && $robotkey != NULL && $email == $cemail && $password == $cpassword && $fullname != NULL && $street != NULL && $city != NULL && $state != NULL && $zip != NULL) {
$sqlsid = session_id();
$exists = mysql_query("SELECT * from users WHERE username='$username' or email='$email'");
$user_exists = mysql_fetch_array($exists);
$ipcheck = mysql_query("SELECT * from users WHERE ip='$ip'");
$ip_exists = mysql_fetch_array($ipcheck);
echo $_SESSION["autamationcode"];
// if ( $user_exists == "0" && $ip_exists == "0" && $robotkey == $rkey ) {
if ( $user_exists == "0" && $robotkey == $rkey ) {
$sql = "INSERT INTO users (id, username, password, email, ip, account, active, name, street, city, state, zip, referral, status, item, resolution, signuptime, cookieip)"."VALUES ('NULL', '$username', '$enpassword', '$email', '$ip', '0', '$key', '$fullname', '$street', '$city', '$state', '$zip', '$referral', '1', '$item', '$screen_res', '$signuptime', '$cookieip')";
mysql_query($sql);
$clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
mysql_query($clearsid);
$uid = mysql_query("SELECT id from users WHERE username='$username'");
$u = mysql_result($uid, 0);
$message = "Thank your for registering! You're just one step away from being registered. Please check the e-mail you provided during registration. You were sent an activation link, just visit it and your account will be active and ready to go!";
$tvars = array(
'message' => $message);
pparse('message_body');
mail($email, "Welcome to " . $domain, "Thank you for registering at " . $domain . "!\n\nBefore you can get started, you need to activate your account, use the link below to do so\n\nhttp://" . $domain . "/activate.php?id=" . $u . "&k=" . $key . "\n\nOnce activated, you can login to your account with the following details:\n\nUsername: " . $username . "\nPassword: " . $password . "\n\nIf you have any problems please contact us.\n\nThanks,\n" . $domain, "From: " . $domain . " <support@" . $domain . ">");
}
elseif ( $robotkey != $rkey ) {
$back_link = "register.php?item=" . $_POST['item'] . "&email=" . $_POST['email'] . "&referral=" . $_POST['referral'];
$message = "Please make sure you typed the signup key properly.<br /><br />Click <a href=\"" . $back_link . "\">here</a> to go back.";
$clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
mysql_query($clearsid);
$tvars = array(
'message' => $message);
pparse('message_body');
}
elseif ( $user_exists != "0" ) {
$back_link = "register.php?item=" . $_POST['item'] . "&email=" . $_POST['email'] . "&referral=" . $_POST['referral'];
$message = "Sorry but either your username or e-mail are already in use.<br /><br />Click <a href=\"" . $back_link . "\">here</a> to go back.";
$clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
mysql_query($clearsid);
$tvars = array(
'message' => $message);
pparse('message_body');
}
}
elseif ( $_POST == NULL ) {
$tvars = array(
'email' => $_GET['email'],
'cemail' => $_GET['email'],
'ITEM' => $_GET['item'],
'REFERRAL' => $referral,
'REFERRAL_EMAIL' => $referral_text,
'SID' => $sid
);
pparse('register_form');
}
elseif ( $username != NULL && $password != NULL && $email != NULL && $cpassword != NULL && $cemail != NULL && $password != $cpassword ) {
$back_link = "register.php?item=" . $_POST['item'] . "&email=" . $_POST['email'] . "&referral=" . $_POST['referral'];
$message = "Your passwords do not match.<br /><br />Click <a href=\"" . $back_link . "\">here</a> to go back.";
$clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
mysql_query($clearsid);
$tvars = array(
'message' => $message);
pparse('message_body');
}
elseif ( $username != NULL && $password != NULL && $email != NULL && $cpassword != NULL && $cemail != NULL && $email != $cemail ) {
$back_link = "register.php?item=" . $_POST['item'] . "&email=" . $_POST['email'] . "&referral=" . $_POST['referral'];
$message = "Your email does not match.<br /><br />Click <a href=\"" . $back_link . "\">here</a> to go back.";
$clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
mysql_query($clearsid);
$tvars = array(
'message' => $message);
pparse('message_body');
}
elseif ( $_POST != NULL && $username == NULL or $password == NULL or $email == NULL or $cpassword == NULL or $cemail == NULL or $fullname == NULL or $street == NULL or $city == NULL or $state == NULL or $zip == NULL ) {
$back_link = "register.php?item=" . $_POST['item'] . "&email=" . $_POST['email'] . "&referral=" . $_POST['referral'];
$message = "Please fill in all required fields before submitting.<br /><br />Click <a href=\"" . $back_link . "\">here</a> to go back.";
$clearsid = "DELETE FROM `robot` WHERE `sid` = '$sid'";
mysql_query($clearsid);
$tvars = array(
'message' => $message);
pparse('message_body');
}
//mysql_close($connect);
}
include 'includes/footer.php';
?>
THANKS