SHARE
TWEET

Untitled

a guest Jun 15th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     session_start();
  3.     include "mysql.php";
  4.     $username = addslashes($_POST['username']); // Protection
  5.     $_POST['password'] = addslashes($_POST['password']); // Same
  6.     $_POST['password2'] = addslashes($_POST['password2']); // same
  7.     $checkUsername = mysql_query("SELECT `username` FROM `userdb` "
  8.  
  9. . "WHERE `username` = '" . $_POST['username'] . "'",$mysql);
  10.         if(mysql_num_rows($checkUsername) == "1"){
  11.         echo "Someone already has your username<p>";
  12.     include "signup.php";
  13.     exit;
  14.         }
  15.     If(strlen($_POST['username'] > 32)) {
  16.         echo "The username is too long<p>";
  17.     include "signup.php";
  18.         exit;
  19.        
  20.        
  21.         if($_POST['password'] != $_POST['password2'])
  22.                 echo "Both passwords must be the same<p>";
  23.                 include "signup.php";
  24.                 exit;
  25.        
  26.  
  27.     $password = md5($_POST['password]);
  28.     mysql_query("INSERT INTO `userdb` (`username`, `password`) "
  29.    
  30. ."VALUES (('" . $username . "'''" . $password . "'"), $mysql);
  31.     $_SESSION['user'] = $username;
  32.     header("Location: index.php");
  33. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top