Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include "mysql.php";
- $username = addslashes($_POST['username']); // Protection
- $_POST['password'] = addslashes($_POST['password']); // Same
- $_POST['password2'] = addslashes($_POST['password2']); // same
- $checkUsername = mysql_query("SELECT `username` FROM `userdb` "
- . "WHERE `username` = '" . $_POST['username'] . "'",$mysql);
- if(mysql_num_rows($checkUsername) == "1"){
- echo "Someone already has your username<p>";
- include "signup.php";
- exit;
- }
- If(strlen($_POST['username'] > 32)) {
- echo "The username is too long<p>";
- include "signup.php";
- exit;
- if($_POST['password'] != $_POST['password2'])
- echo "Both passwords must be the same<p>";
- include "signup.php";
- exit;
- $password = md5($_POST['password]);
- mysql_query("INSERT INTO `userdb` (`username`, `password`) "
- ."VALUES (('" . $username . "'''" . $password . "'"), $mysql);
- $_SESSION['user'] = $username;
- header("Location: index.php");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement