Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*******************************************/
- /************ולידציה של מנהלי אתר***********/
- /*******************************************/
- require 'connector.php';
- //השגת אלמנטיפ מטופס המילוי של כניסת המנהלים
- $user_from_login=$_POST['user'];
- $password_from_login=$_POST['password'];
- $innner_counter=0;//מונה
- //הכנסת כל התוצאות אל המערך
- $user_array=array();
- $password_array=array();
- //שליפה של כל הנתונים מתוך מבנה הנתונים על מנת לבצע השוואה
- if ($stmt=$mysqli->prepare("SELECT user,password FROM user_admin "))
- {
- $stmt->execute();
- $stmt->bind_result($userFromDB,$passwordFromDB);
- }
- //הכנסת כל התוצאות אל המערך תוך כדי צמצום רווחים וקידום המונה
- while ($stmt->fetch())
- {
- trim($userFromDB);
- trim($passwordFromDB);
- array_push($user_array, $userFromDB);
- array_push($password_array, $passwordFromDB);
- $innner_counter++;
- }
- $stmt->close();
- for ($i = 0; $i < $innner_counter; $i++)
- {
- if (($password_from_login===$password_array[$i]) && ($password_from_login===$password_array[$i]))
- {
- header("Location:show_users.php");
- exit();
- }
- }
- //password or user are incorrent - in this case the client will redirect to other page
- header("HTTP/1.1 401 Unauthorized");
- exit();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment