Advertisement
Guest User

Untitled

a guest
Mar 15th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.84 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html >
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Frosty - Register</title>
  6. <link rel="stylesheet" href="css/style.css">
  7. </head>
  8. <body>
  9.  
  10. <div class="overlay">
  11. <ul>
  12. <li><a href="index.php">Home</a></li>
  13. <li><a class="active" href="register.php">Register</a></li>
  14. <li><a href="http://play.frosty.us">Play Frosty</a></li>
  15. <li><a href="http://play.frosty.us/oldcp.php">Play Old CP</a></li>
  16. <li><a href="manager/index.php">Manager</a></li>
  17. <li><a href="commands.php">Commands</a></li>
  18. <li><a href="staff.php">Staff</a></li>
  19. <li><a href="contact.php">Contact Us</a></li>
  20. <li><a href="about.php">About Us</a></li>
  21. </ul>
  22.  
  23. <div class="container">
  24.  
  25. <?php
  26.  
  27. require 'recaptcha/src/autoload.php';
  28. require 'config.php';
  29.  
  30. //Edit only these details and scroll below and edit the captcha keys
  31. $dbHost = '127.0.0.1';
  32. $dbName = 'Luna';
  33. $dbUser = 'root';
  34. $dbPass = 'leavemealone93';
  35.  
  36. function domain_exists($strEmail, $strRecord = 'MX'){
  37. list($strUser, $strDomain) = explode('@', $strEmail);
  38. return checkdnsrr($strDomain, $strRecord);
  39. }
  40.  
  41. function sendError($strErr) {
  42. $strMsg = "<center><h2>Error: " . $strErr . "</h2></center>";
  43. die($strMsg);
  44. }
  45.  
  46. $resDBCon= mysqli_connect($dbHost, $dbUser, $dbPass, $dbName) or sendError('Failed to connect to MySQL: ' . mysqli_connect_error());
  47.  
  48. if (isset($_POST['submit'])) {
  49. $strUsername = $_POST['username'];
  50. $strPassword = $_POST['pass'];
  51. $strPasswordTwo = $_POST['passtwo'];
  52. $intColor = $_POST['color'];
  53. $strEmail = $_POST['email'];
  54. $intPin = $_POST['spin'];
  55.  
  56. if (empty($strEmail) || empty($strUsername) || empty($strPassword) || empty($strPasswordTwo) || empty($intColor) || empty($intPin)) {
  57. sendError('One or more fields has not been completed, please complete them');
  58. }
  59.  
  60. $strUsername = mysqli_real_escape_string($resDBCon, $strUsername);
  61. $strPassword = mysqli_real_escape_string($resDBCon, $strPassword);
  62. $strPasswordTwo = mysqli_real_escape_string($resDBCon, $strPasswordTwo);
  63. $intColor = mysqli_real_escape_string($resDBCon, $intColor);
  64. $strEmail = mysqli_real_escape_string($resDBCon, $strEmail);
  65. $intPin = mysqli_real_escape_string($resDBCon, $intPin);
  66.  
  67. $strUsername = stripslashes($strUsername);
  68. $strPassword = stripslashes($strPassword);
  69. $strPasswordTwo = stripslashes($strPasswordTwo);
  70. $intColor = stripslashes($intColor);
  71. $strEmail = stripslashes($strEmail);
  72. $intPin = stripslashes($intPin);
  73. $strRank = 1;
  74. $strgetBadge = "user";
  75. $strisVIP = 0;
  76. if (!filter_var($strEmail, FILTER_VALIDATE_EMAIL)) {
  77. sendError('Invalid email address! Please recheck your email');
  78. } elseif (!domain_exists($strEmail)) {
  79. sendError('Invalid domain for email address! Please use a valid domain');
  80. } elseif (!ctype_alnum($strUsername) && strlen($strUsername) > 15 && strlen($strUsername) <= 3) {
  81. sendError('Invalid username! Please make sure the username is alphanumeric and not too long or short');
  82. } elseif ($intColor > 15 && $intColor < 0 && !is_numeric($intColor)) {
  83. sendError('Invalid color! Please use a valid color');
  84. } elseif ($strPassword != $strPasswordTwo) {
  85. sendError('Password does not match! Please make sure the passwords match');
  86. } elseif (strlen($strPassword) > 15 && strlen($strPassword) < 5 && strlen($strPasswordTwo) > 15 && strlen($strPasswordTwo) < 5) {
  87. sendError('Password is either too long or too short');
  88. } elseif (!is_numeric($intPin) && $intPin < 6 && $intPin > 6) {
  89. sendError('Invalid pin number, pin must be 6 digits long');
  90. }
  91.  
  92. $arrExistUsers = mysqli_query($resDBCon, "SELECT username FROM users WHERE username = '$strUsername'");
  93. $intUsers = mysqli_num_rows($arrExistUsers);
  94.  
  95. if ($intUsers != 0) {
  96. sendError('Username already exists, please try another name');
  97. }
  98.  
  99. $arrExistEmails = mysqli_query($resDBCon, "SELECT email FROM users WHERE email = '$strEmail'");
  100. $intEmails = mysqli_num_rows($arrExistEmails);
  101.  
  102. if ($intEmails != 0) {
  103. sendError('Email is already in use, please try another email');
  104. }
  105.  
  106. $strIP = mysqli_real_escape_string($resDBCon, $_SERVER['REMOTE_ADDR']);
  107.  
  108. $arrExistIPS = mysqli_query($resDBCon, "SELECT ipAddr FROM users WHERE ipAddr = '$strIP'");
  109. $intIPS = mysqli_num_rows($arrExistIPS);
  110.  
  111. if ($intPS >= 2) {
  112. sendError('You cannot create more than two accounts using this IP');
  113. }
  114.  
  115. $strMD5 = md5($strPassword);
  116.  
  117. $strSecretKey = '6LcuehUTAAAAAFr8ngDlQDbf0X2ZaQIxI6ZoTas4'; //edit this, its your secret/private key
  118. $recaptcha = new \ReCaptcha\ReCaptcha($strSecretKey);
  119. $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $strIP);
  120.  
  121. if (!$resp->isSuccess()) {
  122. sendError('You are a bot, get the fuck out');
  123. } else {
  124. $resQuery = mysqli_query($resDBCon, "INSERT INTO users (`username`, `nickname`, `email`, `password`, `colour`, `ipAddr`, `stamps`, `spin`, `rank`, `getBadge`, `isVIP`) VALUES ('" . $strUsername . "', '" . $strUsername . "', '" . $strEmail . "', '" . $strMD5 . "', '" . $intColor . "', '" . $strIP . "', '31|7|33|8|32|35|34|36|290|358|448', '" . $intPin . "', '" . $strRank . "', '" . $strgetBadge . "', '" . $strisVIP . "')");
  125. $intPID = mysqli_insert_id($resDBCon);
  126. mysqli_query($resDBCon, "INSERT INTO igloos (`ID`, `username`) VALUES ('" . $intPID . "', '" . $strUsername . "')");
  127. mysqli_query($resDBCon, "INSERT INTO postcards (`recepient`, `mailerID`, `mailerName`, `postcardType`) VALUES ('" . $intPID . "', '0', 'Luna', '125')");
  128. echo "<center><h2>You have successfully registered with Frosty, $strUsername ! You may now login to the game :-)</h2></center>";
  129. }
  130.  
  131. } else {
  132.  
  133. ?>
  134.  
  135. <center>
  136. <form class="form" name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  137. <input type="text" name="username" maxlength="10" placeholder="Enter Your Username">
  138. <input type="text" name="email" maxlength="25" placeholder="Enter Your Email">
  139. <input type="password" name="pass" maxlength="15" placeholder="Enter Your Password">
  140. <input type="password" name="passtwo" maxlength="15" placeholder="Enter Your Password Again">
  141. <input type="password" name="spin" maxlength="6" placeholder="Enter Your Secret Pin">
  142. <select name="color">
  143. <option value="">Color</option>
  144. <option value="1">Blue</option>
  145. <option value="2">Green</option>
  146. <option value="3">Pink</option>
  147. <option value="4">Black</option>   
  148. <option value="5">Red</option>
  149. <option value="6">Orange</option>
  150. <option value="7">Yellow</option>
  151. <option value="8">Dark Purple</option>
  152. <option value="9">Brown</option>
  153. <option value="10">Peach</option>
  154. <option value="11">Dark Green</option>
  155. <option value="12">Light Blue</option>
  156. <option value="13">Light Green</option>
  157. <option value="14">Grey</option>
  158. <option value="15">Aqua</option>
  159. </select>
  160. <br><br>
  161. <!--edit the site key to match yours -->
  162. <div class="g-recaptcha" data-sitekey="6LcuehUTAAAAAA0oZRBIvZrbpRCWiiVSh2xqHppx"></div>
  163. <script type="text/javascript" src='https://www.google.com/recaptcha/api.js?hl=en'></script>
  164. <br>
  165. <input type="submit" id="login-button" name="submit" value="Sign Up">
  166. </form>
  167. </center>
  168.  
  169. <?php
  170. }
  171. ?>
  172.  
  173. </div>
  174. <div class="footer">&copy; 2016-2017 Frosty &#8482; All Rights Reserved</div>
  175. </div>
  176. </body>
  177. <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
  178. <script src="js/index.js"></script>
  179. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement