daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Jun 18th, 2017 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     include('connect.php');
  3.    
  4.     $user = mysql_real_escape_string($_POST['name']);
  5.     $pass = mysql_real_escape_string($_POST['pass']);
  6.     $confirm = mysql_real_escape_string($_POST['confirm']);
  7.    
  8.     if ($_POST['name']== "" || $_POST['pass']== "" || $_POST['confirm']== "")
  9.     {
  10.         header("Location: error1.php");
  11.     }
  12.     if ($pass != $confirm)
  13.     {
  14.         header("Location: error2.php");
  15.     }
  16.     $result = mysql_query("SELECT login FROM accounts WHERE login='{$user}'");
  17.     if(mysql_num_rows($result)>0)
  18.     {
  19.         die ('Error: Username already exists.');
  20.     }
  21.     else
  22.     {
  23.         mysql_query("INSERT INTO accounts (login, password, accessLevel) VALUES ('".$_POST['name']."', '".base64_encode(pack('H*', sha1($_POST['pass'])))."', 0)")
  24.         or die ('Error: ' . mysql_error());
  25.     }
  26. //report successful registration
  27. echo "Account created successfully.";
  28. ?>
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