Advertisement
Guest User

Untitled

a guest
Sep 16th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. <?php
  2. if (!isset($_POST['submit']))
  3. {
  4. echo "<form action=\"register.php\" method=\"POST\">";
  5. echo "<table>";
  6. echo "<tr>";
  7. echo "<td width=\"40%\">שם משתמש :</td><td width=\"60%\"><input name=\"username\" size=\"20\" type=\"text\" />";
  8. echo "</tr>";
  9. echo "<tr>";
  10. echo "<td width=\"40%\">סיסמה :</td><td width=\"60%\"><input name=\"password\" size=\"20\" type=\"password\" />";
  11. echo "</tr>";
  12. echo "<tr>";
  13. echo "<td width=\"40%\">אמת סיסמה :</td><td width=\"60%\"><input name=\"password_check\" size=\"20\" type=\"password\" />";
  14. echo "</tr>";
  15. echo "<tr>";
  16. echo "<td width=\"40%\">דואר אלקטרוני :</td><td width=\"60%\"><input name=\"email\" size=\"20\" type=\"text\" />";
  17. echo "</tr>";
  18. echo "<tr height=\"8\"></tr><tr>";
  19. echo "<td colspan=\"2\" align=\"left\"><input type=\"submit\" name=\"submit\" value=\"שלח\"</td>";
  20. echo "</tr>";
  21. echo "</table>";
  22. echo "</form>";
  23. }
  24. else
  25. {
  26. $username = form($_POST['username']);
  27. if ($_POST['password'] != $_POST['password_check'])
  28. exit("הסיסמאות שהקשת אינם זהות.");
  29. else
  30. $password = md5($_POST['password']);
  31. $email = form($_POST['email']);
  32.  
  33. if (($username == "") || ($password == "") || ($password_check == "")) || ($email == ""))
  34. exit("לא מולאו כל הפרטים.");
  35.  
  36. if ($password != $password_check)
  37. exit("הסיסמאות שהקשת אינם זהות.");
  38.  
  39. $q = $db->prepare("SELECT * FROM `users` WHERE username = ?");
  40. $q->execute(array($username));
  41. $r = $q->rowCount();
  42.  
  43. if ($r > 0)
  44. exit("שם המשתמש כבר קיים במערכת, אנא בחר בשם משתמש אחר.");
  45. else
  46. {
  47. $q = $db->prepare("INSERT INTO `users` (username,password,email) VALUES (?,?,?)");
  48. $q->execute(array($username, $password, $email));
  49. header("Location: register.php"); // Back to login.
  50. }
  51. }
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement