Guest User

Untitled

a guest
May 12th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1.  
  2.  
  3. <?php
  4. include 'functions.php';
  5. foreach ($_GET as $key=>$getvar){ $_GET[$key] = mssql_escape($getvar); }
  6. foreach ($_POST as $key=>$postvar){ $_POST[$key] = mssql_escape($postvar); }
  7. #############################
  8. ##Copyright (c) TheJacob#####
  9. ##All Rights Reserved########
  10. ##thejacobpollack@gmail.com##
  11. #############################
  12.  
  13. #############################
  14. #############################
  15.  
  16. ##Configuration##
  17. $mssql_server = "BON\SQLEXPRESS"; //MSSQL server name or IP
  18. $mssql_username = "sa"; //MSSQL username
  19. $mssql_password = "sa01"; //MSSQL password
  20. $mssql_account_db = "ACCOUNT_DBF"; //MSSQL account database name
  21. $mssql_character_01_db = "CHARACTER_01_DBF"; //MSSQL character database name
  22. $mssql_account_table = "account_tbl"; //MSSQL account table name
  23. $mssql_username_column = "account"; //MSSQL username column in account table
  24. $mssql_password_column = "password"; //MSSQL password column in account table
  25. $hash = "..........."; //Hash code
  26. $random_text_text = "BreathFlyff"; //Random text they must enter to register
  27.  
  28. #############################
  29. #############################
  30.  
  31. ##MSSQL Connect Function##
  32. function mssql_connect_ini($mssql_server,$mssql_username,$mssql_password) {
  33. $mssql_connect = mssql_connect($mssql_server, $mssql_username, $mssql_password) or die ("<strong>Cannot connect to the MSSQL server.</strong>");
  34. if ((strlen($mssql_server) == 0) || (strlen($mssql_username) == 0) || (strlen($mssql_password) == 0)) {
  35. echo "<strong>The connection configuration settings are invalid. Please make sure you've entered them in correctly.</strong>";
  36. }
  37. }
  38.  
  39. ##MSSQL Account Database Select Function##
  40. function mssql_account_ini($mssql_account_db) {
  41. $mssql_select_db = mssql_select_db($mssql_account_db) or die ("<strong>Cannot select the Account database.</strong>");
  42. if (strlen($mssql_account_db) == 0) {
  43. echo "<strong>The account database configuration setting is invalid. Please make sure you've entered it correctly.</strong>";
  44. }
  45. }
  46.  
  47. #############################
  48. #############################
  49.  
  50. ##MSSQL Core Functionality##
  51. mssql_connect_ini($mssql_server,$mssql_username,$mssql_password);
  52. mssql_account_ini($mssql_account_db);
  53.  
  54. #############################
  55. #############################
  56.  
  57. $pusername = @$_POST['username']; //Post wsername
  58. $ppassword = @$_POST['password']; //Post password
  59. $prpassword = @$_POST['rpassword']; //Post re-enter password
  60. $random_text = @$_POST['random_text']; //Random text
  61.  
  62. if (isset($_POST['submit']) == true) {
  63. $username = preg_replace("/[^a-zA-Z0-9\-\_\!\$\#\@\^\&\*\(\)\^\+\ \.\?]/", "", $pusername);
  64. $password = preg_replace("/[^a-zA-Z0-9\-\_\!\$\#\@\^\&\*\(\)\^\+\ \.\?]/", "", $ppassword);
  65.  
  66. if ((isset($_POST['submit']) == true) and (strlen($pusername) < 3) || (strlen($pusername) > 15)) {
  67. echo "Your username must be between 3 and 15 characters in length.";
  68. }
  69.  
  70. else if ((isset($_POST['submit']) == true) and ((strlen($ppassword) < 3) || (strlen($ppassword) > 15) || (strlen($prpassword) < 3) || (strlen($prpassword) > 15))) {
  71. echo "The password must be between 3 and 15 characters in length.";
  72. }
  73.  
  74. else if ((isset($_POST['submit']) == true) and ($ppassword != $prpassword)) {
  75. echo "The passwords must be the same.";
  76. }
  77.  
  78. else if ((isset($_POST['submit']) == true) and (($pusername == $ppassword) || ($pusername == $prpassword))) {
  79. echo "The username and password cannot be the same.";
  80. }
  81.  
  82. else if ((isset($_POST['submit']) == true) and ($random_text != $random_text_text)) {
  83. echo "The random text must be filled in correctly. Please take another look at the random text.";
  84. }
  85.  
  86. else if (mssql_num_rows(mssql_query("SELECT * FROM $mssql_account_table WHERE $mssql_username_column = '$username'")) == '0') {
  87. $stmt = mssql_init('createaccount');
  88. mssql_bind($stmt, '@account', $username, SQLVARCHAR, false, false, 15);
  89. mssql_bind($stmt, '@password', md5($hash . $password), SQLVARCHAR, false, false, 36);
  90. mssql_execute($stmt) or die ("<strong>Error occurred while executing the statement.</strong>");
  91. mssql_free_statement($stmt);
  92. echo "You've been successfully registered as <strong>" . $username . "</strong>!";
  93. } else {
  94. echo "The username already exists.";
  95. }
  96. }
  97.  
  98. ?>
  99.  
  100. <br>
  101. <center>
  102. <form method ="post" action="#">
  103. <table>
  104.  
  105. <tr>
  106. <td><font color="RED" face="Verdana" style="font-size: 10pt;">Username</td>
  107. </tr>
  108. <tr>
  109. <td><input name="username" type="username"></td>
  110. </tr>
  111. <tr>
  112. <td><font color="RED" face="Verdana" style="font-size: 10pt;">Password</td>
  113. </tr>
  114. <tr>
  115. <td><input name="password" type="password"></td>
  116. </tr>
  117. <tr>
  118. <td><font color="RED" face="Verdana" style="font-size: 10pt;">Re-enter Password</td>
  119. </tr>
  120. <tr>
  121. <td><font color="RED" face="Verdana" style="font-size: 10pt;"><input name="rpassword" type="password"></td>
  122. </tr>
  123. <tr>
  124. <td><font color="RED" face="Verdana" style="font-size: 12pt;">Please enter "<?php echo $random_text_text ?>" without the brackets below</td>
  125. </tr>
  126. <tr>
  127. <td><input name="random_text" type="text"></td>
  128. </tr>
  129. <tr>
  130. <td><input name="submit" type="submit" value="Register"></td>
  131. </tr>
  132.  
  133. </table>
  134. </form>
  135. </center>
  136.  
  137. <!-- End Regiser -->
Add Comment
Please, Sign In to add comment