> > something else after the initial page everything works fine. I > > require this > > to work initially because if someone comes in directly using a > > link certain > > content will render a error message because the registered > variable is not > > present for some reason. Oh and yes the cookie to set the > session is being > > put on the client's machine properly and at the initial page.
> When do you set the session cookie? Keep in mind cookies > don't not function > in the same call they are created ....so say you create the > cookie on page > A, until the user refreshes page A or goes to page B the cookie won't > actually be in effect. Well the cookie is set at the start of the PHP file that gets referenced each time. I'm not setting any manual cookies just using the default session cookie set by PHP. Below is all the code I use for the session. Formatting is kind of goofed up in e-mail but it's there. So even though the cookie is placed in the client's browser it's not used/session is not used or recognized until you refresh/reload or go to another page?? -- Code Snippet -- session_name("sid"); $nSession = session_start(); if(isset($REMOTE_USER)) { if(!$nSID_PeopleID) { $szQuery = "SELECT WebAccounts.People_ID, WebAccounts.Security_Level, People.Status_Type_ID, Company.Company_Status_ID FROM WebAccounts, People, Company WHERE WebAccounts.People_ID=People.People_ID AND People.Company_ID=Company.Company_ID AND User_Name='$REMOTE_USER'"; $szDBConn = mysql_connect("server_address","user_name","password") or die("could not connect to server for security authentication."); mysql_select_db("venmar", $szDBConn) or die("could not connect to venmar for security // authentication."); $saResults = mysql_query($szQuery, $szDBConn) or die ("could not query venmar for security authentication."); $obResults = mysql_fetch_row($saResults); $nSID_PeopleID = $obResults[0]; $nSID_SecurityLevel = $obResults[1]; $nSID_PeopleStatus = $obResults[2]; $nSID_CompanyStatus = $obResults[3]; $szQuery1 = "SELECT PeopleMailing.Country_ID FROM PeopleMailing, WebAccounts WHERE WebAccounts.People_ID=PeopleMailing.People_ID AND WebAccounts.User_Name='$REMOTE_USER'"; $dbConnection = mysql_connect("server_address", "user_name", "password") or die("could not connect to server for security authentication."); mysql_select_db("venmar", $szDBConn) or die("could not connect to venmar for security authentication."); $saResults1 = mysql_query($szQuery1, $szDBConn) or die ("could not query venmar for security authentication."); $obResults1 = mysql_fetch_row($saResults1); $nSID_Country = $obResults1[0]; if(!$obResults1[0]) { $szQuery1 = "SELECT Company.Country_ID FROM Company, WebAccounts, People WHERE WebAccounts.People_ID=People.People_ID AND People.Company_ID=Company.Company_ID AND WebAccounts.User_Name='$REMOTE_USER'"; $saResults1 = mysql_query($szQuery1, $szDBConn) or die ("could not query venmar for security authentication (24)."); $obResults1 = mysql_fetch_row($saResults1); $nSID_Country = $obResults1[0]; } mysql_close(); if($obResults[2] == 1 && $obResults[3] == 1) { if($nSession == 1) { session_register("nSession"); session_register("nSID_PeopleID"); session_register("nSID_SecurityLevel"); session_register("nSID_PeopleStatus"); session_register("nSID_CompanyStatus"); session_register("nSID_Country"); $szQuery = "SELECT First_Login, Last_Login, Creation_Date FROM WebAccounts WHERE User_Name='$REMOTE_USER'"; $dbConnection = mysql_connect("server_address", "user_name", "password") or die("could not connect to server for security authentication."); mysql_select_db("venmar", $dbConnection) or die("could not connect to venmar for security authentication."); $saResults = mysql_query($szQuery, $dbConnection) or die ("could not query venmar for security authentication."); $obResults = mysql_fetch_row($saResults); if($obResults[0] == 00000000000000) { $FirstLoginDate = date("YmdHis"); $szQuery = "UPDATE WebAccounts SET First_Login='$FirstLoginDate' WHERE User_Name='$REMOTE_USER'"; mysql_select_db("venmar", $dbConnection) or die("could not connect to venmar for security authentication."); $saResults = mysql_query($szQuery, $dbConnection) or die ("could not query venmar for security authentication."); } $nLastLoginDate = date("YmdHis"); $szQuery = "UPDATE WebAccounts SET Last_Login='$nLastLoginDate', Creation_Date='$obResults[2]', Total_Logins=(Total_Logins + 1) WHERE User_Name='$REMOTE_USER'"; mysql_select_db("venmar", $dbConnection) or die("could not connect to venmar for security authentication."); $saResults = mysql_query($szQuery, $dbConnection) or die ("could not query venmar for security authentication."); mysql_close(); } else { echo "starting session failed.\n\n"; include("/var/www/htdocs/venmar/errors/403.php"); } } else { echo "denied access\n\n"; include("/var/www/htdocs/venmar/errors/403.php"); } } $GLOBALS [ "host" ] = "venmar"; $GLOBALS [ "indexpg" ] = "index.php"; $GLOBALS ["REMOTE_USER"]; $GLOBALS ["nSecurityLevel"]; $GLOBALS ["szBodyHeader"]; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php