Re: [PHP] session_destroy AND reload a page

2007-11-26 Thread Philip Thompson
On Nov 26, 2007 12:45 AM, Chris [EMAIL PROTECTED] wrote:

 Ronald Wiplinger wrote:
  If my user wants to logout, I want that the session will be destroyed
  and that he must start with the first page again (index.php) and a new
  session.
 
  Whatever I try he always gets the old sessions or he does not come to
  the first page.

 What code do you have?



A very crude way to do this

$_SESSION = array();

However, this will destroy EVERY variable within the session. This is bad if
you have multiple sites on one server. To organize your session variables,
you may try storing them as..

$_SESSION['aSiteName']['is_logged_in'],
$_SESSION['aSiteName']['var1'], $_SESSION['aSiteName']['var2'],
etc

To destroy all variables within this site ('aSiteName' being this example),
do...

$_SESSION['aSiteName'] = array();

OR

unset ($_SESSION['aSiteName']);

HTH
~Philip


Re: [PHP] session_destroy AND reload a page

2007-11-25 Thread Chris

Ronald Wiplinger wrote:

If my user wants to logout, I want that the session will be destroyed
and that he must start with the first page again (index.php) and a new
session.

Whatever I try he always gets the old sessions or he does not come to
the first page.


What code do you have?

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session_destroy

2006-04-20 Thread Richard Lynch
On Wed, April 19, 2006 9:11 am, Paul Waring wrote:
   setcookie(session_name(), '', (time() - 86400), /);

/ should be in quotes or apostrophes.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_destroy

2006-04-19 Thread Peter Hoskin

Should not make any difference. Try it instead of posting.

Regards,
Peter Hoskin

Shannon Doyle wrote:

That’s just it,

I am not setting a session cookie.

Just starting a session with the following :-


session_name(XPCSESS);
session_start();
$sessID = session_id();


  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] session_destroy

2006-04-19 Thread tedd

At 12:51 PM +0930 4/19/06, Shannon Doyle wrote:

That’s just it,

I am not setting a session cookie.

Just starting a session with the following :-

session_name(XPCSESS);
session_start();
$sessID = session_id();


Try:

?php session_start();
session_name(XPCSESS);
$sessID = session_id();

Note, session_start() is the first statement before anything else.

Also note that session ID is automatically SID, such as:

echo(SID);

tedd
--

http://sperling.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_destroy

2006-04-19 Thread Martin Alterisio \El Hombre Gris\
It doesn't matter, PHP decides automatically which is the best method to 
make a session persist. If it founds that the client allows cookies, 
cookies are used. If such method is not available, the session id is 
writen to every url through an output buffer with an url rewriting 
filter. There was another method before using the url rewriting but I 
forgot, check the manual.


Shannon Doyle wrote:


That's just it,

I am not setting a session cookie.

Just starting a session with the following :-


session_name(XPCSESS);
session_start();
$sessID = session_id();



-Original Message-
From: Martin Alterisio El Hombre Gris [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 19 April 2006 12:36 PM

To: Peter Hoskin
Cc: Shannon Doyle; php-general@lists.php.net
Subject: Re: [PHP] session_destroy

That's exactly what the manual says.
session_destroy() doesñ't clean the session cookie (if one is used), 
that's probably why your session persists.


Peter Hoskin wrote:

 

I've also had this issue from time to time. Used the following to 
destroy it under all circumstances.


  if (isset($_COOKIE[session_name()])) {
  setcookie(session_name(), '', time()-42000, '/');
  }
  session_destroy();

Shannon Doyle wrote:

   


Hi People,

Trying to get a session to destroy correctly, however the darn thing 
just
refuses to destroy. I call the following in a separate webpage in a 
effort

to destroy the session, only to find that the session still persists.

?php
session_start();
session_unset();
session_destroy();
Header(Location: index.php);
?


Any help would be appreciated.

Cheers,

Shannon

 
 

   



 



Re: [PHP] Session_destroy

2006-04-19 Thread Paul Waring
On 19/04/06, Shannon Doyle [EMAIL PROTECTED] wrote:
 Trying to get a session to destroy correctly, however the darn thing just
 refuses to destroy. I call the following in a separate webpage in a effort
 to destroy the session, only to find that the session still persists.

 ?php
 session_start();
 session_unset();
 session_destroy();
 Header(Location: index.php);
 ?

First of all, if you're using $_SESSION or $HTTP_SESSION_VARS, the PHP
manual will tell you to use unset($_SESSION['key']) rather than
session_unset(). Personally though, I've found the following code
works well for completely destroying a session:

?php

$_SESSION = array(); // clear all the session variables (don't use
unset($_SESSION))

// clear the session cookie if it exists
if ( isset($_COOKIE[session_name()]) )
{
setcookie(session_name(), '', (time() - 86400), /);
}

session_destroy();

?

Also, when using redirects, you should specify the complete absolute
URL, not a relative one. You can sometimes get away with using a
relative one but it's bad practice and breaks section 14.30 of RFC
2616 (the HTTP/1.1 specification).

Paul

--
Data Circle
http://datacircle.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session_destroy

2006-04-19 Thread chris smith
On 4/19/06, Shannon Doyle [EMAIL PROTECTED] wrote:
 Hi People,

 Trying to get a session to destroy correctly, however the darn thing just
 refuses to destroy. I call the following in a separate webpage in a effort
 to destroy the session, only to find that the session still persists.

 ?php
 session_start();
 session_unset();
 session_destroy();
 Header(Location: index.php);
 ?

What's in index.php?

