Hi all, I've pulled my hair out on this, so I'm turning to the experts.
I'm trying to make a directory of a site password protected: http://www.ivepulledmyhairout.com/protected I'm getting there from: http://www.ivepulledmyhairout.com I've got a login.php page that gets a username and password from dear valued users It then posts that info to checklogin.php: I'm using an older version of php 4.03 (please don't ask). checklogin code ------------------------------------------- <? session_start(); $connect=mysql_connect($bshostname,$bsusername,$bspassword); $thedb=mysql_select_db($bsdatabase); $thequery="select * from customer_acct_info where customer_password='$dealer_password' "; $thequery.=" and customer_username='$dealer_username'"; //query database based on submitted form vars.. $theresults=mysql_query($thequery) or die (mysql_error()); $row_count=mysql_num_rows($theresults); $dealer_info=mysql_fetch_assoc($theresults); if ($row_count!=0) { session_register('wholesaler'); $HTTP_SESSION_VARS['wholesaler']=$dealer_info; header("Location:protected/index.php"); } else { header("Location:login.php"); } ?> ------------------------------------------ Once it goes to the protected directory, that directory's index page checks for the existence of that session var, if it doesn't find it, it jumps you back to the login screen. index.php of protected directory: <? session_start(); header("Cache-control: private"); if (isset($HTTP_SESSION_VARS['wholesaler'])) { require('manage/bsinclude.inc'); require('manage/bsmenus.inc'); include ($bstemplate); } else { header("Location:../index.php?catcont=login"); } ?> No matter what I do, I can't get the session variable to survive the transition from the checklogin.php page, to the index.php page of the protected directory! On the checklogin.php page, instead of redirecting, i've tried print_r($HTTP_SESSION_VARS) after setting the session I need, and it seems to be there no problem. If someone has been willing to read thru this tome, and can be of any help, I'd truly appreciate it. Other questions re: sessions: If you have a page that looks like <? session_start(); include 'bla.php'; include 'bla2.php'; ?> and you need to check for the exisistence of session data on the included pages, do you have to include session_start(); commands on the included pages? Can you: session_start(); $HTTP_SESSION_VARS['bla']="bla" or do you have to session_start(); session_register('bla'); $HTTP_SESSION_VARS['bla']="bla" And: Does using something header("Location:bla.php") screw up sessions somehow, even if you start the destination page with session_start() ? Kelly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php