i want to make password a session variable to be used later for checking
can you tell me if this is right?
session_register("password"); //defines the variable as a session variable
session_is_registered("password") // to call it later when needed?
i want to use it in my change password form and was wondering if this is right
if (session_is_registered("password")!=$old_passwd)
echo "Your old password is incorrect<br />please try again.";
global session variables
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
What version of PHP are you using? If it's 4.1 or greater then to set a session variable you would do:
and to check that it's set and to display it:
Have a read of:
viewtopic.php?t=6521
Mac
Code: Select all
$_SESSION['foo'] = 'bar';Code: Select all
if (!empty($_SESSION['foo'])) {
echo $_SESSION['foo'];
}viewtopic.php?t=6521
Mac
tried this
in the login script where the password is entered i used
$_session['pass'] == $password;
then in the change password file i have
($_session['pass'] != $old_passwd)
it is saying the password is wrong even though it isnt atm
$_session['pass'] == $password;
then in the change password file i have
($_session['pass'] != $old_passwd)
it is saying the password is wrong even though it isnt atm
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
yup
i will change that now, i've got the session_start() in a config file called into the pages, well the index page as all other files are called into that page.
http://www.irealms.co.uk/crimson
http://www.irealms.co.uk/crimson