Re: [PHP] session_destroy problem
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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