Re: [PHP] Postgresql session handling

2001-02-22 Thread Bolt Thrower

I <[EMAIL PROTECTED]> wrote:

> It seems the pgsql_session_write() function is not even being invoked.
> Here it is:

As a followup, it seems that turning register_globals "on" allows the
pgsql_session_write() function to be called, and my test script works
if I replace $HTTP_SESSION_VARS["count"] with $count.  However, my
environment is such that I have register_globals "off", which seems
to conflict with sessions.  In fact, I even get a
Undefined variable:  HTTP_SESSION_VARS
error for the line 
$HTTP_SESSION_VARS["count"]++;

Can someone give me a simple example script that uses postgres session
handling, that works with register_globals "off"?  

Thanks,

-- 
Steve <[EMAIL PROTECTED]>
"And when you walk in golden halls, you get to keep the gold that falls"
-- Black Sabbath, "Heaven and Hell"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Postgresql session handling

2001-02-26 Thread Bolt Thrower

I <[EMAIL PROTECTED]> wrote:
> Can someone give me a simple example script that uses postgres session
> handling, that works with register_globals "off"?  


As a followup again, it seems what I've been running into is a bug
in PHP:
http://bugs.php.net/bugs.php?id=8772
http://bugs.php.net/bugs.php?id=9002

So, hopefully, someday, it will be fixed. 
-- 
Steve <[EMAIL PROTECTED]>
Now playing: Moon and Sun Part II: North's Son
(Amorphis - "Black Winter Day")

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Postgresql session handling

2001-02-20 Thread Bolt Thrower

PHP 4.04pl1, PostgresQL 7.0.3 on a RedHat 6.2 system.

I'm trying to get session data to be stored in a
postgres table.  I'm using the pgsql session handler from
http://www.csh.rit.edu/~jon/projects/php/pgsql_session_handler/, and I
think I've got it set up correctly, but I thought I'd ask here first.
With the following test script

+-
| 
| 
| 
| 
| Test page
| 
| 
| Hello!  You've been here  times!
| 
| click here"; ?>
| 
| 
| 
+-

I can see php querying the database for session data (in the postgres
logs), but never writing session data to the database.  Thus, the
counter is always '1'.

Any ideas where I'm going wrong?  Why wouldn't session data get
written to the database?

Thanks,
-- 
Steve <[EMAIL PROTECTED]>
Now playing: Five Magics
(Megadeth - "Rust In Peace")

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Postgresql session handling

2001-02-20 Thread Bolt Thrower

"Richard Lynch" <[EMAIL PROTECTED]> wrote:
> The writing of the session data occurs *after* the server-browser HTTP
> connection is cut.

> If you have any error-reporting happening in your session_write function,
> you won't see it.

> Alter that function to log errors to a file or something.

It seems the pgsql_session_write() function is not even being invoked.
Here it is:

+-
| function pgsql_session_write($key, $val)
| {
|   /* debugging */
|   $fp = fopen("/tmp/phpdebugwrite","w") or die ("can't open file");
| fwrite($fp, "HERE");
| fclose($fp);
|   /* end debug */
| 
| global $pgsql_session_handle, $pgsql_session_table;
| 
| $key = addslashes($key);
| $val = addslashes($val);
| $now = time();
| 
| 
| 
| /*
|  * Delete any existing data for this session and then insert a new row
|  * containing the current session data, all in a single transaction.
|  * This should prevent collisions between multiple session instances.
|  *
|  * Thanks to "Will Fitzgerald" <[EMAIL PROTECTED]>.
|  */
| $query = 'begin; ';
| $query .= "delete from $pgsql_session_table where session_id = '$key'; ";
| $query .= "insert into $pgsql_session_table values('$key', $now, '$val'); ";
| $query .= 'commit;';
| $result = @pg_exec($pgsql_session_handle, $query);
| 
| $ret = (pg_cmdtuples($result) == 0);
| pg_freeresult($result);
| 
| return ($ret);
| }
+-

I've added the debugging statements at the top.  Can you see anything
wrong with this function?  At the end of the include file in which
this appears, is the session_set_save_handler() call:

session_set_save_handler(
'pgsql_session_open',
'pgsql_session_close',
'pgsql_session_read',
'pgsql_session_write',
'pgsql_session_destroy',
'pgsql_session_gc'
);


Thanks,
-- 
Steve <[EMAIL PROTECTED]>
"And when you walk in golden halls, you get to keep the gold that falls"
-- Black Sabbath, "Heaven and Hell"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]