RE: [PHP] Strange session id problem - code is issuing a new one randomly
| From: | Dan Harrington | Date: | Thu, 15 Aug 2002 01:34:27 +0000 |
| Subject: | RE: [PHP] Strange session id problem - code is issuing a new one randomly | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112643@lists.php.net to get a copy of this message | ||
I'm having the same problem from time to time as well.
Just straight up out of the blue it gives you a new SESSION id.
--I'm interested to know what version of PHP you are using
and what web server and its version too.
Thanks
Dan
> -----Original Message-----
> From: Thoenen, Peter Mr. EPS
> [mailto:Peter.Thoenen@bondsteel2.areur.army.mil]
> Sent: Wednesday, August 14, 2002 7:34 PM
> To: php-general@lists.php.net
> Subject: [PHP] Strange session id problem - code is issuing a new one
> randomly
>
>
>
>
> # START CODE SNIPPET ... COMMENTS BELOW (and yes I am not a db guru by
> anymeans, might be easier ways to do this)
>
> <?php
> session_start();
> $tsid=session_id();
> echo $tsig; # <--------debug
> $date=date("ymdHi");
> $connect=mysql_pconnect('localhost', 'user', 'pass');
> mysql_select_db('db', $connect);
> $queryexe=mysql_query("SELECT user, ip, dtg FROM tmp WHERE sid='$tsid'");
> $row=mysql_fetch_array($queryexe);
> extract($row);
> $id='';
> $status='';
> mysql_select_db('a_db', $connect);
> $queryexe=mysql_query("SELECT site, camp FROM users WHERE user='$user'");
> $row=mysql_fetch_array($queryexe);
> extract($row);
> mysql_select_db('cbs_tech', $connect);
> extract($_GET);
> extract($_POST);
> switch ($site){
> case 'cbs':
> switch ($_SERVER['REQUEST_METHOD']){
> case 'POST':
> switch ($user){
> case 'allenr':
> break;
> default:
> switch ($status){
> case 1:
> $queryexe=mysql_query("SELECT event FROM log WHERE
> id=$id");
> $row=mysql_fetch_array($queryexe);
> extract($row);
> $queryexe=mysql_query("UPDATE log SET event='$event' WHERE
> id=$id");
> header('Location:
> https://example.org');
> die;
> }
> break;
>
> Now this is where I have issues. The header ('Location:
> https://example.org') works as it is suppose to BUT!!! a
> new SID is issued.
> Thought the SID stayed w/ the browser until it was closed. When I loop back
> through I of course can not find the previous SID as a new one was created.
> Is it because I am going POST-->GET (seems to work with GET-->GET or
> GET-->POST)
>
> Any ideas why a new one is being created? (and don't say start_session() ...
> this is a long script and the ONLY place it has issues is when I am
> processing a $POST (works fine for all the $GETS))
>
> Thank in advance,
>
> -Peter
>
>
> ##################################
> Peter Thoenen - Systems Programmer
> Commercial Communications
> Camp Bondsteel, Kosovo
> ##################################
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>