[PHP] Close persistent db-Connection

2001-03-12 Thread Carola Meyberg

I cannot find out how I can manually close a persistent
Postgres Database Connection that has been established by
pg_pconnect.
I believe pg_close only closes non-persistent connections.

Does anyone know how to do this?


-- 
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] Session, cookies not allowed, ssl

2001-03-02 Thread Carola Meyberg

Hello everybody,

I am fairly new to php and have the following problem:

I wrote an application that uses sessionhandling. I will enclose parts
of the code below.
It runs fine under Netscape 4.74, or Explorer 5 and also under other
Browsers.
Problems arise under Netscape 4.6 when cookies are not allowed.

When I ask for the startpage, only one of three parts of a frame
appears, and disappears again,
and another part of the frame is briefly displayed and disappears again.
It keeps flickering and doesnt stop.
I have also seen a browser where it was flickering a few seconds but
then finally the
page was properly displayed. I thought that was because PHP seems to set
cookies, but if that doesnt
work it uses its own sessionmanagement. 
Something seems to go wrong in our case.
My boss thinks our problem has something to do with cookies,
as it runs fine as long as cookies are enabled. It also runs fine if we
order it via https (SSL).

Do you have any clue what could go wrong and how I could try to fix
it???
Why does it work with SSL?

I hope I have been precisely enough in describing my problem. I tried as
hard as I could ;-)
If not please ask for more information.

Thank you very much for your help!


Here is part of the code:

The following function is called on top of every page that I wrote by 
?php

top_of_page(getenv("SCRIPT_FILENAME"));

?
HTML and the rest of html and php-Code.



function top_of_page($page_name, $db_persistent_connection = true,
$redirect = true)
{
/*
Error reporting
*/
error_reporting(255);

global $db, $sess_rolle, $sess_ben_id, $QUERY_STRING;

/*
QUERY_STRING 
*/
build_query_string();


/*
free $page_name from path
*/
$page_name = basename($page_name);

/*
Headers to prevent page from being cached
*/
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");// Date in the
past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header ("Cache-Control: no-cache, must-revalidate");  //
HTTP/1.1
header ("Pragma: no-cache");  // HTTP/1.0

/*
Set PHP Options
*/
ignore_user_abort(TRUE);

/*
Open Handle to DB (PostgreSQL)
*/
if ($db_persistent_connection)
{   @$db=pg_pconnect("dbname=license port=5432 user=postgres
password=a73hui09w"); }
else
{   @$db=pg_connect("dbname=license port=5432 user=postgres
password=a73hui09w"); }
if (!$db)
{
/*
redirect client to error page
if connect was not successful
*/
header("Location: ../error/db_err.html");
return TRUE;
}

/*
Start Session
ALERT! If browser rejects all cookies, 
the server only returns empty documents.
*/
@session_start();
if (!session_is_registered("sess_rolle"))
{
/*
New session! goto index page!
*/
$sess_rolle=-1;
session_register("sess_rolle");
$sess_ben_id=-1;
session_register("sess_ben_id");
$sess_message="";
session_register("sess_message");

writeLog("utils.inc.php", "session started", true);


if ($page_name!="index.php" and $redirect)
{
header("Location: index.php?" . SID);
exit;
}   
}   

--


-- 
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]