Advertisement
Guest User

Untitled

a guest
Mar 1st, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. userID fullname email role password
  2. 1 Tester one test@gmail.com N ALSJALDDJ6464!JJLSK
  3. 2 Tester two tester@gmail.com C @ALSJAL5656DDJJJLSK
  4.  
  5. <?php
  6. error_reporting(E_ALL ^ E_NOTICE);
  7. ini_set('display_errors', 1);
  8.  
  9. // establishing the MySQLi connection
  10.  
  11. // Create connection
  12. $servername = "localhost";
  13. $username = "root";
  14. $password = "root";
  15. $dbname = "timewise";
  16.  
  17. $conn = new mysqli($localhost, $username, $password, $dbname);
  18. // Check connection
  19. if ($conn->connect_error) {
  20. die("Connection failed: " . $conn->connect_error);
  21. }
  22.  
  23. // checking the user
  24. if(isset($_POST['btnLogin'])){
  25. $email = mysqli_real_escape_string($conn,$_POST['uemail']);
  26. $pass = mysqli_real_escape_string($conn,$_POST['upass']);
  27.  
  28. //$pass = crypt($pass);
  29.  
  30.  
  31. $sel_user = "SELECT * FROM users WHERE email='$email' AND pass='$pass'";
  32.  
  33. $run_user = mysqli_query($conn, $sel_user);
  34. if (!$sel_user) {
  35. die(mysqli_error($conn));
  36. }
  37.  
  38. $check_user = mysqli_num_rows($run_user);
  39.  
  40. if($check_user>0){
  41.  
  42. $_SESSION['email'] = $email;
  43.  
  44.  
  45. print '<script type="text/javascript">window.location = "index.html"</script>';
  46.  
  47. }
  48.  
  49. else {
  50. echo '<center><span style="color:#801b1b; border:1px solid #e5a3a3; background:#ffcfcf; padding:5px;">Email or password is not correct, please try again!</span></center>';
  51.  
  52. }
  53.  
  54. }
  55.  
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement