dpwh11290 2014-10-19 09:23
浏览 48

php中的两个if语句

I have two seperate if statements, the first if statement is not working but the second one is. The first if statement works on my other pages and I am unsure of how to properly code this as I am a beginner to PHP.

<?php 
session_start();

if($_SESSION['loggedin'] != 'true') {
    header("location:login.php"); 
} 

if ($_SESSION['admin']=='N') {
    header("location:errorpage.php");
    }
?>
  • 写回答

4条回答 默认 最新

  • dongsaohu6429 2014-10-19 09:36
    关注

    $_SESSION['loggedin']?

    Why don't just clear every SESSION var on logout and if the SESSION vars are set => the user is logged in. And use after the header(); an exit();

    Try var_dump($_SESSION['loggedin']) and edit your question.

    Or maybe your loggedin var is not a string but a boolean so you could do if(!$_SESSION['loggedin'])

    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)