Try giving the session a name (see http://www.php.net/session_name)
and see what happens.

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_destroy

2006-04-19 Thread Jochem Maas

Shannon Doyle wrote:

Hi People,

Trying to get a session to destroy correctly, however the darn thing just
refuses to destroy. I call the following in a separate webpage in a effort
to destroy the session, only to find that the session still persists.

?php
session_start();
session_unset();
session_destroy();
Header(Location: index.php);
?


Any help would be appreciated.


I looked into really nuking a session quite a while back
and after searching around and scraping together some snippets of
code I came up with this:

?php

function destroySession($delSessFile = false)
{
// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
   $CookieInfo = session_get_cookie_params();
   if ( (empty($CookieInfo['domain']))  (empty($CookieInfo['secure'])) ) {
   setcookie(session_name(), '', time()-3600, $CookieInfo['path']);
   } elseif (empty($CookieInfo['secure'])) {
   setcookie(session_name(), '', time()-3600, $CookieInfo['path'], 
$CookieInfo['domain']);
   } else {
   setcookie(session_name(), '', time()-3600, $CookieInfo['path'], 
$CookieInfo['domain'], $CookieInfo['secure']);
   }
}

// Finally, destroy the session.
session_destroy();

// go over board and actually delete the file right here and now!
if ((boolean)$delSessFile) {
$orgpath = getcwd(); /* chdir(PHP_BINDIR); */ 
chdir(session_save_path());
$path = realpath(getcwd()).'/';
if(file_exists($path.'sess_'.$id)) {
// Delete it here
unlink($path.'sess_'.$id);
}
chdir($orgpath);
}
}

?

hth

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_destroy

2006-04-18 Thread Peter Hoskin
I've also had this issue from time to time. Used the following to 
destroy it under all circumstances.


   if (isset($_COOKIE[session_name()])) {
   setcookie(session_name(), '', time()-42000, '/');
   }
   session_destroy();

Shannon Doyle wrote:

Hi People,

Trying to get a session to destroy correctly, however the darn thing just
refuses to destroy. I call the following in a separate webpage in a effort
to destroy the session, only to find that the session still persists.

?php
session_start();
session_unset();
session_destroy();
Header(Location: index.php);
?


Any help would be appreciated.

Cheers,

Shannon

  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_destroy

2006-04-18 Thread Martin Alterisio \El Hombre Gris\

That's exactly what the manual says.
session_destroy() doesñ't clean the session cookie (if one is used), 
that's probably why your session persists.


Peter Hoskin wrote:

I've also had this issue from time to time. Used the following to 
destroy it under all circumstances.


   if (isset($_COOKIE[session_name()])) {
   setcookie(session_name(), '', time()-42000, '/');
   }
   session_destroy();

Shannon Doyle wrote:


Hi People,

Trying to get a session to destroy correctly, however the darn thing 
just
refuses to destroy. I call the following in a separate webpage in a 
effort

to destroy the session, only to find that the session still persists.

?php
session_start();
session_unset();
session_destroy();
Header(Location: index.php);
?


Any help would be appreciated.

Cheers,

Shannon

  





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] session_destroy

2006-04-18 Thread Shannon Doyle
That’s just it,

I am not setting a session cookie.

Just starting a session with the following :-


