...

View Full Version : session not recognised



rpjd
04-20-2011, 02:51 PM
In my login script I have assigned

session_start();
$_SESSION['Username'] = $Username;

On my webpage I have

$session_start();
echo $_SESSION['Username'];
However, I am getting undefined index Username.
These are my session settigns as per phpinfo. Don't know where to start.
Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path E:/wamp/tmp E:/wamp/tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 0 0
Any help appreciated.

Fumigator
04-20-2011, 03:20 PM
If that's your actual code then you need to remove the dollar sign from in front of the call to session_start().

abduraooft
04-20-2011, 03:20 PM
In my login script I have assigned
Are you sure that the session segment in your login script gets executed?

rpjd
04-20-2011, 04:49 PM
The login password was the same as the password on file but nothing was happening. The problem seemingly was the Password field in my passwords table. The max length of password at registration is 10 characters, which is the same as the length of the password field in the passwords table. However, the MD5 of the Password creates a 32 character string, but I was only seeing the first 10 characters of the string in the table due to the field length. So, even though the original version of the passwords matched, the MD5 comparison was failing as 10 characters didn't match 32 characters. Realised the problem after comparing the MD5 of login password to the password in the passwords table. After changing the password field length to accomodate, its working now, user name is displaying on the webpage.

tangoforce
04-21-2011, 01:49 PM
The login password was the same as the password on file but nothing was happening. The problem seemingly was the Password field in my passwords table.


If that's your actual code then you need to remove the dollar sign from in front of the call to session_start().



On my webpage I have

$session_start();

That $ sign is nothing to do with your passwords, md5 hashes, field lengths etc. It is just incorrect programming.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum