Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Author: Javed Ur Rehman
- Website: http://www.allphptricks.com/
- */
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Registration</title>
- <link rel="stylesheet" href="css/style.css" />
- </head>
- <body>
- <?php
- require('db.php');
- // If form submitted, insert values into the database.
- if (isset($_REQUEST['username'])){
- $username = stripslashes($_REQUEST['username']); // removes backslashes
- $username = mysqli_real_escape_string($con,$username); //escapes special characters in a string
- $password = stripslashes($_REQUEST['password']);
- $password = mysqli_real_escape_string($con,$password);
- $pin = stripslashes($_REQUEST['pin']);
- $pin = mysqli_real_escape_string($con,$pin);
- $trn_date = date("Y-m-d H:i:s");
- //$d = stripslashes($_REQUEST['d']);
- //$d = mysqli_real_escape_string($con,$d);
- if(isset($_POST['d']) &&
- $_POST['d'] == 'Yes')
- $query = "INSERT into `users` (username, password, pin, trn_date,d) VALUES ('$username', '".($password)."', '$pin', '$trn_date','$d')";
- $result = mysqli_query($con,$query);
- // $d = (isset($_REQUEST['d']) ? true : false;
- if($result){
- echo "<div class='form'><h3>You are registered successfully.</h3><br/>Click here to <a href='login.php'>Login</a></div>";
- }
- }else{
- ?>
- <div class="form">
- <h1>Registration</h1>
- <form name="registration" action="" method="post">
- <input type="text" name="username" placeholder="Username" required />
- <input type="password" name="password" placeholder="Password" required />
- <input type="password" name="password" placeholder="Password repeat" required />
- <input type="password" name="pin" placeholder="(4 Digit Minimum) Pin" required />
- <br />
- <br />
- Do you have a
- <br />
- dream market account?
- <input type="checkbox" name="d" value="Yes" />
- <br />
- <br />
- (this will give you a free vendor account)
- <br />
- <br />
- <input type="submit" name="submit" value="Register" />
- </form>
- <br /><br />
- </div>
- <?php } ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement