Question

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');

No correct solution

OTHER TIPS

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();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top