米西米西
<?php
/**
* 查询用户
* @param unknown $sql
* @return unknown
*/
function checkAdmin($sql){
return fetchOne($sql);
}
/**
* 验证是否登录
*/
function checkLogined(){
if($_SESSION['adminId'] == "" && $_COOKIE['adminId'] == ""){
alertMes("没有登录,请先登录!", "login.php");
}
}
/**
* 注销
*/
function logout(){
$_SESSION = array();
if(isset($_COOKIE[session_name()])){
setcookie(session_name(),"",time()-1);
}
if(isset($_COOKIE['adminId'])){
setcookie("adminId","",time()-1);
}
if(isset($_COOKIE['adminName'])){
setcookie("adminName","",time()-1);
}
session_destroy();
header("location:login.php");
}