Frage

I'm using header function of php to redirect to index page , but after redirect, an error has been com out that you are not connected to network.

both file are in same directory.

code is

function chklogin()
{
  require('script/session.php');
  if(isset($usernmae))
     {   
      echo "welcome";
     }
     else
     { 
      header('location: index.php');
     }
 }
header('location: index.php');

Keine korrekte Lösung

Andere Tipps

Change your code to this please and then try :)

function chklogin()
{
  require('script/session.php');
  if(isset($username))
     {   
      echo "welcome ".$username;
     }
     else
     { 
      header('Location: /index.php');
     }
}
chklogin();
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top