Advertisement
Guest User

Untitled

a guest
Jun 7th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. <?php
  2. if (!isset($_POST["musername"]) OR
  3. !isset($_POST["mpass"]) OR
  4. !isset($_POST["mpwcheck"]) OR
  5. !isset($_POST["recaptcha_response_field"])) {
  6. die ("Error: Not all fields complete");
  7. }
  8.  
  9. $username = mysql_escape_string($_POST["musername"]);
  10. $password = mysql_escape_string($_POST["mpass"]);
  11. $confirm_password = mysql_escape_string($_POST["mpwcheck"]);
  12.  
  13. $continue = false;
  14.  
  15. require_once('inc/recaptchalib.php');
  16.  
  17. $publickey = "6LemqAwAAAAAAF4dIpSjTB3GJt1ax0MRQ9FvOX_T";
  18. $privatekey = "6LemqAwAAAAAAO69RT3j9M1eHPX_ahhmC6Gakuwb";
  19.  
  20. $resp = null;
  21. $error = null;
  22.  
  23. if ($_POST["recaptcha_response_field"]) {
  24. $resp = recaptcha_check_answer ($privatekey,
  25. $_SERVER["REMOTE_ADDR"],
  26. $_POST["recaptcha_challenge_field"],
  27. $_POST["recaptcha_response_field"]);
  28.  
  29. if ($resp->is_valid) {
  30. $continue = true;
  31. }
  32. }
  33.  
  34. if (!$continue) {
  35. die ("<font color=\"red\">You have entered an incorrect CAPTCHA code</font>");
  36. }
  37.  
  38. include('inc/init.php');
  39.  
  40. $select_user_result = $database->query("SELECT `name` FROM `".TABLE_PREFIX."accounts` WHERE `name`='".$username."' LIMIT 1");
  41. if ($database->rows() > 0) {
  42. die ("User already exists!");
  43. } else if ($password != $confirm_password) {
  44. die ("Passwords didn't match!");
  45. } else if (strlen($password) < 4 || strlen($password) > 12) {
  46. die ("Your password must be between 4-12 characters");
  47. } else if (strlen($username) < 4 || strlen($username) > 12) {
  48. die ("Your username must be between 4-12 characters");
  49. } else {
  50. //All data is ok
  51. $insert_user_query = "INSERT INTO ".TABLE_PREFIX."accounts (`name`, `password`, `ip`) VALUES ('".
  52. $username.
  53. "', '".
  54. hash("sha1", $password)."', '/')";
  55. $database->query($insert_user_query);
  56. ?>
  57. <font face="Calibri, Verdana" size="+1"><div style="width: 100%; text-align: center;">
  58. You have successfully registered to KyraMS!
  59. </div></font>
  60. <?php
  61. }
  62. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement