php自定义函数之判断用户是否登录

/*—————————————————— */
//– 检测用户是否登录函数
/*—————————————————— */
function checklogin ()
{
$user_id = isset($_SESSION['admin']['uid']) ? intval($_SESSION['admin']['uid']) : 0;
if ($user_id < 1)
{
exit (“<script>alert (‘对不起,你还没有登录,请先登录’);window.parent.location.href=’login.php’;</script>”);

//parent ,防止框架页,跳出不成功。
}
}


Leave Your Comment

Your email will not be published or shared. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

*
请输入图片中的字符以验证你并非垃圾机器人. 点击图片收听验证码的语音版.
点击这里收听此验证码的语音版本