Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!isset($_POST['submit']))
- {
- echo "<form action=\"register.php\" method=\"POST\">";
- echo "<table>";
- echo "<tr>";
- echo "<td width=\"40%\">שם משתמש :</td><td width=\"60%\"><input name=\"username\" size=\"20\" type=\"text\" />";
- echo "</tr>";
- echo "<tr>";
- echo "<td width=\"40%\">סיסמה :</td><td width=\"60%\"><input name=\"password\" size=\"20\" type=\"password\" />";
- echo "</tr>";
- echo "<tr>";
- echo "<td width=\"40%\">אמת סיסמה :</td><td width=\"60%\"><input name=\"password_check\" size=\"20\" type=\"password\" />";
- echo "</tr>";
- echo "<tr>";
- echo "<td width=\"40%\">דואר אלקטרוני :</td><td width=\"60%\"><input name=\"email\" size=\"20\" type=\"text\" />";
- echo "</tr>";
- echo "<tr height=\"8\"></tr><tr>";
- echo "<td colspan=\"2\" align=\"left\"><input type=\"submit\" name=\"submit\" value=\"שלח\"</td>";
- echo "</tr>";
- echo "</table>";
- echo "</form>";
- }
- else
- {
- $username = form($_POST['username']);
- if ($_POST['password'] != $_POST['password_check'])
- exit("הסיסמאות שהקשת אינם זהות.");
- else
- $password = md5($_POST['password']);
- $email = form($_POST['email']);
- if (($username == "") || ($password == "") || ($password_check == "")) || ($email == ""))
- exit("לא מולאו כל הפרטים.");
- if ($password != $password_check)
- exit("הסיסמאות שהקשת אינם זהות.");
- $q = $db->prepare("SELECT * FROM `users` WHERE username = ?");
- $q->execute(array($username));
- $r = $q->rowCount();
- if ($r > 0)
- exit("שם המשתמש כבר קיים במערכת, אנא בחר בשם משתמש אחר.");
- else
- {
- $q = $db->prepare("INSERT INTO `users` (username,password,email) VALUES (?,?,?)");
- $q->execute(array($username, $password, $email));
- header("Location: register.php"); // Back to login.
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement