Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("config.php");
- if($_SERVER["REQUEST_METHOD"] == "POST") {
- // username and password sent from form
- //$myusername = mysqli_real_escape_string($db, $_POST['username']);
- //$mypassword = mysqli_real_escape_string($db, $_POST['password']);
- $myusername = $_POST['username'];
- $mypassword = $_POST['password'];
- $sql = "SELECT * FROM LoginInfo WHERE 'Username' = $myusername AND 'Password' = $mypassword";
- //$sql = "SELECT * FROM 'LoginInfo' WHERE 'Username' = '$myusername' AND 'Password' = '$mypassword'";
- $result = mysqli_query($db, $sql);
- $count = mysqli_num_rows($result);
- // If result matched $myusername and $mypassword, $result evaluates to true
- if ($count == 1) {
- echo "user found and password matched!";
- }
- else {
- echo "Your Login Name or Password is invalid. Try again. ";
- }
- }
- ?>
- <html lang="eng">
- <head>
- <title>Login Page</title>
- </head>
- <body bgcolor = "#FFFFFF">
- <form action = "" method = "post">
- <input type="username" class="text" name="username" placeholder="Enter username" required="required">
- <input type="password" class="text" name="password" placeholder="Password" required="required">
- <input class="btn" type="submit" value="Submit">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement