Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include 'config.php';
- if (isset($_POST['submit'])) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- chckusername($username, $password);
- }
- function chckusername($username, $password){
- include_once 'config.php';
- $check = "SELECT * FROM excel WHERE username='$username'";
- $check_q = mysqli_query($check) or die("<div class='loginmsg'>Error on checking Username<div>");
- if (mysqli_num_rows($check_q) == 1) {
- chcklogin($username, $password);
- }
- else{
- echo "<div id='loginmsg'>Wrong Email</div>";
- }
- }
- function chcklogin($username, $password){
- $login = "SELECT * FROM excel WHERE username='$username' and password='$password'";
- $login_q = mysqli_query($login) or die('Error on checking Username and Password');
- // Mysql_num_row is counting table row
- if (mysqli_num_rows($login_q) == 1){
- echo "<div id='loginmsg'> Logged in as $username </div>";
- $_SESSION['username'] = $username;
- header('Location: member.php');
- }
- else {
- echo "<div id='loginmsg'>Wrong Password </div>";
- //header('Location: login-problem.php');
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement