Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $con=mysql_connect("localhost","test","test");
- mysql_select_db("employees");
- if(!$con)
- {
- die('No Connection:'.mysql_error());
- }
- else
- {
- if($_POST['username']) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $query = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$password'");
- if($row = mysql_fetch_row($query))
- {
- echo('Welcome!');
- }
- else
- {
- echo('Nope! You ain't a user here!!!');
- }
- }
- mysql_close($con);
- ?>
- <html>
- <head>
- <title>Employees authentication</title>
- </head>
- <body>
- <form method="POST" action="form.php">
- Username: <input type=text name="username"><br>
- Password: <input type=password name="password"><br>
- <input type=submit value="Login"><input type=reset>
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment