|
|
Automatic/remote Php Script Execution | ||
Discussion by Habble with 10 Replies.
Last Update: July 22, 2007, 5:37 am | |||
Also, is there any way, with PHP to alert a user when something changes, as soon as it happens? Say that if they recieve a new message, a box pops up telling them? You could do this with Ajax I suppose, but (correct me if I'm wrong) continually running a script to check it would slow the user's browser down considerably.
Wed Jul 18, 2007 Reply New Discussion
For the first, you could simply store in your db a kind of "last access" time for the user, I'm sure there are easily found php scripts to log when users do any significant action, and then just every 5 or 10 minutes compare all the users that are logged in currently lastest access times to the current and if its over whatever threshold you want log that user out.
The popup would be similar, I assume you could just set up something to check every 10 or 15 seconds if there is a new message waiting, a simple boolean type flag check would suffice, then if there is retrieve it and pop it up, otherwise continue on. This wouldn't slow it down much I don't imagine since its just a quick check on an interval. An infinite check loop would slow things down but a timed one less so.
I assume someone with more specific php knowledge will show up soon enough, but I figure I'd throw out some ideas to maybe point you in a direction at least worth thinking about.
Wed Jul 18, 2007 Reply New Discussion
Thu Jul 19, 2007 Reply New Discussion
As for the "Last Active" problem, one way is to check it when any script is accessed. For example, User1 closes his/her browser, and then there is not activity on the web site whatsoever - nothing is deleted. However, when User2 requests a certain page (doesn't matter which one), you first run the "last active" script, in order to clear user that left, and then display the page User2 requested.
I think it might also be possible to achieve this with cron jobs, but I have never used them, so can't tell you with certainity.
Thu Jul 19, 2007 Reply New Discussion
QUOTE (Habble)
That's not what my problem is. the problem is getting it to check at intervals, even when the user isn't on the pageLink: view Post: 107732
Use a cron job to do it. Create a PHP script which does the checking and use the PHP cli from a cron job to execute it. If you don't have access to a PHP cli executable, you can do the same thing with perl, and I can't imagine a web host that doesn't have perl installed on it (unless its shitty windows).
Thu Jul 19, 2007 Reply New Discussion
I didn't think cronjobs would be able to do it, but I'll try it! Thanks!
Fri Jul 20, 2007 Reply New Discussion
i dont no how to use a cronjob.
but ethergeek, since perl isnt on windows, wouldnt ASP be the windows alternative or something maybe?
Fri Jul 20, 2007 Reply New Discussion
QUOTE (Sten)
i dont no wot php cli executable is, lol.i dont no how to use a cronjob.
but ethergeek, since perl isnt on windows, wouldnt ASP be the windows alternative or something maybe?
Link: view Post: 107772
The exe, not the parsed version you see on the web. Cli == command line inferface, like command prompt.
Hard, google.
Doubt it, Asp is more equal to php.
Fri Jul 20, 2007 Reply New Discussion
Keep in mind that AJAX is your friend when making server requests but not reloading the entire page.
Astahost only supports PHP+MySQL, not ASP+MSSQL. Astahost doesn't have Windows servers, only Linux ones
Sun Jul 22, 2007 Reply New Discussion
QUOTE
45 * * * * /usr/bin/lynx -source http://example.com/cron.phpor
45 * * * * /usr/bin/wget -O - -q http://example.com/cron.php
This would have a browser (lynx or wget) visit your cron page 45 minutes after every hour, this is how I did it on Drupal CMS, I found an explanation for this on their support pages. Notice that when using it, after a while I got cron jobs errors, I couldn't access lynx anymore so I stopped using this feature, it might have been that somebody blocked access to it for security reasons, it was within this year or maybe a year ago.
Sun Jul 22, 2007 Reply New Discussion
How Do I Make A Shoutbox? (3)
|
(0) Top 10 Php Framework List of PHP Framework
|
Index




