Jump to content

Can this be done


stuckwithcode

Recommended Posts

Server-side language. So no (BUT yes) I'd like to say, but using something like a client side language to start a php program maybe. But beyond the scope of strictly php for every time a user leaves a web page. If you require them to do something like click a link or a button then u can run the script in that sense for saying log out or whatever, but php always need somethin from the client side to tell something on the server to run. So look into javascript perhaps to force a php script on the server to run if you wanting to run a tracker for example.

 

Also don't ask can but how with a better subject, will get more responses.  Now with that said, what exactly are you wanting to do?

Link to comment
Share on other sites

Hello,

 

When a user leaves my web page I would like to run some php code, is this possible.

 

Any suggestions are appreciated

 

The simple answer is No. PHP is a server side language, JS (On some browsers, not all to warn you) There is a JS event on abort, but this cannot be done in PHP. As mentioned by previous poster, I would not recommend setting up an automated session check, the logic is flawed.

 

You can use AJAX event along with the onAbort (or whatever it is), but this isn't the place to ask.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.