Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("config.php");
- session_start();
- $error ="";
- 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']);
- $sql = "SELECT ID FROM Users WHERE Username = '$myusername' and Password = PASSWORD('$mypassword')";
- $result = mysqli_query($db,$sql);
- $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
- $active = $row["ID"];
- $count = mysqli_num_rows($result);
- // If result matched $myusername and $mypassword, table row must be 1 row
- if($count == 1) {
- $_SESSION['login_user'] = $myusername;
- header("location: welcome.php");
- }else {
- $error = "Your Login Name or Password is invalid";
- }
- }
- ?>
- <html>
- <head>
- <title>Login Page</title>
- <style type = "text/css">
- body {
- font-family:Arial, Helvetica, sans-serif;
- font-size:14px;
- }
- label {
- font-weight:bold;
- width:100px;
- font-size:14px;
- }
- .box {
- border:#666666 solid 1px;
- }
- </style>
- </head>
- <body bgcolor = "#FFFFFF">
- <div align = "center">
- <div style = "width:300px; border: solid 1px #333333; " align = "left">
- <div style = "background-color:#333333; color:#FFFFFF; padding:3px;"><b>Login</b></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement