Sql Query,检查admin

时间:2013-08-29 17:09:03

标签: php sql admin

我需要检查管理员是否重定向到其他页面

process_login.php

<?php
include 'db_connect.php';
include 'functions.php';
sec_session_start(); // Our custom secure way of starting a php session. 
if(isset($_POST['email'], $_POST['p'])) { 
   $email = $_POST['email'];
   $admin = "SELECT * FROM members WHERE admin = 1 AND email='$email'";
   $result = mysqli_query($mysqli,$admin);
   $check = mysqli_num_rows($result);
   $password = $_POST['p']; // The hashed password.
   if(login($email, $password, $mysqli) == true) {
       if ($check == 0)
       {       //if admin logged in
           header("Location: ..\login/logged_success_admin.php");
       }else{
      // Login success
     header("Location: ..\login/logged_success.php");
       } 
     }else{
      // Login failed
     header("Location: ...\...\?error=1");
   }
} else { 
   // The correct POST variables were not sent to this page.
   echo 'Invalid Request';
}
;?>

0 个答案:

没有答案