Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Login page!</title>
- </head>
- <body>
- <center>
- <?php
- $conn=mysqli_connect("localhost","root","","login");
- $user=@$_POST['txtname'];
- $pass=@$_POST['txtpass'];
- $query=mysqli_query($conn,"SELECT * FROM credentials WHERE username='".$user."'");
- $record=mysqli_fetch_array($query);
- if($user==$record['username'])
- {
- if($pass==$record['password'])
- {
- $_SESSION['txtname']=$_POST['txtname'];
- ?>
- <?php
- header('location:success.php');
- }
- else
- {
- ?>
- <?php
- header('location:wrongpassword.php');
- }
- }
- else
- {
- ?>
- <?php
- header('signup.php');
- }
- mysqli_close($conn);
- ?>
- <table border cellpadding="4" cellpadding="">
- <tr><th>
- <form method="post">
- <input type="text" name="txtname" placeholder="Username" required><br></th></tr>
- <tr><th>
- <input type="password" name="txtpass" placeholder="Password"><br><br></th></tr>
- <tr><th>
- <button type="submit" name="submit">Login »</button>
- <button type="reset">Reset</button></th></tr>
- </form>
- </table>
- </center>
- </body>
- </html>
Add Comment
Please, Sign In to add comment