Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Apr 2007
    Posts
    123
    Thanks
    1
    Thanked 0 Times in 0 Posts

    session not recognised

    In my login script I have assigned
    PHP Code:
    session_start();
    $_SESSION['Username'] = $Username
    On my webpage I have
    PHP Code:
    $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.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    If that's your actual code then you need to remove the dollar sign from in front of the call to session_start().

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,866
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    In my login script I have assigned
    Are you sure that the session segment in your login script gets executed?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    Regular Coder
    Join Date
    Apr 2007
    Posts
    123
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,479
    Thanks
    63
    Thanked 538 Times in 525 Posts
    Quote Originally Posted by rpjd View Post
    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.
    Quote Originally Posted by Fumigator View Post
    If that's your actual code then you need to remove the dollar sign from in front of the call to session_start().
    Quote Originally Posted by rpjd View Post
    On my webpage I have
    PHP Code:
    $session_start(); 
    That $ sign is nothing to do with your passwords, md5 hashes, field lengths etc. It is just incorrect programming.
    I can't really think of anything to write here now...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •