[phplib] page_open() - weird behavior !! From: Mikhail Avrekh (ami <email protected>)
Date: 08/07/00

Hello,

I already sent out an email about this last week, and I've done some more
digging around since then, so I hope that this time I can be more specific
about the problem and hopefully someone can help me out with this...

Here's the script:

<?
$count = 0;
$auth = new DB_Sql;
$auth->query("select * from table where pwd='$pwd' and id='$id'");

$count=1;
if ($auth->next_record()) {
$count=2;
        page_open(array("sess"=>"My_Session"));
        $sess->register("id");
        page_close();
        print $count;
} else {
        print "Your password is not in the database";
        exit;
}

?>

$count, obviously, has no functional significance; I only put it in for
debugging purposes. ANyway, there is a login page where users enter their
id and password and which calls this script, with $id and $pwd in
HTTP_POST_VARS. However, on the first pass (when the Session_id cookie is
not set) they *always* get the "Your password is not in the
database" error (and $count returns 1). However, if they use the Back
button to go back to the login page and re-enter everything, it works !

Also, when I turn on $auth->Debug, on the first pass I see that the select
searches on empty values ("select * from table where pwd='' and
id=''"), which of course causes the } else { to be executed and returns an
error. On the second pass, however, the correct values are in the
statement !

I really don't know what's going on here, but I suspect that
page_open() does something that destroys $HTTP_POST_VARS.

ANy hints on this would be greatly appreciated, and thanks for reading
this long email :)

M.

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>