2017-10-11 165 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您的文件以查看是否有幫助。