Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <center>
- <head>
- <title>Register.</title>
- </head>
- <body>
- <style type="text/css">
- body { color: red; }
- </style>
- <h1>Register.</h1>
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
- <strong>Username:</strong><br>
- <input type="text" name="username"><br>
- <strong>Password:</strong><br>
- <input type="password" name="password"><br>
- <strong>Confirm Password</strong><br>
- <input type="password" name="cpass"><br>
- <input type="submit" name="submit" value="Register!"><br>
- </form>
- </body>
- <?php
- #start the session
- session_start();
- #require the config file.
- require('config.php');
- #variables.
- $user = stripslashes($_POST['username']);
- $pass = stripslashes($_POST['password']);
- $cpass = stripslashes($_POST['cpass']);
- $user = mysql_escape_string($_POST['username']);
- $pass = mysql_escape_string($_POST['password']);
- $cpass = mysql_escape_string($_POST['cpass']);
- $sub = $_POST['submit'];
- #if statement to make the database go into mysql.
- if (isset($sub)) {
- if (is_string($user) && $pass == $cpass && $pass != "" && $user != "") {
- mysql_query("INSERT INTO `accounts` (user, pass) VALUES ('$user','$cpass')") or die(mysql_error());
- echo "You have successfully registered.";
- }
- else if (isset($userlogged))
- echo "You are logged in please go log out before registering an account.";
- else
- echo "There was a problem with you registering your account, Please go back and try again.";
- }
- ?>
- </center>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement