Advertisement
Guest User

Untitled

a guest
Sep 29th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. <?php
  2. if ($_SESSION["valid_user"])
  3. { echo "<font class=\"textshadow\"><b>You already have an account! Please log out first in order to create a new account. But why would you <img src=\"images/huh.gif\" width=\"15px\" height=\"15px\" border=\"0\" /> ?</b></font>"; } else {
  4.  
  5. $realmd = array(
  6. 'db_host'=> $host,
  7. 'db_username' => $user,
  8. 'db_password' => $pass,
  9. 'db_name'=> $mangosrealm,
  10. );
  11.  
  12. function check_for_symbols($string){
  13. $len=strlen($string);
  14. $allowed_chars="abcdefghijklmnopqrstuvwxyzæøåABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ0123456789";
  15. for($i=0;$i<$len;$i++)if(!strstr($allowed_chars,$string[$i]))return TRUE;
  16. return FALSE;
  17.  
  18. }
  19.  
  20. function sha_password($username,$password){
  21. $username = strtoupper($username);
  22. $password = strtoupper($password);
  23.  
  24. return SHA1($username.':'.$password);
  25. }
  26.  
  27. if ($_POST['registration']){
  28.  
  29. $realmd_bc_new_connect = mysql_connect($realmd[db_host],$realmd[db_username],$realmd[db_password]);
  30. $selectdb = mysql_select_db($realmd[db_name],$realmd_bc_new_connect);
  31. if (!$realmd_bc_new_connect || !$selectdb){
  32. echo "Something went wrong while connecting to the database. Please make sure the config.php file is correct.";
  33. die;
  34. }
  35.  
  36. $username1 = $_POST['username'];
  37. $password1 = sha_password($username1,$_POST['password']);
  38. $email1 = $_POST['email'];
  39. $client = $_POST['expansion'];
  40.  
  41. $qry_check_username = mysql_query("SELECT username FROM account WHERE username='$username'");
  42.  
  43. if (check_for_symbols($_POST[password]) == TRUE || check_for_symbols($username1) == TRUE || mysql_num_rows($qry_check_username) != 0){
  44. echo "Something went wrong with creating an account for you. Either the Username is already taken or you are using unacceptable symbols. Please try again.";
  45. }else{
  46. mysql_query("INSERT INTO account (username,sha_pass_hash,email,expansion) VALUES
  47. ('$username1','$password1','$email1','$client')");
  48. echo "<br><br><img src=\"images/green_check.gif\" /> Your account <b>".$username1."</b> has been successfully added to the database! Make sure you change your realmlist.wtf file to: <br /><br /> &nbsp; &nbsp; <b>".$realmlist."</b><br/><br/><br><br/><br/>Please contact one of the staff members if you're having difficulties loggin in after 5-10 minutes.";
  49. }
  50.  
  51.  
  52. }else{
  53. ?>
  54.  
  55. <table>
  56. <form autocomplete="off" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
  57. <tr><td width="150px">Accountname:</td><td><input type="text" name="username"></td></tr>
  58. <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
  59. <tr><td>Passwort:</td><td><input type="password" name="password"></td></tr>
  60. <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
  61. <tr><td>E-mail Addresse:</td><td><input type="text" name="email" /></td></tr>
  62. <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
  63. <tr><td valign="top">Spiel Version:</td>
  64. <td>
  65. <select name="expansion">
  66. <option value="2">Wotlk Client</option>
  67. <option value="1">TBC Client</option>
  68. <option value="0">Classic WoW</option>
  69. </select></td></tr>
  70. <br>
  71. <tr><td>&nbsp;</td><td><input type="submit" name="registration"></td></tr>
  72. </form>
  73. </table>
  74.  
  75. <?php
  76. }
  77. }
  78. ?>
  79.  
  80. </div>
  81.  
  82. </div>
  83.  
  84. </p>
  85.  
  86.  
  87.  
  88.  
  89. </td></tr></table>
  90. </center>
  91.  
  92.  
  93.  
  94. </div>
  95.  
  96. </div>
  97. <div class="clearfix"></div>
  98. </div><!-- / container -->
  99.  
  100. </body>
  101. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement