Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'mysql.php';
- if ( isset($_POST['send']) )
- {
- $user = $_POST['username'];
- $hash = md5("asdf".md5($_POST['password']));
- $query = "SELECT username
- FROM users
- WHERE username='$user'
- LIMIT 1";
- $result = mysql_query($query) or
- die(mysql_error());
- if ( $row = mysql_fetch_array($result) )
- echo '<p style="text-color: #FF0000">Username is already in use!</p>';
- else
- {
- $query = "INSERT INTO users (username, password)
- VALUES ('$user', '$hash')";
- $result = mysql_query($query) or
- die(mysql_error());
- echo 'Account created succesfully!<br />';
- }
- }
- ?>
- <html>
- <head>
- <title>Create new account</title>
- </head>
- <body>
- <form action="newaccount.php" method="POST">
- <div>
- Username: <input type="text" name="username" /><br />
- Password: <input type="password" name="pass" /><br />
- <input type="Submit" name="send" value="Submit" />
- </div>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement