i created a login page in php and used session in it… after checking the condition i am setting the session as
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
and in the login_succes.php i have the code as
<?
session_start();
if(!session_is_registered(myusername)){
header("location:main_login.php");
}
?>
<html>
<body>
<h2><?php session_start(); echo $_SESSION['myusername']; ?>
Welcome to hell</a>
</body>
</html>
and in logout.php the code is
<?
session_start();
session_destroy();
?>
the issue i am facing is on login 2nd time i am getting 1st user name itself in the output.
To destroy a session with one of the following:
Instead of session_is_registered, use standard $_SESSION super global. Like:
To register a session variable use:
Also, PHP version, environment, could help us to find out.