+1  A: 

isset($_SESSION['username']) && ($_SESSION['username'] == $myusername)

Tim
thanks worked like charm
tunetosuraj
A: 

I see an error at

isset()

You can either use

isset($_SESSION['username'])

or

if($_SESSION['username'] == $myusername)
nepsdotin
A: 

You might wanna try to get a value for $_SESSION['username'] outside if statement. Something like this

$_SESSION['username'] = $myusername;

if(isset($_SESSION['username'])){
    header("location:main_login.php");
}
Eugene
that did not work :(
tunetosuraj