Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>Register!</title>
- </head>
- <body>
- <form action='<?=$_SERVER['PHP_SELF']?>' method='POST'>
- Username: <input type='text' name='username'><br>
- Password: <input type='password' name='password'><br>
- <input name="register" type="submit" value="Submit">
- </form>
- <?php
- include('config.php');
- ///variables...
- $submit=$_POST['register'];
- $username =
- mysql_real_escape_string(strip_tags(htmlspecialchars($_POST['username'])&
- #41;);
- $password = md5($_POST['password']);
- //if button is pressed
- if($submit){
- //if username is not blank..same for pass
- if(($username) and ($password) and ($username!==NULL) and
- ($password!==NULL)){
- $sql="INSERT INTO `users` (`id`,`username`,`password`)
- VALUES
- ('NULL','".$username."','".$password."')";
- mysql_query($sql) or die(mysql_error());
- echo "Congratulations! You are registered!<br><a href='index.php'>Log
- in</a>";
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement