Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function authenticate()
- {
- $username = $_POST['username'];
- $pwd = $_POST['pwd'];
- $con = mysqli_connect("localhost","root","","bankapp");
- $rs = $con->query("select count(username) from logindetails where username='$username' and password='$pwd'");
- $row = $rs->fetch_row();
- $n = $row[0];
- $rs->free();
- $con->close();
- if($n <> 0)
- {
- session_start();
- $_SESSION['uname'] = $username;
- header("Location: bal.php");
- }
- else
- {
- echo "<b>Authentication Failed</b>";
- }
- }
- ?>
- <head>
- <title>DBS-Login</title>
- </head>
- <body>
- <h1>LOGIN</h1>
- <form method="POST">
- <table border="1">
- <tr>
- <td>Username </td>
- <td>
- <input type="text" name="username" />
- </td>
- </tr>
- <tr>
- <td>Password </td>
- <td>
- <input type="password" name="pwd" />
- </td>
- </tr>
- <tr align="center">
- <td colspan="2">
- <input type="submit" name="submit" value="Login" />
- </td>
- </tr>
- </table>
- </form>
- <?php
- if(isset($_POST['submit'])){
- authenticate();
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment