SHARE
TWEET

Untitled

a guest Jun 30th, 2018 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?
  2. <? 
  3.     //Define Variables
  4.     $username = $_REQUEST['username'];
  5.     $password = $_REQUEST['password'];
  6.     $username_in_use = 0;
  7.    
  8.     //Salt and Encrypt teh passwordz
  9.     $salt = "easd1hj";
  10.     $password = $salt . $password;
  11.     $password = md5($password);
  12.    
  13.     //MySQL database stuff
  14.     $con = mysql_connect("localhost","matttenn_mc","password123");
  15.     if (!$con)
  16.   {
  17.         die('Could not connect: ' . mysql_error());
  18.   }
  19.     mysql_select_db("matttenn_mc", $con);
  20.     $result = mysql_query("SELECT * FROM users WHERE username='" . $username . "'");
  21.     while($row = mysql_fetch_array($result))
  22.   {
  23.         $username_in_use = 1;
  24.         header( 'Location: register.html?uniqueuser=0' ) ;
  25.   }
  26.    
  27.     //Provided the info is unique, add to DB
  28.     if ($username_in_use == 0)
  29.     {
  30.         mysql_query("INSERT INTO users (username, password)
  31.         VALUES ('" . $username . "', '" . $password . "')");
  32.         header( 'Location: index.html' ) ;
  33.     }
  34. ?>
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
 
Top