Bnaya

Untitled

Jun 29th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.  
  4. /*******************************************/
  5. /************ולידציה של מנהלי אתר***********/
  6. /*******************************************/
  7.  
  8. require 'connector.php';
  9.  
  10. //השגת אלמנטיפ מטופס המילוי של כניסת המנהלים
  11. $user_from_login=$_POST['user'];
  12. $password_from_login=$_POST['password'];
  13.  
  14. //שליפה של כל הנתונים מתוך מבנה הנתונים על מנת לבצע השוואה
  15. if ($stmt=$mysqli->prepare("SELECT user,password FROM user_admin WHERE user= ?"))
  16. {
  17.     $stmt->bind_param('s', $user_from_login);
  18.     $stmt->execute();
  19.     $stmt->bind_result($userFromDB,$passwordFromDB);
  20. }
  21.  
  22.  
  23.  
  24.  
  25. if(!$stmt->fetch()) {
  26.     // No such user
  27.     header("HTTP/1.1 401 Unauthorized");
  28.     die();
  29. }
  30.  
  31. if($passwordFromDB !== $password_from_login) {
  32.     //Bad password
  33.     header("HTTP/1.1 401 Unauthorized");
  34.     die();
  35. }
  36.    
  37. $stmt->close();
  38.  
  39. header("Location:show_users.php");
  40. exit();
  41.    
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment