I have a login file with two fields: username and password
Because I want to use variable username for other .php files so I declare session in login.php file as:
login.php
===========
<?
session_start();
session_register('username');
?>
.....
... get username from a form.....
....get password ..................
============
Now I want to assign the variable username of that user to a variable name in other get_name.php file and show username's table as bellow:
get_name.php
==============
<?
session_start(); //to get username from login file
$name = $username;
......
...Show username's TABLE....
......
?>
It is work well.
The new problem here is when I return "BACK" to previous login page and I login as another user (different with previous one), I went to the same page of the previous user, (that means it still show previous user's table)
I thought that I will use session_destroy() function like this:
login.php
===========
<?
session_destroy(); //destroy previous session
session_start(); //start new session
session_register('username');
?>
However, it still the same, after I login, I still went to the previous user's page !!!!!!!!!!!!!!!!.
(Please note that, I may use the same username variable for other pages)
you should have a logout page that will session_destroy() and also put this on access denied pages, so that way no one has anything that may involve a security risk.
try that out, thats how I do it.
Aaron "Theiggsta" Kalin Pixel Martini
Ruby and Rails Developer
Hello
Yes, I can have a logout.page but what I want is that I can "BACK" to previous login page event I do not logout yet. So I can login as another user.
Thanks
johns
Bookmarks