session_name(XPCSESS);
session_start();
$sessID = session_id();


 
-Original Message-
From: Martin Alterisio El Hombre Gris [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 19 April 2006 12:36 PM
To: Peter Hoskin
Cc: Shannon Doyle; php-general@lists.php.net
Subject: Re: [PHP] session_destroy

That's exactly what the manual says.
session_destroy() doesñ't clean the session cookie (if one is used), 
that's probably why your session persists.

Peter Hoskin wrote:

 I've also had this issue from time to time. Used the following to 
 destroy it under all circumstances.

if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
session_destroy();

 Shannon Doyle wrote:

 Hi People,

 Trying to get a session to destroy correctly, however the darn thing 
 just
 refuses to destroy. I call the following in a separate webpage in a 
 effort
 to destroy the session, only to find that the session still persists.

 ?php
 session_start();
 session_unset();
 session_destroy();
 Header(Location: index.php);
 ?


 Any help would be appreciated.

 Cheers,

 Shannon

   



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_destroy(): Session object destruction failed

2005-10-05 Thread Dan Rossi
:| The php compile error was the subject thats what keeps being 
triggered and i get emails from my system about. Session object 
destruction failed. I have googled about this yes it was something to 
do with the session_set_cookie after session destroy which triggers 
this but no fix.


On 05/10/2005, at 5:14 PM, [EMAIL PROTECTED] wrote:


hi there, i had asked this one a while ago but no replies. I am having
this issue calling session_destroy on a non cookie session before
creating a cookie based one. Here is the code

  @session_destroy();
ini_set('session.use_cookies', 1);
session_name('thename');
session_cache_limiter('no_cache');
session_cache_expire(172800);
session_set_cookie_params (172800, '/', 'thedomain',0);
session_start();
ini_set('session.gc_maxlifetime',172800);


lemme know thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Hi there!

What is the question / problem?

/G



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_destroy(): Session object destruction failed

2005-10-05 Thread Dan Rossi
All standard apache/php4 stuff. The first session is a non cookie 
session


ini_set('session.use_cookies', 0);
session_name('sID');
session_start();
ini_set('session.gc_maxlifetime', 14440);

ill attempt the sleep(1) i guess

On 05/10/2005, at 6:36 PM, [EMAIL PROTECTED] wrote:


Hi there!

Are you running IIS? It seems to be a IIS-specific program when 
googling...


Here is My thoughts:

Can the problem be that session_use_cookies initate before all sessions
are totally destroyed? Does the code work with only session_destroy() ?

I would try to set a sleep - statement after session_destroy() and see 
if

it is any difference..

/G


:| The php compile error was the subject thats what keeps being
triggered and i get emails from my system about. Session object
destruction failed. I have googled about this yes it was something to
do with the session_set_cookie after session destroy which triggers
this but no fix.

On 05/10/2005, at 5:14 PM, [EMAIL PROTECTED] wrote:

hi there, i had asked this one a while ago but no replies. I am 
having

this issue calling session_destroy on a non cookie session before
creating a cookie based one. Here is the code

  @session_destroy();
ini_set('session.use_cookies', 1);
session_name('thename');
session_cache_limiter('no_cache');
session_cache_expire(172800);
session_set_cookie_params (172800, '/', 'thedomain',0);
session_start();
ini_set('session.gc_maxlifetime',172800);


lemme know thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Hi there!

What is the question / problem?

/G



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session_destroy() questions

2004-03-22 Thread Chris Shiflett
--- Elliot J. Balanza [EMAIL PROTECTED] wrote:
 how can i make it so that let's say one people enter my site, and
 then decides to leave... but doesn't closes the browser window,
 then come back right in and wants to do other functions in the site
 but with a different session_id()?

http://www.php.net/session_regenerate_id

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session_destroy() questions

2004-03-22 Thread John W. Holmes
Elliot J. Balanza wrote:

Ok, I know that session_destroy wont delete all my session data, but just
delete the variables with it... but for instance the session_id() will be
the same.
So my question is how can i make it so that let's say one people enter my
site, and then decides to leave... but doesn't closes the browser window,
then come back right in and wants to do other functions in the site but with
a different session_id()?
Why do they need a different session id? It shouldn't matter whether 
they come back with the same session ID or not, as the session will be 
empty (you should clear it when they log out... no real need to 
destroy it).

That being said, it is a good idea to set the session ID from within 
your program after a successful login to prevent Session Fixation 
Attacks. This is where a malicious user will include a link to your site 
with the session_name in the URL. If you then start a session, PHP will 
use the value passed in the URL. Now, instead of the session ID being a 
one-in-two-million ID, they've fixed what it should be. It's now easy 
for them to hijack the session and pretend to be the other person (a 
little work involved in that, but you get the idea, I hope).

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session_destroy causes backspace on IE

2003-10-25 Thread bill
Aha, I'm using PHP 4.1.2 with trans-sid enabled for browsers that don't 
use cookies.

Now that I know where to look, I found that putting ob_start() at the 
beginning seems to help.

kind regards,

bill

David Otton wrote:

On Fri, 24 Oct 2003 15:42:45 -0400, you wrote:

 

Tried breaking up the echo, but still didn't work.
   

What PHP version are you using? 4.10, maybe?

http://bugs.php.net/bug.php?id=14695
 



Re: [PHP] session_destroy causes backspace on IE

2003-10-24 Thread Eugene Lee
On Fri, Oct 24, 2003 at 01:24:32PM -0400, bill wrote:
: 
: The following code causes IE to break the /h1 tag.
: 
: ?php
: session_start();
: header(Cache-control: private);
: echo html
: headtitlelogout/title
: /head
: body
: h1 align=\center\Logout page/h1;
: $_SESSION = array();
: session_destroy();
: echo pSession destroyed/p\n;
: echo /body
: /html\n;
: ?
: 
: View/Source in IE: displays this (note /h1 broken):
: 
: html
: headtitlelogout/title
: /head
: body
: h1 align=centerLogout page/pSession destroyed/p
: /body
: /html
: h1
: 
: Details: Works fine in other browsers I've tried, and this version of IE 
: (5.5) does -not- have cookies enabled.

Besides tossing out IE?  :-)

Try splitting your big echo() statement into smaller pieces and see what
happens.

echo 'html'.\n;
echo 'headtitlelogout/title'.\n;
echo '/head'.\n;
echo 'body'.\n;
echo 'h1 align=centerLogout page/h1'.\n;

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_destroy causes backspace on IE

2003-10-24 Thread bill
Hi Eugene,

Tried breaking up the echo, but still didn't work.

?php
session_start();
header(Cache-control: private);
echo html;
echo headtitlelogout/title;
echo /head;
echo body;
echo h1 align=\center\Logout page/h1;
$_SESSION = array();
session_destroy();
echo pSession destroyed/p\n;
echo /body
/html\n;
?
I know it is the session_destroy() command because commenting it out the 
problem goes away.

kind regards,

bill

Eugene Lee wrote:

On Fri, Oct 24, 2003 at 01:24:32PM -0400, bill wrote:
: 
: The following code causes IE to break the /h1 tag.
: 
: ?php
: session_start();
: header(Cache-control: private);
: echo html
: headtitlelogout/title
: /head
: body
: h1 align=\center\Logout page/h1;
: $_SESSION = array();
: session_destroy();
: echo pSession destroyed/p\n;
: echo /body
: /html\n;
: ?
: 
: View/Source in IE: displays this (note /h1 broken):
: 
: html
: headtitlelogout/title
: /head
: body
: h1 align=centerLogout page/pSession destroyed/p
: /body
: /html
: h1
: 
: Details: Works fine in other browsers I've tried, and this version of IE 
: (5.5) does -not- have cookies enabled.

Besides tossing out IE?  :-)

Try splitting your big echo() statement into smaller pieces and see what
happens.
	echo 'html'.\n;
	echo 'headtitlelogout/title'.\n;
	echo '/head'.\n;
	echo 'body'.\n;
	echo 'h1 align=centerLogout page/h1'.\n;
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session_destroy causes backspace on IE

2003-10-24 Thread David Otton
On Fri, 24 Oct 2003 15:42:45 -0400, you wrote:

Tried breaking up the echo, but still didn't work.

What PHP version are you using? 4.10, maybe?

http://bugs.php.net/bug.php?id=14695

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_destroy problem

