2017-10-11 170 views
-1

任何人都可以告诉我什么是我的代码错误。 我试图在用户名密码验证后重定向。 条件工作正常。但重定向不起作用。PHP登录后重定向

这里是我的代码

if(password_verify($password , $row['password']) && $count == 1) 
{ 
    if($row['status'] == 'active') 
    { 
     if ($row['designation'] == 'employee') 
     { 
      $_SESSION['CorpSession'] = $row['id']; 
      header("Location: ../corporate/index.php"); 
      exit; 
     } 
     elseif($row['designation'] == 'admin') 
     { 
      $_SESSION['CorpSession'] = $row['id']; 
      header("Location: ../corporate/admin.php"); 
      exit; 
     } 
    } 
    elseif($row['status'] == 'waiting') 
    { 
     $ErrMsg = "<div id='alert' class='alert alert-info'>Profile Approval pending !</div>"; 
    } 
    else 
    { 
     $ErrMsg = "<div id='alert' class='alert alert-info'>Some Error Happened !</div>"; 
    } 
} 
else 
{ 
    $ErrMsg = "<div id='alert' class='alert alert-danger'>Invalid Username or Password !</div>"; 
} 
+2

_But重定向没有发生.._ _not happens_对你有什么意义? –

+2

激活错误报告和/或检查错误日志。最有可能的:[如何解决]已经发送的头文件“PHP中的错误”(https://stackoverflow.com/q/8028957/476) – deceze

+0

请添加更多信息,例如你有什么尝试和什么是你得到的错误 –

回答

0

不是问题的答案,但如果你确信重定向触发器和不超过也许有些输出已经已经发出工作。尝试使用

ob_start(); 

顶部pd您的文件以查看是否有帮助。