Passing data from a session into a variable
Posted: Mon Mar 24, 2008 12:46 pm
ok i dont want to deter anyone by my rookie knowledge, so i have thought about what i am going to ask.
Im doing a uni exercise at the moment and am trying to replicate the windows lock button feature for a website. It involves clicking on a 'lock' link that takes the current logged in user (using sessions ) to a page where they can only re-enter their password and then they will be re-directed back to the page they were on. This might seem useless, but i want to put this on a website so that if the user can quickly and easily lock access to their account to prevent another user getting on their workstation and changing details etc.
To do this i need to pass the username from the original session into a variable on the 'lock' page, then destroy the session so you cant click the browser back button and go to the previous page. The username stored and password entered can then be compared to the username and password in the database to check the validity of the user and a new session created.
Im a rookie at best, and when i try to use $username = <?=$_SESSION['username']?> there is an error.
If anyone knows an easy way to pass data from a session into a variable, with the session then being destroyed then please let me know.
cheers
Im doing a uni exercise at the moment and am trying to replicate the windows lock button feature for a website. It involves clicking on a 'lock' link that takes the current logged in user (using sessions ) to a page where they can only re-enter their password and then they will be re-directed back to the page they were on. This might seem useless, but i want to put this on a website so that if the user can quickly and easily lock access to their account to prevent another user getting on their workstation and changing details etc.
To do this i need to pass the username from the original session into a variable on the 'lock' page, then destroy the session so you cant click the browser back button and go to the previous page. The username stored and password entered can then be compared to the username and password in the database to check the validity of the user and a new session created.
Im a rookie at best, and when i try to use $username = <?=$_SESSION['username']?> there is an error.
If anyone knows an easy way to pass data from a session into a variable, with the session then being destroyed then please let me know.
cheers