0.6.0
[gfh.git] / register.php
blob695c6cb516f1a218a092af720b8120c500272148
1 <?
2 session_start();
3 $thissid=session_id();
4 ?>
5 <center><img src=title.jpg></center><?
6 include("con.php");
7 if ($submit)
9 if (!$username)
11 echo "You must enter a username.<br>";
13 <form method=post action=register.php>
14 Username: <input type=text name=username><br>
15 Password: <input type=password name=password><br>
16 Confirm your password: <input type=password name=password2><br><br>
17 Email Address: <input type=text name=email><br><br>
18 <input type=submit name=submit value="Register"> <input type=reset>
19 </form>
21 } else {
22 if ($username)
24 $sql="SELECT username FROM users WHERE username='$username'";
25 $result=mysql_query($sql);
26 if (mysql_num_rows($result)!=0)
28 echo "Your username is already in use!<br>";
30 <form method=post action=register.php>
31 Username: <input type=text name=username><br>
32 Password: <input type=password name=password><br>
33 Confirm your password: <input type=password name=password2><br><br>
34 Email Address: <input type=text name=email><br><br>
35 <input type=submit name=submit value="Register"> <input type=reset>
36 </form>
38 exit;
40 if (!$email)
42 echo "You must enter a valid email address.";
44 <form method=post action=register.php>
45 Username: <input type=text name=username><br>
46 Password: <input type=password name=password><br>
47 Confirm your password: <input type=password name=password2><br><br>
48 Email Address: <input type=text name=email><br><br>
49 <input type=submit name=submit value="Register"> <input type=reset>
50 </form>
53 if ($email)
55 $sql="SELECT * FROM users WHERE email='$email'";
56 $result=mysql_query($sql);
57 if (mysql_num_rows($result)>=1)
59 echo "This email has been used to register a username already.";
61 <form method=post action=register.php>
62 Username: <input type=text name=username><br>
63 Password: <input type=password name=password><br>
64 Confirm your password: <input type=password name=password2><br><br>
65 Email Address: <input type=text name=email><br><br>
66 <input type=submit name=submit value="Register"> <input type=reset>
67 </form>
69 exit;
72 if (!$password)
74 echo "You must choose a password.<br>";
76 <form method=post action=register.php>
77 Username: <input type=text name=username><br>
78 Password: <input type=password name=password><br>
79 Confirm your password: <input type=password name=password2><br><br>
80 Email Address: <input type=text name=email><br><br>
81 <input type=submit name=submit value="Register"> <input type=reset>
82 </form>
84 } else {
85 if (!$password2)
87 echo "You must confirm your password.<br>";
89 <form method=post action=register.php>
90 Username: <input type=text name=username><br>
91 Password: <input type=password name=password><br>
92 Confirm your password: <input type=password name=password2><br><br>
93 Email Address: <input type=text name=email><br><br>
94 <input type=submit name=submit value="Register"> <input type=reset>
95 </form>
97 } else {
98 if ($password != $password2)
100 echo "Your passwords do not match.<br>";
102 <form method=post action=register.php>
103 Username: <input type=text name=username><br>
104 Password: <input type=password name=password><br>
105 Confirm your password: <input type=password name=password2><br><br>
106 Email Address: <input type=text name=email><br><br>
107 <input type=submit name=submit value="Register"> <input type=reset>
108 </form>
110 } else {
111 if (strlen($username)>=21)
113 echo "Your username is too long.";
115 <form method=post action=register.php>
116 Username: <input type=text name=username><br>
117 Password: <input type=password name=password><br>
118 Confirm your password: <input type=password name=password2><br><br>
119 Email Address: <input type=text name=email><br><br>
120 <input type=submit name=submit value="Register"> <input type=reset>
121 </form>
123 } else {
124 $username=htmlspecialchars($username);
125 $regat=time();
126 $randnum=rand(1000000,10000000);
127 $username2=ereg_replace(" ","+",$username);
128 $regkey=$username2.$randnum;
129 $datedate=date("n/j/y H:i:s");
130 $sql="INSERT INTO users (username,userpass,level,regsid,email,regdate,regsec) VALUES ('$username','$password','0','$regkey','$email','$datedate','$regat')";
131 $result=mysql_query($sql);
132 $mail_to=$email;
133 $mail_subject="GameFAQs Hell Registration.";
134 $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 ".$REMOTE_ADDR." at ".$datedate;
135 if(mail($mail_to,$mail_subject,$mail_body))
136 echo "It worked! Check your email to continue.";
137 else echo "It failed.";
138 }}}}}} else {
140 <form method=post action=register.php>
141 Username: <input type=text name=username><br>
142 Password: <input type=password name=password><br>
143 Confirm your password: <input type=password name=password2><br>
144 Email Address: <input type=text name=email><br><br>
145 <input type=submit name=submit value="Register"> <input type=reset>
146 </form>