2003-01-14 Thread Tamas Arpad
On Monday 13 January 2003 18:09, Scott Fletcher wrote:
 It's no problem.  We're all very interesting in finding out what can work.

 Maybe I can help with one of this problem.  The Gecko browser does have the
 option of blocking the opening of hte unrequest window which is maybe why
 yours doesn't work in Mozilla.  Just wondeirng...
No, the setting called Open unrequested windows is turned on in my browser 
(Mozilla 1.0.1), and all other settings on that page are also turned on, so I 
don't know why window.open call doesn't work in onunload event handler.
By the way it's not a problem for me :)) I don't know if it works for the 
original poster.
I try to always avoid using javascript, I think the session expiration is 
still a better way to force logging out a visitor who forgot to click on the 
logout button.
Arpi

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-14 Thread Scott Fletcher
Me too.  I alway try to avoid javascript.  I have one workaround to the
problem that keep me from having a headache with the browser
incompatibilities.  Since I already have a table in the database that deal
with the session number, timestamp and user id.  All I have to do is to
detect the duplicate user id and check to see if if user is online for no
more than 15 minutes by checking the timestamp.  If more than 15 minutes
then I deleted the existing session id then delete the duplicate user.  When
all goes well, then I create a new session id and insert it into the
database along with the user id and a timestamp.  And I do the manual clean
up of the leftover session in the /tmp directory every few weeks.  Not what
I would like to have but there's nothing I can do about browser
incompatibilities and javascript issues.  If we're lucky, this would take 20
years or more for the problem to be fixed.

Tamas Arpad [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Monday 13 January 2003 18:09, Scott Fletcher wrote:
 It's no problem.  We're all very interesting in finding out what can work.

 Maybe I can help with one of this problem.  The Gecko browser does have
the
 option of blocking the opening of hte unrequest window which is maybe why
 yours doesn't work in Mozilla.  Just wondeirng...
No, the setting called Open unrequested windows is turned on in my browser
(Mozilla 1.0.1), and all other settings on that page are also turned on, so
I
don't know why window.open call doesn't work in onunload event handler.
By the way it's not a problem for me :)) I don't know if it works for the
original poster.
I try to always avoid using javascript, I think the session expiration is
still a better way to force logging out a visitor who forgot to click on the
logout button.
Arpi



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] session_destroy problem

2003-01-14 Thread Larry Brown
For those who don't mind working with Javascript I have found a method of
maintaining the sessions to a minimum length.  According to the Javascript
list there is no way to get the url of the site the user is going to next so
there is no way to tell if the onunload is due to a site change or the
movement from one page on your site to another.  So here is my solution...

When the user logs on they are given a code that is derived from the time of
login.  Each pages checks that the decoded number results in a time of less
than 8 hours from login.  If it is greater than 8 they are just prompted to
re-login.  There will be a database entry for each time a page is loaded by
the same user.  This time is checked periodically, every 5 minutes should
do.  If they have not loaded a page in the last 5 minutes the session is
removed.  Now, each page that does not post anything will have a refresh set
to 3 minutes so that people that have their browser set to the site in the
background while they work on other programs etc. won't get kicked off.

This has just been arrived at to solve the session destroy problem but it
looks like it will work.  I also don't know what this would do to a high
volume site either but for me it should be workable.  I hope this helps
some.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-13 Thread Scott Fletcher
Let us know how it goes...  The unload event had been tried also.  The
javascript have been running for a while but the network communication is a
bit tricky, it haven't worked well.


Víã Ãðã  [EMAIL PROTECTED] wrote in message
004701c2b90d$5de0c440$0700a8c0@sp">news:004701c2b90d$5de0c440$0700a8c0@sp...
  Yes, the JavaScript code can run before the browser is closed but it
would
  not be finish running because the browser closing had been executed.
  Someone had tried it before and struggled with it.   But that is a good
  advice, thanks for jumping in.
 I really doubt that browsers doesn't run the code that is in unload event
of
 the page because the window is closed. That would be a very bad thing.
Isn't
 it what the unload event is for? I mean to run code when the page is
 unloaded, it doesn't matter if the window is being closed or the user is
 going to another page. I think the browser should finish all the opened
 window's unload code and only after that close the application really.
 I made a quick test for it:
 html
 head
 script language=javascript
 function wait(msec){
  var enter_date = new Date();
  var enter_time = enter_date.getTime();

  var leave_date = new Date();
  var leave_time = leave_date.getTime();

  while (enter_time + msec  leave_time)
  {
   leave_date = new Date();
   leave_time = leave_date.getTime();
  }
  alert('unload test');
 }
 /script
 /head

 body onunload=wait(5000)
  unload test
 /body
 /html

 It works fine for me in ie6 and mozila 0.9.6, it shows the alert message
 after about 5 seconds.

 Arpi






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-13 Thread Tamas Arpad
On Monday 13 January 2003 15:14, Scott Fletcher wrote:
 Let us know how it goes...  The unload event had been tried also.  The
 javascript have been running for a while but the network communication is a
 bit tricky, it haven't worked well.
