Note that there are some explanatory texts on larger screens.

plurals
  1. POPhp Header command working in one file but not working on other
    text
    copied!<p>hye , My current Directory structure is like</p> <ol> <li>Admin (index.php, country.php)</li> <li>Classes(connection.php,login.php,country.php)</li> <li>header.php</li> <li>footer.php</li> <li>index.php</li> <li>includes(header.php,footer.php)</li> </ol> <p>my problem is that on <strong>webserver</strong> when i am in <strong>/admin/country.php</strong> and add a country using form post method and action set to <strong>/classes/country.php</strong> my header statement "<strong>Header("Location: ../Admin/country.php")</strong>" is working ok but when i am on my index page in root directory and try to login with form action <strong>"classes/login.php"</strong> and on successful login i use <strong>header("Location: ../Admin/index.php")</strong> it never redirects but everything works fine my local server, i don't know whats the problem over here, Any help would be really appreciated, I have searched this forum and others and tried to use the techniques they have told but nothing is working </p> <p>my index page <a href="http://asad.thexchanger.com/" rel="nofollow">index.php</a></p> <p>my Admin Section <a href="http://asad.thexchanger.com/Admin/country.php" rel="nofollow">Admin/Country.php</a></p> <p>my login.php script is below </p> <pre><code>&lt;?php ob_start(); include_once("classes/connection.php"); ?&gt; &lt;?php class login { public static function validateLogin($userName,$password) { if(isset($userName) &amp;&amp; isset($password)) { $connection = dbconnection::getConnection(); $query = "Select * from tbllogin Where loginID ='" . $userName . "' and password = '" . $password . "'"; $result = mysql_query($query); $rowsAffected = mysql_affected_rows(); if($rowsAffected==0) { //header("Location: ../index.php/"); //exit(); return false; } else { while($row = mysql_fetch_array($result)) { //working $role = $row["role"]; if($role == "Admin") { //header('Location: ../Admin/index.php'); //exit(); return true; } else { //echo "hello"; //header("Location: ../index.php/"); //exit(); return false; } //return $result; //header("Location: ../index.php"); } } } else { //header("Location: ../index.php/"); return false; } } } ?&gt; &lt;?php if(isset($_POST["btnSumbit"])) { $isValid = login::validateLogin($_POST["userID"],$_POST["password"]); if(isset($isValid)) { if($isValid ==true) { $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = 'Admin/index.php'; header("Location: http://$host$uri/$extra"); exit(); } } } ob_end_flush(); </code></pre> <p>?></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload