daily pastebin goal
50%
SHARE
TWEET

Untitled

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