Sorry, maybe I missed or forgot the original problem. If I remember right the 
problem is that the session must be deleted if the visitor closes the 
browser. I think it can be done with the method that ugly sex sites use for 
opening ads when their window is closed.
An example:
body onunload=window.open('/destroysession.php?SID=')
I know it's not a 100% reliable sollution, but in javascript what is that?
This way you can make a request that'll destroy the session and sends 
javascript code that immediately closes the window.
It works for me in opera but not in mozilla :((
Maybe there's another sollution, the idea is to somehow send a a request when 
the onunload event happens (I'm sure you already knew this Scott). I tried to 
search in google for how to make http request but didn't find anything really 
useful in a few minutes, of course that doesn't mean that it can't work at 
all.
Good luck with it Larry!
Arpi

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-13 Thread Scott Fletcher
It's no problem.  We're all very interesting in finding out what can work.

Maybe I can help with one of this problem.  The Gecko browser does have the
option of blocking the opening of hte unrequest window which is maybe why
yours doesn't work in Mozilla.  Just wondeirng...


Tamas Arpad [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Monday 13 January 2003 15:14, Scott Fletcher wrote:
 Let us know how it goes...  The unload event had been tried also.  The
 javascript have been running for a while but the network communication is
a
 bit tricky, it haven't worked well.
Sorry, maybe I missed or forgot the original problem. If I remember right
the
problem is that the session must be deleted if the visitor closes the
browser. I think it can be done with the method that ugly sex sites use
for
opening ads when their window is closed.
An example:
body onunload=window.open('/destroysession.php?SID=')
I know it's not a 100% reliable sollution, but in javascript what is that?
This way you can make a request that'll destroy the session and sends
javascript code that immediately closes the window.
It works for me in opera but not in mozilla :((
Maybe there's another sollution, the idea is to somehow send a a request
when
the onunload event happens (I'm sure you already knew this Scott). I tried
to
search in google for how to make http request but didn't find anything
really
useful in a few minutes, of course that doesn't mean that it can't work at
all.
Good luck with it Larry!
Arpi



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-11 Thread Tamás Árpád
 You da man.  Unload is perfect.  If the problem he mentioned before
prevents
 the browser from finishing its communication with the server you can
always
 send a wait command with sufficient time for things to finish up.  I'll
 start testing in a live environment with it now.  Thank you for the help.
You don't have to use the wait function, I just made it to show that the
browser will always wait till the script finishes it's job.
Arpi





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-10 Thread Scott Fletcher
Session Destroy will work if you provide the user a way to log out of the
website.  But if the user closed the browser then that's it.  Session
Destory can't be used because the browser is a client side and Session
Destroy is a server side.  So, once the browser close, it doesn't contact
the server before closing.

You're only option is to clean up the session data from the webserver as I
usually have done.  I also use the database to find out about the session id
and the timestamp it was updated.  That way, I will know which session not
to delete if it is active.

Ken Nagorski [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 So it is the browsers problem. I tested what you said and Mozilla acts as
 you stated and IE does as well. I guess my question is. Is there no way to
 close clear out the session when the user logs out?

 The way I set things up the class that I wrote just gets the current
 sessionid and does a select from the database to see if it has been
logged.
 The problem this creates is that someone could sit down and reopen a
 browser and have access to the site as if they where logged because the
 session is not gone.

 Hmm - Like a said I have never used sessions before so I am learning about
 them. Thank you for your input...

 Ken


  What browser are you running?  I find that IE drops the session when
  you close the browser window actively working the site.  On Mozilla I
  have to close every instance of Mozilla regardless of the site before
  it drops the session.  Pretty aggravating so I'm going to have to start
  working on a method based on responses to your post.
 
  Larry S. Brown
  Dimension Networks, Inc.
  (727) 723-8388
 
  -Original Message-
  From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, January 09, 2003 1:35 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] session_destroy problem
 
  Hi there,
 
  I have written a class that manages sessions. I have never used
  sessions before so all this is new to me. Everything works fine as far
  as starting the session and logging in however when I call sessoin
  destroy it doesn't seem to work the function returns 1 as it should if
  all goes well however if I go to another page and do some other
  browsing even if I close the browser the session still hangs around. Is
  there something I don't know about sessions? I have read the
  documentation on the session_destroy function, I don't think that I am
  missing anything...
 
  Anyone have any suggestions? I am totally confused.
 
  Thanks
  Ken
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] session_destroy problem

2003-01-10 Thread Larry Brown
Javascript has a function for performing actions on window close.  You could
have a submit action on the page that is sent when the window closes.  I've
not used it yet but it should work I would think.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 10:58 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] session_destroy problem

Session Destroy will work if you provide the user a way to log out of the
website.  But if the user closed the browser then that's it.  Session
Destory can't be used because the browser is a client side and Session
Destroy is a server side.  So, once the browser close, it doesn't contact
the server before closing.

You're only option is to clean up the session data from the webserver as I
usually have done.  I also use the database to find out about the session id
and the timestamp it was updated.  That way, I will know which session not
to delete if it is active.

Ken Nagorski [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 So it is the browsers problem. I tested what you said and Mozilla acts as
 you stated and IE does as well. I guess my question is. Is there no way to
 close clear out the session when the user logs out?

 The way I set things up the class that I wrote just gets the current
 sessionid and does a select from the database to see if it has been
logged.
 The problem this creates is that someone could sit down and reopen a
 browser and have access to the site as if they where logged because the
 session is not gone.

 Hmm - Like a said I have never used sessions before so I am learning about
 them. Thank you for your input...

 Ken


  What browser are you running?  I find that IE drops the session when
  you close the browser window actively working the site.  On Mozilla I
  have to close every instance of Mozilla regardless of the site before
  it drops the session.  Pretty aggravating so I'm going to have to start
  working on a method based on responses to your post.
 
  Larry S. Brown
  Dimension Networks, Inc.
  (727) 723-8388
 
  -Original Message-
  From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, January 09, 2003 1:35 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] session_destroy problem
 
  Hi there,
 
  I have written a class that manages sessions. I have never used
  sessions before so all this is new to me. Everything works fine as far
  as starting the session and logging in however when I call sessoin
  destroy it doesn't seem to work the function returns 1 as it should if
  all goes well however if I go to another page and do some other
  browsing even if I close the browser the session still hangs around. Is
  there something I don't know about sessions? I have read the
  documentation on the session_destroy function, I don't think that I am
  missing anything...
 
  Anyone have any suggestions? I am totally confused.
 
  Thanks
  Ken
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-10 Thread Scott Fletcher
That would work only if the webserver IP address is '127.0.0.1' (local
machine), but not any other IP address.  Because of the ACK synchrious
communication that get interrupted as result of the browser closing.

Larry Brown [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Javascript has a function for performing actions on window close.  You
could
 have a submit action on the page that is sent when the window closes.
I've
 not used it yet but it should work I would think.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388

 -Original Message-
 From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 10, 2003 10:58 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] session_destroy problem

 Session Destroy will work if you provide the user a way to log out of the
 website.  But if the user closed the browser then that's it.  Session
 Destory can't be used because the browser is a client side and Session
 Destroy is a server side.  So, once the browser close, it doesn't contact
 the server before closing.

 You're only option is to clean up the session data from the webserver as I
 usually have done.  I also use the database to find out about the session
id
 and the timestamp it was updated.  That way, I will know which session not
 to delete if it is active.

 Ken Nagorski [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi there,
 
  So it is the browsers problem. I tested what you said and Mozilla acts
as
  you stated and IE does as well. I guess my question is. Is there no way
to
  close clear out the session when the user logs out?
 
  The way I set things up the class that I wrote just gets the current
  sessionid and does a select from the database to see if it has been
 logged.
  The problem this creates is that someone could sit down and reopen a
  browser and have access to the site as if they where logged because the
  session is not gone.
 
  Hmm - Like a said I have never used sessions before so I am learning
about
  them. Thank you for your input...
 
  Ken
 
 
   What browser are you running?  I find that IE drops the session when
   you close the browser window actively working the site.  On Mozilla I
   have to close every instance of Mozilla regardless of the site before
   it drops the session.  Pretty aggravating so I'm going to have to
start
   working on a method based on responses to your post.
  
   Larry S. Brown
   Dimension Networks, Inc.
   (727) 723-8388
  
   -Original Message-
   From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
   Sent: Thursday, January 09, 2003 1:35 AM
   To: [EMAIL PROTECTED]
   Subject: [PHP] session_destroy problem
  
   Hi there,
  
   I have written a class that manages sessions. I have never used
   sessions before so all this is new to me. Everything works fine as far
   as starting the session and logging in however when I call sessoin
   destroy it doesn't seem to work the function returns 1 as it should if
   all goes well however if I go to another page and do some other
   browsing even if I close the browser the session still hangs around.
Is
   there something I don't know about sessions? I have read the
   documentation on the session_destroy function, I don't think that I am
   missing anything...
  
   Anyone have any suggestions? I am totally confused.
  
   Thanks
   Ken
  
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-10 Thread Tamas Arpad
On Friday 10 January 2003 17:39, Scott Fletcher wrote:
  Javascript has a function for performing actions on window close
 That would work only if the webserver IP address is '127.0.0.1' (local
 machine), but not any other IP address.  Because of the ACK synchrious
 communication that get interrupted as result of the browser closing.
I think the javascrit code runs before the browser is closed, other way what 
would run it?

Arpi

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-10 Thread Scott Fletcher
Yes, the JavaScript code can run before the browser is closed but it would
not be finish running because the browser closing had been executed.
Someone had tried it before and struggled with it.   But that is a good
advice, thanks for jumping in.

Tamas Arpad [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Friday 10 January 2003 17:39, Scott Fletcher wrote:
  Javascript has a function for performing actions on window close
 That would work only if the webserver IP address is '127.0.0.1' (local
 machine), but not any other IP address.  Because of the ACK synchrious
 communication that get interrupted as result of the browser closing.
I think the javascrit code runs before the browser is closed, other way what
would run it?

Arpi



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] session_destroy problem

2003-01-10 Thread Larry Brown
Question...Do you know if Mozilla runs a browser instance that might handle
the process after one of the browser windows is closed?  Right now the
situation is that IE closes the session when the window that opened it
closes.  I have a site that is authenticated and then runs sessions on the
authenticated user.  If you close the browser window and open another one,
you are prompted for the login and password and have your new
identity/session.  On Mozilla if I close the window actively on the site and
have other windows up on other sites I can open another Mozilla instance and
return to the site and it still has my session open and identity.  I have to
close every Mozilla instance for the session to close.  If Mozilla is run by
one central process I would think maybe it could do this onwindowclose
behaviour?  Maybe a good question for the Javascript list but since it
sounds like you guys have seen this tried before maybe you already know.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 12:02 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] session_destroy problem

Yes, the JavaScript code can run before the browser is closed but it would
not be finish running because the browser closing had been executed.
Someone had tried it before and struggled with it.   But that is a good
advice, thanks for jumping in.

Tamas Arpad [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Friday 10 January 2003 17:39, Scott Fletcher wrote:
  Javascript has a function for performing actions on window close
 That would work only if the webserver IP address is '127.0.0.1' (local
 machine), but not any other IP address.  Because of the ACK synchrious
 communication that get interrupted as result of the browser closing.
I think the javascrit code runs before the browser is closed, other way what
would run it?

Arpi



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-10 Thread Scott Fletcher
You meant the tab browers.  Like 2 tabs...  I haven't tried it but now that
you mentioned it, I'm going to have to look at it soon.  I do noticed one
thing, the status bar, if it have comments, it will show up on other tabs
even though it is a completely a different website.  I get the impression
that it doesn't seem to be as independent of each other, know what I meant?

What I did with the php script is to expire the session first, at the
beginning of hte webpage before the login page showed up and before
attempting to create a session.  Maybe this will help a little bit.

Larry Brown [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Question...Do you know if Mozilla runs a browser instance that might
handle
 the process after one of the browser windows is closed?  Right now the
 situation is that IE closes the session when the window that opened it
 closes.  I have a site that is authenticated and then runs sessions on the
 authenticated user.  If you close the browser window and open another one,
 you are prompted for the login and password and have your new
 identity/session.  On Mozilla if I close the window actively on the site
and
 have other windows up on other sites I can open another Mozilla instance
and
 return to the site and it still has my session open and identity.  I have
to
 close every Mozilla instance for the session to close.  If Mozilla is run
by
 one central process I would think maybe it could do this onwindowclose
 behaviour?  Maybe a good question for the Javascript list but since it
 sounds like you guys have seen this tried before maybe you already know.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388

 -Original Message-
 From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 10, 2003 12:02 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] session_destroy problem

 Yes, the JavaScript code can run before the browser is closed but it would
 not be finish running because the browser closing had been executed.
 Someone had tried it before and struggled with it.   But that is a good
 advice, thanks for jumping in.

 Tamas Arpad [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Friday 10 January 2003 17:39, Scott Fletcher wrote:
   Javascript has a function for performing actions on window close
  That would work only if the webserver IP address is '127.0.0.1' (local
  machine), but not any other IP address.  Because of the ACK synchrious
  communication that get interrupted as result of the browser closing.
 I think the javascrit code runs before the browser is closed, other way
what
 would run it?

 Arpi



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] session_destroy problem

2003-01-10 Thread Larry Brown
It helps for me being able to re-login as a different user.  It's a good
idea but it still leaves a bit to be desired for security.  I'm going to
also post this to the js list and see if they've worked with it before.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 12:35 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] session_destroy problem

You meant the tab browers.  Like 2 tabs...  I haven't tried it but now that
you mentioned it, I'm going to have to look at it soon.  I do noticed one
thing, the status bar, if it have comments, it will show up on other tabs
even though it is a completely a different website.  I get the impression
that it doesn't seem to be as independent of each other, know what I meant?

What I did with the php script is to expire the session first, at the
beginning of hte webpage before the login page showed up and before
attempting to create a session.  Maybe this will help a little bit.

Larry Brown [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Question...Do you know if Mozilla runs a browser instance that might
handle
 the process after one of the browser windows is closed?  Right now the
 situation is that IE closes the session when the window that opened it
 closes.  I have a site that is authenticated and then runs sessions on the
 authenticated user.  If you close the browser window and open another one,
 you are prompted for the login and password and have your new
 identity/session.  On Mozilla if I close the window actively on the site
and
 have other windows up on other sites I can open another Mozilla instance
and
 return to the site and it still has my session open and identity.  I have
to
 close every Mozilla instance for the session to close.  If Mozilla is run
by
 one central process I would think maybe it could do this onwindowclose
 behaviour?  Maybe a good question for the Javascript list but since it
 sounds like you guys have seen this tried before maybe you already know.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388

 -Original Message-
 From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 10, 2003 12:02 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] session_destroy problem

 Yes, the JavaScript code can run before the browser is closed but it would
 not be finish running because the browser closing had been executed.
 Someone had tried it before and struggled with it.   But that is a good
 advice, thanks for jumping in.

 Tamas Arpad [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Friday 10 January 2003 17:39, Scott Fletcher wrote:
   Javascript has a function for performing actions on window close
  That would work only if the webserver IP address is '127.0.0.1' (local
  machine), but not any other IP address.  Because of the ACK synchrious
  communication that get interrupted as result of the browser closing.
 I think the javascrit code runs before the browser is closed, other way
what
 would run it?

 Arpi



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-10 Thread Tamás Árpád
 Yes, the JavaScript code can run before the browser is closed but it would
 not be finish running because the browser closing had been executed.
 Someone had tried it before and struggled with it.   But that is a good
 advice, thanks for jumping in.
I really doubt that browsers doesn't run the code that is in unload event of
the page because the window is closed. That would be a very bad thing. Isn't
it what the unload event is for? I mean to run code when the page is
unloaded, it doesn't matter if the window is being closed or the user is
going to another page. I think the browser should finish all the opened
window's unload code and only after that close the application really.
I made a quick test for it:
html
head
script language=javascript
function wait(msec){
 var enter_date = new Date();
 var enter_time = enter_date.getTime();

 var leave_date = new Date();
 var leave_time = leave_date.getTime();

 while (enter_time + msec  leave_time)
 {
  leave_date = new Date();
  leave_time = leave_date.getTime();
 }
 alert('unload test');
}
/script
/head

body onunload=wait(5000)
 unload test
/body
/html

It works fine for me in ie6 and mozila 0.9.6, it shows the alert message
after about 5 seconds.

Arpi




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] session_destroy problem

2003-01-10 Thread Larry Brown
You da man.  Unload is perfect.  If the problem he mentioned before prevents
the browser from finishing its communication with the server you can always
send a wait command with sufficient time for things to finish up.  I'll
start testing in a live environment with it now.  Thank you for the help.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: Tamás Árpád [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 8:03 PM
To: Larry Brown; Scott Fletcher; PHP List
Subject: Re: [PHP] session_destroy problem

 Yes, the JavaScript code can run before the browser is closed but it would
 not be finish running because the browser closing had been executed.
 Someone had tried it before and struggled with it.   But that is a good
 advice, thanks for jumping in.
I really doubt that browsers doesn't run the code that is in unload event of
the page because the window is closed. That would be a very bad thing. Isn't
it what the unload event is for? I mean to run code when the page is
unloaded, it doesn't matter if the window is being closed or the user is
going to another page. I think the browser should finish all the opened
window's unload code and only after that close the application really.
I made a quick test for it:
html
head
script language=javascript
function wait(msec){
 var enter_date = new Date();
 var enter_time = enter_date.getTime();

 var leave_date = new Date();
 var leave_time = leave_date.getTime();

 while (enter_time + msec  leave_time)
 {
  leave_date = new Date();
  leave_time = leave_date.getTime();
 }
 alert('unload test');
}
/script
/head

body onunload=wait(5000)
 unload test
/body
/html

It works fine for me in ie6 and mozila 0.9.6, it shows the alert message
after about 5 seconds.

Arpi




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] session_destroy problem

2003-01-09 Thread Ken Nagorski
Hi there,

So it is the browsers problem. I tested what you said and Mozilla acts as
you stated and IE does as well. I guess my question is. Is there no way to
close clear out the session when the user logs out?

The way I set things up the class that I wrote just gets the current
sessionid and does a select from the database to see if it has been logged.
The problem this creates is that someone could sit down and reopen a
browser and have access to the site as if they where logged because the
session is not gone.

Hmm - Like a said I have never used sessions before so I am learning about
them. Thank you for your input...

Ken


 What browser are you running?  I find that IE drops the session when
 you close the browser window actively working the site.  On Mozilla I
 have to close every instance of Mozilla regardless of the site before
 it drops the session.  Pretty aggravating so I'm going to have to start
 working on a method based on responses to your post.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388

 -Original Message-
 From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 09, 2003 1:35 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] session_destroy problem

 Hi there,

 I have written a class that manages sessions. I have never used
 sessions before so all this is new to me. Everything works fine as far
 as starting the session and logging in however when I call sessoin
 destroy it doesn't seem to work the function returns 1 as it should if
 all goes well however if I go to another page and do some other
 browsing even if I close the browser the session still hangs around. Is
 there something I don't know about sessions? I have read the
 documentation on the session_destroy function, I don't think that I am
 missing anything...

 Anyone have any suggestions? I am totally confused.

 Thanks
 Ken




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session_destroy problem

2003-01-08 Thread Gerard Samuel
In my code, I usually dump session data before calling session_destroy() 
like -
$_SESSION = array();  // Now its empty
session_destroy();  // Then call session destroy.

Works for me.

Ken Nagorski wrote:

Hi there,

I have written a class that manages sessions. I have never used sessions
before so all this is new to me. Everything works fine as far as starting
the session and logging in however when I call sessoin destroy it doesn't
seem to work the function returns 1 as it should if all goes well however if
I go to another page and do some other browsing even if I close the browser
the session still hangs around. Is there something I don't know about
sessions? I have read the documentation on the session_destroy function, I
don't think that I am missing anything...

Anyone have any suggestions? I am totally confused.

Thanks
Ken




 


--
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] session_destroy()

2001-05-01 Thread Johnson, Kirk

 -Original Message-
 From: Nick Adams [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 01, 2001 3:47 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] session_destroy()
 
 
 Just curious if anyone knows how to properly destroy a session.

As I understand it, session_unregister() removes a variable from the list of
session variables. session_destroy removes the session's content from
wherever it is being stored (e.g., a file in /tmp). To delete the *values*
of the variables immediately, use session_unset().

Kirk

-- 
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] session_destroy()

2001-05-01 Thread Henrik Hansen

Nick Adams [EMAIL PROTECTED] wrote:

  1.  (*) text/plain  
  
  Just curious if anyone knows how to properly destroy a session.
  I tried doing this,
  
  session_start();
  
  session_unregister(logged_in);
  session_unregister(username);
  session_unregister(password);
  session_unregister(accesslevel);
  session_unregister(emailaddress);
  session_unregister(last_login);
  
  session_destroy();

hmm i guess session_destroy() should unregister all variables too, try
echo session_destroy() to see if it returns 1.

-- 
Henrik Hansen


-- 
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] session_destroy() fails...

2001-03-01 Thread Ernest E Vogelsinger

At 01:25 02.03.2001, Tobias Talltorp said:
[snip]
?php
session_start();
session_register("value");
session_unregister("value");
session_destroy();
?
[snip] 

Why would you want to create and destroy the session data during a single
request? That simply doesn't make sense - session persistence is designed
to keep registered session data available across _a_series_ requests.

I believe PHP chokes at session_destroy() since the session save file has
not yet been created, and thus deleting the session data returns an error code.

Try this - it should work:

?php
if ($isset($value)) {
echo "thanks";
session_destroy();
}
else {
$value = 12;
echo "forminput type=hidden name=value value=$value";
echo "input type=submit/form";
session_start();
session_register($value);
}
?


 ...ebird

   O Ernest E. Vogelsinger
   (\)http://www.1-at-web.at/
^ ICQ#   13394035


-- 
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] session_destroy() fails...

2001-03-01 Thread Tobias Talltorp

 Why would you want to create and destroy the session data during a single
 request? That simply doesn't make sense - session persistence is designed
 to keep registered session data available across _a_series_ requests.

This I know, but it was just to show what I wanted to do.

 I believe PHP chokes at session_destroy() since the session save file has
 not yet been created, and thus deleting the session data returns an error
code.

I first got the problem when I tried this tutorial at Zend:
http://www.zend.com/zend/tut/session.php

I found it funny that a tutorial about sessions had such a "bug", since it
was supposed to cover this feature.

Complete source can be downloaded here:
http://www.phpwizard.net/resources/tutorials/session_intro.html

I had to change some in your code (lines marked with )...

?php
// removed $ from $isset
 if (isset($value)) {
echo "thanks";
session_destroy();
}
else {
// These were below the echo before...
 session_start();
 session_register($value);
$value = 12;
echo "forminput type=hidden name=value value=$value";
echo "input type=submit/form";
}
?

Error message: Warning: Trying to destroy uninitialized session in
E:\Inetpub\wwwroot\testscript\sessions\test.php on line 4

Just a thought...
Could it have anything with the session.save_path?
session.save_path =e:\Temp\sessions

Regards,
// Tobias



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