Hi,
I think I can give you a few pointers.
I am pretty sure that if you register session variables within a function they have to be made global.
You are registering your session variables after they are given values, but I think that you have to register them first.
Within a function try something like this:
// if row exists - login/pass is correct
//have to register as globals from within a function!
global $SESSION_USERID;
global $SESSION_USERPERM;
global $SESSION_USERNAME;
global $SESSION_SECURITY_ID;
// initiate a session
session_start();
// register the user's ID and permission level
session_register("SESSION_USERID");
session_register("SESSION_USERPERM");
session_register("SESSION_USERNAME");
list($userid, $userperm, $username) = mysql_fetch_row($result);
$SESSION_USERID = $userid;
$SESSION_USERPERM = $userperm;
$SESSION_USERNAME = $username;
//set up some security id, random number type thing
$current_time = time();
$random_string = $random_salt . $current_time;
$security_id = md5($random_string);
$SESSION_SECURITY_ID = $security_id ;
session_register('SESSION_SECURITY_ID');
from outside a function it would be something like this:
// initiate a session
session_start();
// register the user's ID and permission level
session_register("SESSION_UID");
session_register("SESSION_UPERM");
session_register("SESSION_UNAME");
list($uid, $uperm, $uname) = mysql_fetch_row($result);
$SESSION_UID = $uid;
$SESSION_UPERM = $uperm;
$SESSION_UNAME = $uname;
I cut and pasted part of this so they are not exactly the same variables that you used.
I haven't tried session superglobals yet so I don't know if that changes things.
HTH