Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require('../includes/connect_to_db.php');
- if (isset($_POST['username']) and isset($_POST['password'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- $query = "SELECT * FROM `user` WHERE username='$username' and password='$password'";
- $result = mysqli_query($connection, $query) or die(mysqli_error($connection));
- $count = mysqli_num_rows($result);
- if (empty($_POST['username'])||
- empty($_POST['password'])){
- $fmsg = "Invalid Login Credentials.";
- }
- if(mysqli_num_rows($result)>0){
- $_SESSION['username'] = $username;
- header("Location:Loginpage.php");
- }else{
- $fmsg = "Invalid Login Credentials.";
- }
- }
- if (isset($_SESSION['username'])){
- $username = $_SESSION['username'];
- }
- ?>
- if (isset($_POST['username']) and isset($_POST['password']) and $_POST['username']!='' and $_POST['password']!=''){
Add Comment
Please, Sign In to add comment