NYCPHP Meetup

NYPHP.org

[nycphp-talk] retro php

Kenneth Dombrowski kenneth at ylayali.net
Tue Oct 14 11:42:22 EDT 2003


on page 1, index.php

        $HTTP_SESSION_VARS['S_user_id']      = $rs['user_id'];
        $HTTP_SESSION_VARS['S_login_name']   = $rs['login'];
        $HTTP_SESSION_VARS['S_company_id']   = $rs['company_id'];
        $HTTP_SESSION_VARS['S_user_email']   = $rs['email'];

& the include file menu item works

 <A HREF="issuelist.php?assign_user_id=<?=
 $HTTP_SESSION_VARS['S_user_id'] ?>">my assigned issues</A><br>

print_r($HTTP_SESSION_VARS) produces

Array
(
    [S_user_id] => 33
    [S_login_name] => kenneth
    [S_company_id] => 0
    [S_user_email] => kenneth at ylayali.net
)


follow that link above to issuelist, though and this always redirects me
back to index.php:

    if (!$HTTP_SESSION_VARS['S_user_id'] > 0) {
        header ('Location: ' . $loginpage . '?log_er=s1');
        exit;
    }

I commented out the header & exit lines & sure enough, the print_r
statement produces an empty Array(). Comparing PHPSESSID from
$HTTP_COOKIE_VARS on each page shows they are the same 


I tried dozens of increasingly stupid things trying to figure out why
early into the morning with no luck, it just has to be some simple
little thing..


> Also, http://php.net/session_register says:
> vvvvvvvvvv
> If you are using $_SESSION  (or $HTTP_SESSION_VARS), do not use 
> session_register(), session_is_registered(), and session_unregister().
> 

Actually, this is how I got involved with this. I began to notice
extremely bizarre results on our 4.2.2 development server after I began
using $_SESSION syntax while the existing code was using
session_register. I converted everything over to superglobals & took out
all the session_register, session_unregister & session_is_registered
stuff & the pages began to display properly again. I wasn't 100% sure of
the "or $HTTP_SESSION_VARS" part though, so thanks for clarifying that.


from phpinfo:

session
Session Support enabled

Directive   Local Value Master Value
session.auto_start
    Off Off
session.cache_expire
    180 180
session.cache_limiter
    nocache nocache
session.cookie_domain
    no value    no value
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_maxlifetime
    1440    1440
session.gc_probability
    1   1
session.name
    PHPSESSID   PHPSESSID
session.referer_check
    no value    no value
session.save_handler
    files   files
session.save_path
    /tmp    /tmp
session.serialize_handler
    php php
session.use_cookies
    On  On


Thanks again,
Kenneth




More information about the talk mailing list