"; } elseif ($email != "" AND $email2 == "") { $errors++; echo "Please verify your e-mail address!
"; } elseif ($email != $email2) { $errors++; echo "Please ensure both e-mail addresses match
"; } elseif ($emailexists == 1) { $errors++; echo "This e-mail address is already registered
"; } //CHECK EMAIL ADDRESS //CHECK PASSWORD if ($pass == "") { $errors++; echo "Please enter a password!
"; } elseif ($pass != "" AND $pass2 == "") { $errors++; echo "Please verify your password!
"; } elseif ($pass != $pass2) { $errors++; echo "Please ensure both passwords match
"; } //CHECK PASSWORD //CHECK USERNAME include("$opendatabase"); $query4 = "SELECT * FROM tbt_members WHERE `user`='$user'"; $result4 = mysql_query($query4) or die("Couldn't execute query (checking if referer exists): ".mysql_error()); $userexists = mysql_num_rows($result4); $spaces = substr_count($user," "); if ($user == "") { $errors++; echo "Please enter your desired username
"; } if ($spaces != 0) { $errors++; echo "Spaces are not allowed in your username, try the underscore!
"; } if ($userexists == 1) {$errors++; echo "That username is already taken
"; } //CHECK USERNAME //CHECK FORENAME if ($forename == "") { $errors++; echo "Please enter your first name
"; } //CHECK FORENAME //CHECK COUNTRY if ($country == "") { $errors++; echo "Please select your country of residence
"; } //CHECK COUNTRY //CHECK GENDER if ($gender == "") { $errors++; echo "Please select a gender option
"; } //CHECK GENDER //CHECK REFERER if ($referer != "") { include("$opendatabase"); $query3 = "SELECT * FROM tbt_members WHERE `user`='$referer'"; $result3 = mysql_query($query3) or die("Couldn't execute query (checking if referer exists): ".mysql_error()); $refererexists = mysql_num_rows($result3); $referer_id = mysql_result($result3, 0, "id"); if ($refererexists != 1) { $errors++; echo "The referer's username doesn't exist!
"; } } //CHECK REFERER //CHECK AGREE T AND C if ($agree != 1) { $errors++; echo "You must agree to the terms of service
"; } //CHECK AGREE T AND C $_COOKIE["errors"] = $errors; $_CODING["errormsg"] = $errormsg; } // TEH MAIN PAGE STARTS HERE - TEH MAIN PAGE STARTS HERE // TEH MAIN PAGE STARTS HERE - TEH MAIN PAGE STARTS HERE // TEH MAIN PAGE STARTS HERE - TEH MAIN PAGE STARTS HERE // TEH MAIN PAGE STARTS HERE - TEH MAIN PAGE STARTS HERE $_COOKIE["errors"] = 0; $_COOKIE["errormsg"] = ""; $regsubmitted = $_REQUEST["regsubmitted"]; if (isset($regsubmitted) AND $regsubmitted == 1) { checkdata(); if ($_COOKIE["errors"] > 0) { echo "Please fix these " . $_COOKIE["errors"] . " errors.
"; echo $_COOKIE["errormsg"]; printform($opendatabase); } else { $email = $_REQUEST["email"]; $email = clean($email); $email2 = $_REQUEST["email2"]; $email2 = clean($email2); $pass = $_REQUEST["pass"]; $pass = clean($pass); $pass2 = $_REQUEST["pass2"]; $pass2 = clean($pass2); $password = md5($pass2); $user = $_REQUEST["user"]; $user = clean($user); $user = preg_replace('/[^A-Za-z0-9_]/','',$user); $forename = $_REQUEST["forename"]; $forename = clean($forename); $surname = $_REQUEST["surname"]; $surname = clean($surname); $country = $_REQUEST["country"]; $country = clean($country); $gender = $_REQUEST["gender"]; $gender = clean($gender); $agree = $_REQUEST["agree"]; $agree = clean($agree); // Added 16/01/2009 1329 $hash = $email . $password; $hash = md5($hash); // $referer = $_REQUEST["referer"]; $referer = clean($referer); include("$opendatabase"); $query9 = "SELECT id FROM tbt_members WHERE `user`='$referer'"; $result9 = mysql_query($query9) or die("Couldn't execute query (checking if referer exists): ".mysql_error()); $referer_id = mysql_result($result9, 0, "id"); $ip = $_SERVER['REMOTE_ADDR']; $datereg = date("d/m/Y"); $timereg = date("H:i:s"); include("$opendatabase"); $query = "INSERT INTO `tbt_members` (`user` , `email` , `pass` , `hash`, `forename` , `surname` , `gender` , `location` , `ip` , `datereg` , `timereg` , `referer` ) VALUES ('$user', '$email', '$password', '$hash', '$forename', '$surname', '$gender', '$country', '$ip', '$datereg', '$timereg' , '$referer_id')"; $result = mysql_query($query) or die("Couldn't submit info: ".mysql_error()); include("$opendatabase"); $query = "SELECT id FROM tbt_members WHERE `email`='$email' LIMIT 1"; $result = mysql_query($query) or die("Couldn't get userid for log: " . mysql_error()); $userid = mysql_result($result, 0, "id"); include("$opendatabase"); $query = "INSERT INTO `thebutt_tbtv4`.`tbt_log` (`log_id` ,`log_event`,`log_response` ,`log_timestamp` ,`log_username` ,`log_userid`, `log_ip` ,`log_info`) VALUES (NULL , 'Registration', 'success', NULL, '$user', '$userid', '$ip', '$user registered successfully')"; $result = mysql_query($query) or die("Error: Couldn't write to log: " . mysql_error()); ?> ; echo "