Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. <?php
  2. require_once('recaptchalib.php');
  3. $privatekey = "6LeZl74SAAAAAMtfiIIfBtNH2bt0SoN-OzkcBkzq";
  4. $resp = recaptcha_check_answer ($privatekey,
  5. $_SERVER["REMOTE_ADDR"],
  6. $_POST["recaptcha_challenge_field"],
  7. $_POST["recaptcha_response_field"]);
  8.  
  9. if (!$resp->is_valid) {
  10. // What happens when the CAPTCHA was entered incorrectly
  11. die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
  12. "(reCAPTCHA said: " . $resp->error . ")");
  13. } else {
  14. // Your code here to handle a successful verification
  15.  
  16. include "functions.php";
  17.  
  18. if(isset($_POST['submit']))
  19. {
  20. $server = "SERVER1\SQLEXPRESS";
  21. $user = "";
  22. $pass= "";
  23.  
  24.  
  25.  
  26. $username = strtolower(trim(htmlspecialchars(addslashes(preg_replace("/[^a-zA-Z0-9]/" , "" , $_POST['username'])))));
  27.  
  28. $password = md5("kikugalanet", preg_replace("/[^a-zA-Z0-9]/" , "" , $_POST['password']);
  29.  
  30. ################################################## ###########
  31.  
  32. if(strlen($username) < 4 ||
  33. strlen($username) > 16)
  34. {
  35. die("Dein Benutzername ist zu kurz/lang .<br>Er muss zwischen <b><u>4 und 16</u></b> Zeichen lang sein .");
  36. echo '<a href="index.html">Home</a>';
  37. }
  38.  
  39. if(strlen($_POST['password']) < 4 ||
  40. strlen($_POST['password']) > 16)
  41. {
  42. die("Dein Passwort ist zu kurz/lang .<br>Es muss zwischen <b><u>4 und 16</u></b> Zeichen lang sein .");
  43. echo '<a href="index.html">Home</a>';
  44. }
  45.  
  46. ################################################## ###########
  47.  
  48. $conn = mssql_connect($server,$user,$pass);
  49.  
  50. if(!$conn)
  51. {
  52. die("Connection failed!<br>");
  53. }
  54.  
  55. $select = mssql_select_db("ACCOUNT_DBF",$conn);
  56.  
  57. if(!$select)
  58. {
  59. die("Can't select Database!<br>");
  60. }
  61.  
  62. ################################################## ###########
  63.  
  64. if(exist($username) != '0')
  65. {
  66. die ("Der Benutzername ".$username." wird schon benutzt .");
  67. echo '<a href="index.html">Home</a>';
  68. }
  69.  
  70.  
  71. ################################################## ###########
  72.  
  73. $bind = mssql_init("createaccount",$conn);
  74.  
  75. if(!$bind)
  76. {
  77. die("Couldn't Bind Variables.<br>");
  78. }
  79.  
  80. $acc = $username;
  81. $pass = $password;
  82. $ipadress = $ip;
  83.  
  84. mssql_bind($bind, '@account' , $acc , SQLVARCHAR);
  85. mssql_bind($bind, '@password', $pass, SQLVARCHAR);
  86.  
  87. $execute = mssql_execute($bind);
  88.  
  89. if($execute)
  90. {
  91. echo 'Account wurde <font color="green">erfolgreich</font> erstellt !';
  92. echo '<a href="index.html">Home</a>';
  93. }
  94. else
  95. {
  96. echo 'Account erstellung<font color="red">fehlgeschlagen</font> !';
  97. echo '<a href="index.html">Home</a>';
  98. }
  99.  
  100. mssql_close($conn);
  101. }
  102. else
  103. {
  104. }
  105. }
  106. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement