Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.48 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. session_start();
  4. $webtitle= "Create a free account";
  5. include("../scripts/mysql_connector.php");
  6.  
  7. $birthdate = $_POST['yearOfBirth'].$_POST['monthOfBirth'].$_POST['dateOfBirth'];
  8. $age = mysql_real_escape_string(stripslashes(intval((date("Ymd",mktime()) - $birthdate)/10000)));
  9. $dob = $_POST["date"]."/".$_POST["day"]."/".$_POST["year"];
  10. $gender = mysql_real_escape_string(stripslashes($_POST["strGender"]));
  11. $username = mysql_real_escape_string(stripslashes($_POST["strUsername"]));
  12. $password = mysql_real_escape_string(stripslashes($_POST["strPassword"]));
  13. $classid = mysql_real_escape_string(stripslashes($_POST["ClassID"]));
  14. $skincol = mysql_real_escape_string(stripslashes(hexdec($_POST["skincol"])));
  15. $haircol = mysql_real_escape_string(stripslashes(hexdec($_POST["haircol"])));
  16. $eyecol = mysql_real_escape_string(stripslashes(hexdec($_POST["eyecol"])));
  17. $pass = md5($password);
  18. $email = $_POST["strEmail"];
  19.  
  20. //Grabs IP
  21. if ($_SERVER['HTTP_X_FORWARD_FOR']) {
  22. $ip = $_SERVER['HTTP_X_FORWARD_FOR'];
  23. } else {
  24. $ip = $_SERVER['REMOTE_ADDR'];
  25. }
  26.  
  27. //This checks if the form has been submitted.
  28. if (isset($_POST['submit'])) {
  29.  
  30. //Checks if Username, etc. Only Contains Specified Characters and is not blank.
  31. //Helps to Prevent SQL Injection...etc.
  32. if (!preg_match('/^[a-z0-9\s_-]+$/i', $username) || ($username == "")) {
  33. die('Error, Username must contain Letters and/or Numbers');
  34. }
  35.  
  36. if (!preg_match('/^[a-z0-9]+$/i', $password) || ($password == "")) {
  37. die('Error, Password must contain Letters and/or Numbers');
  38. }
  39.  
  40. if (!preg_match('/^[0-9]+$/i', $age) || ($age == "")) {
  41. die('Error, Age Must Be A Number');
  42. }
  43.  
  44. if (!preg_match('/^[a-z]+$/i',$gender) || ($gender != "M" && $gender != "F")) {
  45. die('Error, Gender Must Be an "M" or "F"');
  46. }
  47. /*
  48. if (!preg_match('/^([\d]|1[0,1,2])/([0-9]|[0,1,2][0-9]|3[0,1])/\d{4}$/i', $dob)){
  49. die('Error, Date of birth must be in this format 00/00/0000 or 0/0/0000');
  50. }*/
  51. if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email) || ($email == "")) {
  52. die('Error, Email Must Contain Letters and/or Numbers');
  53. }
  54.  
  55. //Converts Date of Birth to a readable mySQL Query String
  56. $dob = mysql_real_escape_string(stripslashes($_POST["date"]."/".$_POST["day"]."/".$_POST["year"]));
  57.  
  58. //This Checks if the 2 passwords given match
  59. if ($_POST['strPassword'] != $_POST['strPassword2']) {
  60. die('Error, Passwords Do not Match. Please Try Again.');
  61. }
  62.  
  63. //This checks if the username is in use
  64. $check = mysql_query("SELECT username FROM wqw_users WHERE username = '$username'") or die(mysql_error());
  65. if (mysql_num_rows($check) != 0) {
  66. die('Sorry, the username '.$_POST['strUsername'].' is already in use.');
  67. }
  68.  
  69. //Checks if Email has Already been used
  70. $emailcheck = mysql_query("SELECT * FROM wqw_users WHERE email='$email' AND banned=0") or die("status=Error&strReason=" . mysql_error());
  71. if (mysql_num_rows($emailcheck) != 0) {
  72. die("Sorry, This Email has already been used.");
  73. }
  74.  
  75. //Filtered words
  76. if (ereg("\Admin", $chartype)) {
  77. Die('The username you entered is not allowed, Please enter another one....');
  78. }
  79. elseif (ereg("\admin", $chartype)) {
  80. Die('The username you entered is not allowed, Please enter another one....');
  81. }
  82. elseif (ereg("\administrator", $chartype)) {
  83. Die('The username you entered is not allowed, Please enter another one....');
  84. }
  85. elseif (ereg("\Administrator", $chartype)) {
  86. Die('The username you entered is not allowed, Please enter another one....');
  87. }
  88. elseif (ereg("\mod", $chartype)) {
  89. Die('The username you entered is not allowed, Please enter another one....');
  90. }
  91. elseif (ereg("\Mod", $chartype)) {
  92. Die('The username you entered is not allowed, Please enter another one....');
  93. }
  94. elseif (ereg("\moderatore", $chartype)) {
  95. Die('The username you entered is not allowed, Please enter another one....');
  96. }
  97. elseif (ereg("\Moderatore", $chartype)) {
  98. Die('The username you entered is not allowed, Please enter another one....');
  99. }
  100. elseif (ereg("\Game Master", $chartype)) {
  101. Die('The username you entered is not allowed, Please enter another one....');
  102. }
  103. elseif (ereg("\game master", $chartype)) {
  104. Die('The username you entered is not allowed, Please enter another one....');
  105. }
  106. elseif (ereg("\gamemaster", $chartype)) {
  107. Die('The username you entered is not allowed, Please enter another one....');
  108. }
  109. elseif (ereg("\Gamemaster", $chartype)) {
  110. Die('The username you entered is not allowed, Please enter another one....');
  111. }
  112. elseif (ereg("\GameMaster", $chartype)) {
  113. Die('The username you entered is not allowed, Please enter another one....');
  114. }
  115. elseif (ereg("\Safiria", $chartype)) {
  116. Die('The username you entered is not allowed, Please enter another one....');
  117. }
  118. elseif (ereg("\safiria", $chartype)) {
  119. Die('The username you entered is not allowed, Please enter another one....');
  120. }
  121.  
  122. //This Inserts the Data into the database
  123. if($gender == "F"){
  124. $createuser = mysql_query("INSERT INTO wqw_users (username, password, email, age, dob, signupip, gender, coins, currentclass, hairName, hairFile, hairID, plaColorSkin, plaColorHair, plaColorEyes)
  125. VALUES ('$username', '$pass', '$email', '$age', '$dob', '$ip','$gender',50000,'1','Saf1','hair/F/saf1.swf','234','$skincol','$haircol','$eyecol')");
  126. }
  127. else{
  128. $createuser = mysql_query("INSERT INTO wqw_users (username, password, email, age, dob, signupip, gender, coins, currentclass, plaColorSkin, plaColorHair, plaColorEyes)
  129. VALUES ('$username', '$pass', '$email', '$age', '$dob', '$ip','$gender',50000,'1','$skincol','$haircol','$eyecol')");
  130. }
  131. $usersql = mysql_query("SELECT id FROM wqw_users WHERE username='$username'") or die ("Query failed with error: ".mysql_error());
  132. $userquery = mysql_fetch_array($usersql);
  133. $userid = $userquery["id"];
  134. $addweapon = mysql_query("INSERT INTO wqw_items (itemid, userid, equipped, sES, iLvl) VALUES ('1', '$userid', '1', 'Weapon', '1')");
  135. //Add's Starting Armor
  136. switch ($classid) {
  137. case 1: //Warrior
  138. $addarmour = mysql_query("INSERT INTO wqw_items (itemid, userid, equipped, sES, iLvl, classXP, className) VALUES ('16', '$userid', '1', 'ar', '1', '0', 'The Hybrid Class')") or die("Error adding class! contact MTW Staff immediately!" . mysql_error());
  139. $updateclass = mysql_query("UPDATE wqw_users SET currentClass=1 WHERE id=$userid");
  140. break;
  141. case 4: //Ninja
  142. $addarmour = mysql_query("INSERT INTO wqw_items (itemid, userid, equipped, sES, iLvl, classXP, className) VALUES ('293', '$userid', '1', 'ar', '1', '0', 'Ninja Class')") or die("Error adding class! contact MTW Staff immediately!" . mysql_error());
  143. $updateclass = mysql_query("UPDATE wqw_users SET currentClass=4 WHERE id=$userid");
  144. break;
  145. case 3: //Mage
  146. $addarmour = mysql_query("INSERT INTO wqw_items (itemid, userid, equipped, sES, iLvl, classXP, className) VALUES ('143', '$userid', '1', 'ar', '1', '0', 'Mage Class')") or die("Error adding class! contact MTW Staff immediately!" . mysql_error());
  147. $updateclass = mysql_query("UPDATE wqw_users SET currentClass=3 WHERE id=$userid");
  148. break;
  149. case 10: //Berserker
  150. $addarmour = mysql_query("INSERT INTO wqw_items (itemid, userid, equipped, sES, iLvl, classXP, className) VALUES ('864', '$userid', '1', 'ar', '1', '0', 'Berserker')") or die("Error adding class! contact MTW Staff immediately!" . mysql_error());
  151. $updateclass = mysql_query("UPDATE wqw_users SET currentClass=10 WHERE id=$userid");
  152. break;
  153. }
  154. $addfriends = mysql_query("INSERT INTO wqw_friends (userid) VALUES ('$userid')");
  155. $achievements = mysql_query("INSERT INTO wqw_achievements (username, achievement_image) VALUES ('$username','badge-bt.png')");
  156. include "top.php";
  157. echo "Your character has been created and is automatically activated with chat enabled, but your account is not an upgrade so you can't buy upgrade items unless you gain membership in the server";
  158. include "bottom.php";
  159. }
  160. else
  161. {
  162. include "top.php";
  163. ?>
  164. <form action="signup" method="post" style="width: 550px;">
  165.  
  166. <h3>Create a free account</h3>
  167. <p> Note: This server contains full support to girls so don't always pick male ^_^</p>
  168. <tr><td>Username:</td><td>
  169. <input id="username" type="text" name="strUsername" size="50%">
  170. </td></tr>
  171. <tr><td>Password:</td><td>
  172. <input type="password" name="strPassword" size="50%">
  173. </td></tr>
  174. <tr><td>Confirm Password:</td><td>
  175. <input type="password" name="strPassword2" size="50%">
  176. </td></tr>
  177. <tr><td>Starting Class:</td><td>
  178. <select name="ClassID">
  179. <option value="1">Warrior</option>
  180. <option value="3">Mage</option>
  181. <option value="4">Ninja</option>
  182. <option value="10">Berserker</option>
  183. </select>
  184. </td></tr>
  185. <tr><td>Date of Birth:</td><td>
  186. <select name="date">
  187. <option value="1">January</option>
  188. <option value="2">February</option>
  189. <option value="3">March</option>
  190. <option value="4">April</option>
  191. <option value="5">May</option>
  192. <option value="6">June</option>
  193. <option value="7">July</option>
  194. <option value="8">August</option>
  195. <option value="9">September</option>
  196. <option value="10">October</option>
  197. <option value="11">November</option>
  198. <option value="12">December</option>
  199. </select>
  200. <select name="day">
  201. <option value="01">01</option>
  202. <option value="02">02</option>
  203. <option value="03">03</option>
  204. <option value="04">04</option>
  205. <option value="05">05</option>
  206. <option value="06">06</option>
  207. <option value="07">07</option>
  208. <option value="08">08</option>
  209. <option value="09">09</option>
  210. <option value="10">10</option>
  211. <option value="11">11</option>
  212. <option value="12">12</option>
  213. <option value="13">13</option>
  214. <option value="14">14</option>
  215. <option value="15">15</option>
  216. <option value="16">16</option>
  217. <option value="17">17</option>
  218. <option value="18">18</option>
  219. <option value="19">19</option>
  220. <option value="20">20</option>
  221. <option value="21">21</option>
  222. <option value="22">22</option>
  223. <option value="23">23</option>
  224. <option value="24">24</option>
  225. <option value="25">25</option>
  226. <option value="26">26</option>
  227. <option value="27">27</option>
  228. <option value="28">28</option>
  229. <option value="29">29</option>
  230. <option value="30">30</option>
  231. <option value="31">31</option>
  232. </select>
  233. <select name="year">
  234. <option value="2001">2001</option>
  235. <option value="2000">2000</option>
  236. <option value="1999">1999</option>
  237. <option value="1998">1998</option>
  238. <option value="1997">1997</option>
  239. <option value="1996">1996</option>
  240. <option value="1995">1995</option>
  241. <option value="1994">1994</option>
  242. <option value="1993">1993</option>
  243. <option value="1992">1992</option>
  244. <option value="1991">1991</option>
  245. <option value="1990">1990</option>
  246. <option value="1989">1989</option>
  247. <option value="1988">1988</option>
  248. <option value="1987">1987</option>
  249. <option value="1986">1986</option>
  250. <option value="1985">1985</option>
  251. <option value="1984">1984</option>
  252. <option value="1983">1983</option>
  253. <option value="1982">1982</option>
  254. <option value="1981">1981</option>
  255. <option value="1980">1980</option>
  256. </select>
  257. </td></tr>
  258. <tr><td>Gender:</td><td>
  259. <select name="strGender" id="gender">
  260. <option value="M">Male</option>
  261. <option value="F">Female</option>
  262. </select>
  263. </td></tr>
  264. <tr><td>Skin Color:</td><td>
  265. <input name="skincol" id="skincol" class="color" size="50%">
  266. </td></tr>
  267. <tr><td>Hair Color:</td><td>
  268. <input name="haircol" id="haircol" class="color" size="50%">
  269. </td></tr>
  270. <tr><td>Eye Color:</td><td>
  271. <input name="eyecol" id="eyecol" class="color" size="50%">
  272. </td></tr>
  273. <tr><td>Email:</td><td>
  274. <input type="text" name="strEmail" value="example@gmail.com" size="50%">
  275. </form>
  276. <?php
  277. include "bottom.php";
  278. }
  279. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement