Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("db.php");
- session_start();
- if($_SERVER["REQUEST_METHOD"] == "POST")
- {
- // username and password sent from Form
- $username=mysqli_real_escape_string($db,$_POST['username']);
- $password=mysqli_real_escape_string($db,$_POST['password']);
- $password=md5($password); // Encrypted Password
- $sql="SELECT id FROM admin WHERE username='$username' and passcode='$password'";
- $result=mysqli_query($db,$sql);
- $count=mysqli_num_rows($db,$result);
- // If result matched $username and $password, table row must be 1 row
- if($count==1)
- {
- header("location: welcome.php");
- }
- else
- {
- $error="Your Login Name or Password is invalid";
- }
- }
- ?>
- <div class="wrapper">
- <form class="form-signin" action="login.php" method="post">
- <h2 class="form-signin-heading">Please login</h2>
- <input type="text" class="form-control" name="username" placeholder="User Name" required="" autofocus="" />
- </br>
- <input type="password" class="form-control" name="password" placeholder="Password" required=""/>
- <label class="checkbox">
- <input type="checkbox" value="remember-me" id="rememberMe" name="rememberMe"> Remember me
- </label>
- <button class="btn btn-lg btn-primary btn-block" type="submit">Login</button>
- </form>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement