Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $user = "root";
- $pass = "pass";
- $db = "sheetpal";
- mysql_connect($host, $user, $pass) or die("Could not connect to database");
- mysql_select_db($db);
- if (isset($_POST['username'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- $username = stripslashes($username);
- $password = stripcslashes($password);
- $sql = "SELECT * FROM users WHERE username = '$username' and password = '$password' ";
- $res = mysql_query($sql);
- if(mysql_num_rows($res) == 1){
- echo "You have successfulyl logged in.";
- exit();
- }
- else {
- echo"Invalid login information.";
- exit();
- }
- }
- ?>
- <html>
- <body>
- <form method="post" action="index.php">
- Username: <input type = "text" name = "username" /><br /><br />
- Password : <input type = "password" name = "password" /><br /><br />
- <input type = "submit" name = "submit" value = "Log in" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement