I have a problem, and that might be the reason why I write here..
I need to do something that logsoff my users if they closes the page, this is a community. the only way to do that of what I found is to use JavaScript, but since databasing is included in this I need the JavaScript to call a php function witch I found inpossible and the only way to do it is to make a popup, but if you have a popup stopper this means the user will never logout.. so if you understand any of this good english and have a good solution.. please share it..
thanx The Big Bad PooofHave you investigated php sessions? Using sessions to handle your users, would automatically log them off when they close the window, if your server is configured that way.
<!-- m --><a class="postlink" href="http://www.php.net/session">http://www.php.net/session</a><!-- m -->
not much time to describe things any further right now, gotta get some sleep. I'll check back tomorrow yes.. I'm actually using sessions, but, I also have a location in my database witch indicates for the other users if thisone is online or not..the best way to handle a 'who's online' situation is to have a certain timeout length and check the last active time against it everytime the list is shown.....check around devarticles or sitepoint...there are many articles on how to do this.a bit busy atm but if your still having problems in an hour or so I'll find the link.hmm.. why didnt I think of that at the first time? and why didnt I post this thread at the PHP Programming forum witch I was supposed to? damit.. cant get mutch right today, anyway thanx for your advices gyes.. I'll tryout the timeoutlittle late but heres the link anyways if you need a reference:
<!-- m --><a class="postlink" href="http://www.devarticles.com/art/1/122">http://www.devarticles.com/art/1/122</a><!-- m -->
^^you can also set a cookie with no expiration time, that logs them out when they close the browserWell that would pretty much be a session then, n8thegreat, or?
Yes a timeout is probably the way to go. I have built systems like that before, but it's not very satisfying, and I don't know what the option would be. I have been speculating in more accurate ways, involving using MySQL as session handler etc, but not come up with a solid solution yet.well, actually I went insain and are now reprogramming my whole loginsystem, but I've been looking for answers for hours and havent even been close to finding a solution, was thinking maybe if you do some kind of a hidden form that submits onunload, but I didnt get far whit that idea, actually my code became pretty ****ty so I think a good session system and timeout system is the way to do it.. maybe eh, when i think of session, i think of actual php sessions, not cookies, but essentially its the same thingI was thinking.. isn't there a way to see when the session gets destroyd? bacause the session gets destroyed when you close the window right?Yeah that's the real trick isn't it? As far as I know, the thing is that the session cookie is destroyed on the client side, and it doesn't tell anybody about it. Jobbigt.actually the session is not deleted when you close your browser. when you close it and open it back up it creates a new session_id. the old session_id gets deleted when php and apache do a cleanup. there is a setting to do this in the ini file. when it does garbage cleanup it deletes all old session_ids.
and if you are talking about a cookie on the client side it is the sameway. when you close the brwoser it doesn't delete the cookie unless you have it set to do that. the cookie id is changed the sameway as the server session.
I need to do something that logsoff my users if they closes the page, this is a community. the only way to do that of what I found is to use JavaScript, but since databasing is included in this I need the JavaScript to call a php function witch I found inpossible and the only way to do it is to make a popup, but if you have a popup stopper this means the user will never logout.. so if you understand any of this good english and have a good solution.. please share it..
thanx The Big Bad PooofHave you investigated php sessions? Using sessions to handle your users, would automatically log them off when they close the window, if your server is configured that way.
<!-- m --><a class="postlink" href="http://www.php.net/session">http://www.php.net/session</a><!-- m -->
not much time to describe things any further right now, gotta get some sleep. I'll check back tomorrow yes.. I'm actually using sessions, but, I also have a location in my database witch indicates for the other users if thisone is online or not..the best way to handle a 'who's online' situation is to have a certain timeout length and check the last active time against it everytime the list is shown.....check around devarticles or sitepoint...there are many articles on how to do this.a bit busy atm but if your still having problems in an hour or so I'll find the link.hmm.. why didnt I think of that at the first time? and why didnt I post this thread at the PHP Programming forum witch I was supposed to? damit.. cant get mutch right today, anyway thanx for your advices gyes.. I'll tryout the timeoutlittle late but heres the link anyways if you need a reference:
<!-- m --><a class="postlink" href="http://www.devarticles.com/art/1/122">http://www.devarticles.com/art/1/122</a><!-- m -->
^^you can also set a cookie with no expiration time, that logs them out when they close the browserWell that would pretty much be a session then, n8thegreat, or?
Yes a timeout is probably the way to go. I have built systems like that before, but it's not very satisfying, and I don't know what the option would be. I have been speculating in more accurate ways, involving using MySQL as session handler etc, but not come up with a solid solution yet.well, actually I went insain and are now reprogramming my whole loginsystem, but I've been looking for answers for hours and havent even been close to finding a solution, was thinking maybe if you do some kind of a hidden form that submits onunload, but I didnt get far whit that idea, actually my code became pretty ****ty so I think a good session system and timeout system is the way to do it.. maybe eh, when i think of session, i think of actual php sessions, not cookies, but essentially its the same thingI was thinking.. isn't there a way to see when the session gets destroyd? bacause the session gets destroyed when you close the window right?Yeah that's the real trick isn't it? As far as I know, the thing is that the session cookie is destroyed on the client side, and it doesn't tell anybody about it. Jobbigt.actually the session is not deleted when you close your browser. when you close it and open it back up it creates a new session_id. the old session_id gets deleted when php and apache do a cleanup. there is a setting to do this in the ini file. when it does garbage cleanup it deletes all old session_ids.
and if you are talking about a cookie on the client side it is the sameway. when you close the brwoser it doesn't delete the cookie unless you have it set to do that. the cookie id is changed the sameway as the server session.