JamesThePanda Posted January 11, 2009 Share Posted January 11, 2009 Hi I making a script at the moment, I want it so when the page is closed the database is queiried. I s there any php code that does this, or can this only be done with java. I was think since PHP is only creates the page it probably isnt possible. any advice welcome. Thansk James Quote Link to comment https://forums.phpfreaks.com/topic/140393-page-exit-code/ Share on other sites More sharing options...
corbin Posted January 11, 2009 Share Posted January 11, 2009 Huh? You want to close the page right after the DB is queried? Wouldn't that defeat the purpose of accessing it through a webpage? You could use the CLI or something. Quote Link to comment https://forums.phpfreaks.com/topic/140393-page-exit-code/#findComment-734733 Share on other sites More sharing options...
JamesThePanda Posted January 11, 2009 Author Share Posted January 11, 2009 The reason is so it can submit some info to the database, like time the user exited page. Or to let the database know the user is no longer on the page. Thanks James Quote Link to comment https://forums.phpfreaks.com/topic/140393-page-exit-code/#findComment-734737 Share on other sites More sharing options...
premiso Posted January 11, 2009 Share Posted January 11, 2009 onunload is the only way I know how. The other option is using a timeout, after x minutes log the person out and query the DB. PHP does not know what the client does, only how to send data to the client. Quote Link to comment https://forums.phpfreaks.com/topic/140393-page-exit-code/#findComment-734738 Share on other sites More sharing options...
DarkWater Posted January 11, 2009 Share Posted January 11, 2009 It still won't work 100% of the time. If they just kill the process or their computer shuts off, there's nothing you can do. Quote Link to comment https://forums.phpfreaks.com/topic/140393-page-exit-code/#findComment-734756 Share on other sites More sharing options...
Daniel0 Posted January 11, 2009 Share Posted January 11, 2009 You can assume that they've left the page if they make another request to your site or if they have been inactive for X minutes. Quote Link to comment https://forums.phpfreaks.com/topic/140393-page-exit-code/#findComment-734759 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.