Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. <?php
  2. include "config.php";
  3.  
  4. $Data = '<form action=register.php method=post>
  5. Login:
  6. <input type=text name=login>
  7. Password:
  8. <input type=password name=passwd>
  9. Repeat password:
  10. <input type=password name=repasswd>
  11. Email:
  12. <input type=text name=email>
  13. <input type=submit name=submit value="Registration">
  14. </form>';
  15.  
  16. if (isset($_POST['login']))
  17. {
  18. $Link = MySQL_Connect($DBHost, $DBUser, $DBPassword) or die ("Can't connect to MySQL");
  19. MySQL_Select_Db($DBName, $Link) or die ("Database ".$DBName." do not exists.");
  20.  
  21. $Login = $_POST['login'];
  22. $Pass = $_POST['passwd'];
  23. $Repass = $_POST['repasswd'];
  24. $Email = $_POST['email'];
  25.  
  26. $Login = StrToLower(Trim($Login));
  27. $Pass = StrToLower(Trim($Pass));
  28. $Repass = StrToLower(Trim($Repass));
  29. $Email = Trim($Email);
  30.  
  31. if (empty($Login) || empty($Pass) || empty($Repass) || empty($Email))
  32. {
  33. echo "All fields is empty.";
  34. }
  35.  
  36. elseif (ereg("[^0-9a-zA-Z_-]", $Login, $Txt))
  37. {
  38. echo "Login have a incorrect format.";
  39. }
  40.  
  41. elseif (ereg("[^0-9a-zA-Z_-]", $Pass, $Txt))
  42. {
  43. echo "Password have a incorrect format.";
  44. }
  45.  
  46. elseif (ereg("[^0-9a-zA-Z_-]", $Repass, $Txt))
  47. {
  48. echo "Repeat password have a incorrect format.";
  49. }
  50. elseif (StrPos('\'', $Email))
  51. {
  52. echo "Email have a incorrect format.";
  53. }
  54. else
  55. {
  56. $Result = MySQL_Query("SELECT name FROM users WHERE name='$Login'") or ("Can't execute query.");
  57.  
  58. if (MySQL_Num_Rows($Result))
  59. {
  60. echo "Account <b>".$Login."</b> is exists";
  61. }
  62.  
  63. elseif ((StrLen($Login) < 4) or (StrLen($Login) > 10))
  64.  
  65. {
  66. echo "Login must have more 4 and not more 10 symbols.";
  67. }
  68.  
  69. elseif ((StrLen($Pass) < 4) or (StrLen($Pass) > 10))
  70.  
  71. {
  72. echo "Password must have more 4 and not more 10 symbols.";
  73. }
  74.  
  75. elseif ((StrLen($Repass) < 4) or (StrLen($Repass) > 10))
  76. {
  77. echo "Repeat password must have more 4 and not more 10 symbols.";
  78. }
  79.  
  80. elseif ((StrLen($Email) < 4) or (StrLen($Email) > 25))
  81. {
  82. echo "Email must have more 4 and not more 25 symbols.";
  83. }
  84.  
  85. elseif ($Pass != $Repass)
  86. {
  87. echo "Password mismatch.";
  88. }
  89. else
  90. {
  91. $Salt = base64_encode(md5($Login.$Pass, true));
  92. MySQL_Query("call adduser('$Login', '$Salt', '0', '0', '0', '0', '$Email', '0', '0', '0', '0', '0', '0', '0', '', '', '$Pass')") or die ("Can't execute query.");
  93. $mysqlresult=MySQL_Query("select * from `users` WHERE `name`='$Login'");
  94. $User_ID=MySQL_result($mysqlresult,0,'ID');
  95. MySQL_Query("call usecash('$User_ID',1,0,1,0,50000,1,@error)") or die ("usecash failed!");
  96. echo "Account <b>".$Login."(".$User_ID.")"."</b> has been registered.";
  97. }
  98. }
  99. }
  100.  
  101. echo $Data;
  102.  
  103. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement