SHARE
TWEET

Untitled

a guest May 22nd, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     require 'mysql.php';
  3.     if ( isset($_POST['send']) )
  4.     {
  5.         $user = $_POST['username'];
  6.         $hash = md5("asdf".md5($_POST['password']));
  7.         $query = "SELECT username
  8.                 FROM users
  9.                 WHERE username='$user'
  10.                 LIMIT 1";
  11.         $result = mysql_query($query) or
  12.             die(mysql_error());
  13.         if ( $row = mysql_fetch_array($result) )
  14.             echo '<p style="text-color: #FF0000">Username is already in use!</p>';
  15.         else
  16.         {
  17.             $query = "INSERT INTO users (username, password)
  18.                     VALUES ('$user', '$hash')";
  19.             $result = mysql_query($query) or
  20.                 die(mysql_error());
  21.             echo 'Account created succesfully!<br />';
  22.         }
  23.     }
  24. ?>
  25. <html>
  26. <head>
  27. <title>Create new account</title>
  28. </head>
  29. <body>
  30. <form action="newaccount.php" method="POST">
  31. <div>
  32.     Username: <input type="text" name="username" /><br />
  33.     Password: <input type="password" name="pass" /><br />
  34.     <input type="Submit" name="send" value="Submit" />
  35. </div>
  36. </form>
  37. </body>
  38. </html>
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