pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Strange problem with session and header("Location:script.php?".SID)
2+ messages / 2 participants
[nested] [flat]

* Strange problem with session and header("Location:script.php?".SID)
@ 2003-05-06 08:42 Andrei Verovski (aka MacGuru) <andreil1@mail.starlett.lv>
  2003-05-06 09:13 ` Re: Strange problem with session and header("Location:script.php?".SID) Victor Yegorov <viy@nordlb.lv>
  0 siblings, 1 reply; 2+ messages in thread

From: Andrei Verovski (aka MacGuru) @ 2003-05-06 08:42 UTC (permalink / raw)
  To: pgsql-php

Hi,

I have very strange problem with sessions (it is not directly related 
to postgres, although I am using pgsql in my app).

There is a class MyApp which does certain jobs, and instance of this 
class (not shown here). In function OpenMainPage() I have started 
session, assigned name to it and registered certain variables.
file: MyApp.php

class MyApp {

	// --- MORE STUFF HERE

     function OpenMainPage()
     {
         $res = $this -> mDb -> Execute('SELECT * FROM contacts');
         if ($res -> RecordCount() == 0)
             $this -> SetupDefaultDBRecords();

         session_start();
         session_name('MyApplicationSession');

         $aaa = "blah blah blah";
         if (! session_register("aaa"))
             echo "failed to register variable";

         header("Location:StartupPage.php?".SID);
	}
}

----------------------------------------------

Then I would like to pass the control to script called StartupPage.php 
using header("Location:StartupPage.php?".SID).

file StartupPage.php

//include_once('anvgwg_session_start.php');
session_start();

echo session_name();  // prints PHPSESSION or something like this

echo $_SESSION["aaa"]; // prints nothing

----------------------------------------------

However, session seem to be terminated, although I have used SID. I 
have tried to move         session_start(); 
session_name('MyApplicationSession') to the first script where the 
instance of MyApp class have been created and used, but the result is 
the same. I have checked PHP options (default install of PHP 4.2.3 and 
Apache2 on SuSE Linux 8.2), enable-trans-sid and track-vars options are 
on, so it should work. Quite strange, but {echo SID} prints nothing, 
although { echo session_ID() } prints long cryptic string. I have some 
other PHP programs installed on my server, but they working without 
problem header("Location:script.php?".SID) without cookies (my app 
should work without cookies enabled in browser).

Anyone have an idea what is wrong?

Thanks in advance for any suggestion.


*********************************************
*   Best Regards   ---   Andrei Verovski
*
*   Personal Home Page
*   http://snow.prohosting.com/guru4mac
*   Mac, Linux, DTP, Development, IT WEB Site
*********************************************




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Strange problem with session and header("Location:script.php?".SID)
  2003-05-06 08:42 Strange problem with session and header("Location:script.php?".SID) Andrei Verovski (aka MacGuru) <andreil1@mail.starlett.lv>
@ 2003-05-06 09:13 ` Victor Yegorov <viy@nordlb.lv>
  0 siblings, 0 replies; 2+ messages in thread

From: Victor Yegorov @ 2003-05-06 09:13 UTC (permalink / raw)
  To: Andrei Verovski (aka MacGuru) <andreil1@mail.starlett.lv>; +Cc: pgsql-php

* Andrei Verovski <andreil1@mail.starlett.lv> [06.05.2003 12:06]:
> Hi,
> 
> I have very strange problem with sessions (it is not directly related 
> to postgres, although I am using pgsql in my app).

It's still off-topic.

>         header("Location:StartupPage.php?".SID);

I think in PHP you should use $SID, not just SID.
In your case SID is changed to string "SID" (default behaviour, may differs
in different versions of PHP). In such cases  PHP generates warnings.

May be should change error reporting level during debug stage:

error_reporting(E_ALL);

Hope that helps.

-- 

Victor Yegorov

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-05-06 09:13 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-05-06 08:42 Strange problem with session and header("Location:script.php?".SID) Andrei Verovski (aka MacGuru) <andreil1@mail.starlett.lv>
2003-05-06 09:13 ` Victor Yegorov <viy@nordlb.lv>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox