Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ?>
- <!DOCTYPE html>
- <html>
- <center>
- <head>
- <meta charset="utf-8">
- <title>Sign Up</title>
- <link rel="stylesheet" href="style.css" />
- </head>
- <body>
- <?php
- require('db.php');
- session_start();
- // If form submitted, insert values into the database.
- if (isset($_POST['username'])) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $pin = $_POST['pin'];
- $username = stripslashes($username);
- $username = mysql_real_escape_string($username);
- $password = stripslashes($password);
- $password = mysql_real_escape_string($password);
- $pin = mysql_real_escape_string($pin);
- //Checking is user existing in the database or not
- $query = "SELECT * FROM `users` WHERE username='$username' and password='" . md5($password) . "'";
- $result = mysql_query($query) or die(mysql_error());
- $rows = mysql_num_rows($result);
- if ($rows == 1) {
- $_SESSION['username'] = $username;
- header("Location: index.php"); // Redirect user to index.php
- } else {
- echo "<div class='form'><h3>Username/password is incorrect.</h3><br/>Click here to <a href='login.php'>Login</a></div>";
- }
- } else {
- ?>
- <div class="form">
- <body style="margin-top: 5cm;">
- <body bgcolor="#ECECEA">
- <img src="lock_image.png" alt="Lock Image" style="width:90px;height:90px;">
- <font face="verdana" color="grey"><h1>SIGN UP</h1></font>
- <form action="" method="post" name="login">
- <input type="text" name="username" placeholder="Username" required />
- <input type="password" name="password" placeholder="Password" required />
- <input type="pin" name="pin" placeholder="Pin" required />
- <input name="submit" type="submit" value="Sign up" />
- </form>
- <p style="font-family:verdana;">Already Have an Account? <br ><a href='registration.php'>Click Here To Sign In</a></p>
- </div>
- <?php
- }
- ?>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement