2 $thissid = session_id();
4 $form = '<form method=post action=register.php>
5 Username: <input type=text name=username><br>
6 Password: <input type=password name=password><br>
7 Confirm your password: <input type=password name=password2><br>
8 Email Address: <input type=text name=email><br><br>
9 <input type=submit name=submit value="Register"> <input type=reset>
11 include ("config.php");
12 if (isset($_POST['submit']))
14 if (empty($_POST['username']))
16 echo "You must enter a username.<br>$form";
21 $username = rtrim($_POST['username']);
22 $username = strrev($username);
23 $username = rtrim($username);
24 $username = strrev($username);
27 $sql = "SELECT username FROM users WHERE username='$username'";
28 $result = mysql_query($sql);
29 if (mysql_num_rows($result) != 0)
31 echo "Your username is already in use!<br>$form";
37 echo "You must enter a valid email address.<br>$form";
39 if (empty($_POST['email']))
41 $sql = "SELECT * FROM users WHERE email='$email'";
42 $result = mysql_query($sql);
43 if (mysql_num_rows($result) >= 1)
45 echo "This email has been used to register a username already.<br>$form";
49 if (!$_POST['password'])
51 echo "You must choose a password.<br>$form";
53 elseif (!$_POST['password2'])
55 echo "You must confirm your password.<br>$form";
57 elseif (strcmp($_POST['password'], $_POST['password2']) != 0)
59 echo "Your passwords do not match.<br>$form";
61 elseif (strlen($_POST['username']) >= 21)
63 echo "Your username is too long.<br>$form";
65 elseif (ereg("<", $_POST['username']) ||
ereg(">", $username))
67 echo "Your username has illegal characters.<br>$form";
72 $randnum = rand(1000000, 10000000);
73 $username2 = ereg_replace(" ", "+", $username);
74 $regkey = $username2.$randnum;
75 $datedate = date("n/j/y H:i:s");
76 $sql = "INSERT INTO users (username,userpass,level,regsid,email,regdate,regsec) VALUES ('$username','{$_POST['password']}','0','$regkey','{$_POST['email']}','$datedate','$regat')";
77 $result = mysql_query($sql);
78 $mail_to = $_POST['email'];
79 $mail_subject = "GameFAQs Hell Registration.";
80 $mail_body = "Welcome to GameFAQs Hell!\nTo complete your registration you must go here, http://rhn.skwerl.net/sdraob/regkey.php?regkey=".$regkey."\n\nThis request was made from the IP ".$_SERVER['REMOTE_ADDR']." at ".$datedate;
81 if (mail($mail_to, $mail_subject, $mail_body))
82 echo "It worked! Check your email to continue.";