Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include 'config.php';
  4. if (isset($_POST['submit'])) {
  5. $username = $_POST['username'];
  6. $password = $_POST['password'];
  7. chckusername($username, $password);
  8. }
  9. function chckusername($username, $password){
  10. include_once 'config.php';
  11. $check = "SELECT * FROM excel WHERE username='$username'";
  12. $check_q = mysqli_query($check) or die("<div class='loginmsg'>Error on checking Username<div>");
  13. if (mysqli_num_rows($check_q) == 1) {
  14. chcklogin($username, $password);
  15. }
  16. else{
  17. echo "<div id='loginmsg'>Wrong Email</div>";
  18. }
  19. }
  20. function chcklogin($username, $password){
  21. $login = "SELECT * FROM excel WHERE username='$username' and password='$password'";
  22. $login_q = mysqli_query($login) or die('Error on checking Username and Password');
  23. // Mysql_num_row is counting table row
  24. if (mysqli_num_rows($login_q) == 1){
  25. echo "<div id='loginmsg'> Logged in as $username </div>";
  26. $_SESSION['username'] = $username;
  27. header('Location: member.php');
  28. }
  29. else {
  30. echo "<div id='loginmsg'>Wrong Password </div>";
  31. //header('Location: login-problem.php');
  32. }
  33. }
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement