I am wondering if it is possible to let two or more scripts share a common session id ? I am guessing not, but would like to be proved wrong.
This is the situation cut down about as small as I could make it. Five files: index.php, login-form.inc, frames.inc, left.php, main.php index.php ----- <? session_name('cesh'); session_start(); $function = $_POST['function']; if (!isset($function) || $function='') { include "login-form.inc"; die; } //test, user always valid function validuser () { return true; } if ($function == 'login') { if (!validuser($_POST['user'], $_POST['pass'])) { include "login-form.inc"; die; } } $_SESSION['user'] = $user; $_SESSION['foo'] = 'bar'; include "frames.inc"; ?> ----- login-form.inc ----- <html><body> <form method=POST> user <input type=text name=user><br> pass <input type=text name=pass><br> <input type=submit value=Login> <input type=hidden name=function value=login> </body></html> <? die; ?> ----- frames.inc ----- <? // get var used to pass session id to left and main scripts $sid = SID; $src = <<<EOF <frameset cols="350,*" rows="*" frameborder="1"> <frame src="left.php?$sid" name="left" frameborder="1"> <frame src="main.php?$sid" name="main" frameborder="1"> <noframes> <body bgcolor="#FFFFFF"> <p>phpMyAdmin is more friendly with a <b>frames-capable</b> browser.</p> </body> </noframes> </frameset> EOF; $src = str_replace("\n", "", split ( "\n", $src )); ?> <html> <script type="text/javascript"> <!-- <? foreach ($src as $line) { echo "document.writeln('${line}');\n"; } ?> //--> </script> <noscript> <? foreach ($src as $line) { echo ${line} . "\n"; } ?> </noscript> </html> ----- left.php ----- <html><body> Left<br> Is it possible to access (read/write/set/unset) the variables of session <?=$_GET['cesh']?><br> ? </body></html> ----- main.php ----- <html><body> Main<br> Is it possible to access (read/write/set/unset) the variables of session <?=$_GET['cesh']?><br> ? </body></html> ----- -- Richard A. DeVenezia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php