Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- <?
- //Define Variables
- $username = $_REQUEST['username'];
- $password = $_REQUEST['password'];
- $username_in_use = 0;
- //Salt and Encrypt teh passwordz
- $salt = "easd1hj";
- $password = $salt . $password;
- $password = md5($password);
- //MySQL database stuff
- $con = mysql_connect("localhost","matttenn_mc","password123");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("matttenn_mc", $con);
- $result = mysql_query("SELECT * FROM users WHERE username='" . $username . "'");
- while($row = mysql_fetch_array($result))
- {
- $username_in_use = 1;
- header( 'Location: register.html?uniqueuser=0' ) ;
- }
- //Provided the info is unique, add to DB
- if ($username_in_use == 0)
- {
- mysql_query("INSERT INTO users (username, password)
- VALUES ('" . $username . "', '" . $password . "')");
- header( 'Location: index.html' ) ;
- }
- ?>
Add Comment
Please, Sign In to add comment