Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(!isset($_SESSION['user']))
- {
- header("location: login.php");
- }
- ?>
- <?php
- session_start();
- if(isset($_POST['uname']))
- {
- include_once("dataBase.php");
- $username = strip_tags($_POST['uname']);
- $password = strip_tags($_POST['pass']);
- $username = stripslashes($username);
- $password = stripslashes($password);
- $username = mysql_real_escape_string($username);
- $password = mysql_real_escape_string($password);
- $sql = "SELECT * FROM users WHERE Username='$username'";
- $qry = mysql_query($sql);
- $row = mysql_fetch_row($qry);
- $user = $row[0];
- $pass = $row[1];
- if($pass == $password)
- {
- $_SESSION['user'] = $username;
- header("location: Home.php");
- }
- else
- {
- echo "Incorrect Details!";
- header("location: logout.php");
- }
- }
- ?>
- <html>
- <head>
- <title>Login</title>
- <meta charset = "utf-8"/>
- <link rel = "stylesheet" type = "text/css" href="style.css"/>
- </head>
- <body>
- <div class = "header"><h1>Library</h1>
- </div>
- <div id = "loginForm">
- <form method = "POST">
- Username: <br>
- <input type = "text" name = "uname"/><br>
- Password: <br>
- <input type = "password" name = "pass"/><br>
- <input type = "submit" name = "login" value = "Login"/><a href = "registration.php"><input type = "button" value = "Register"/></a>
- </form>
- </div>
- <div class = "footer">
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement