Timer or refresh using php

  • Thread starter Thread starter Anonymous
  • Start date Start date
A

Anonymous

Guest
Hi,

I need help to make a timer or something that will refresh my page 24/7 server side.

It cant be client side like javascript setTimeOut because its for a game and it must run 24/7 for all players.

I cant use Cron jobs because i'm on windows... and i dont think its possible to use windows task scheduler to run a file from my ftp.

I downloaded Pycron for windows but it looks like i can only run files on my comp with this.

I downloaded PhpJobScheduler and i cant get it to work.

I'm getting seriously mad with this damn job so some help would be really aprecied :)

Please post even if you are not sure of what you are saying some ideas could help me.

Thanks!
--eh
 
you can refresh the page with html too.
Code:
<meta http-equiv="refresh" content="2;url=http://">
content="2;url=http://link.com"
The number is the time, in seconds, until the page should be redirected. Then, separated by a semi-colon (;) is the URL that should be loaded.

hope it solves something.
 
Sorry, sigix, I don't think that's what he's looking for:

eh said:
It cant be client side like javascript setTimeOut because its for a game and it must run 24/7 for all players.

META REFRESH is client-side. I think what he wants is some sort of daemon that will update the gamestate every X minutes regardless of whether or not anyone is actually playing. He's on the right track trying to use cron, but since he's unable then it's a bit of a predicament.

Basically "eh", you'll have to use the Windows task scheduler to access the page every X minutes. You'll have to do this through a browser. Now, you could just make IE do it (tell the scheduler to run "iexplore.exe http://yoururl.com/script.php"), but a safer bet might be to download a browser like Lynx that's less prone to failure and won't cause caching issues (and which has lots of well-documented command-line switches). Give it a try.
 
swirlee said:
Sorry, sigix, I don't think that's what he's looking for:

eh wrote:
It cant be client side like javascript setTimeOut because its for a game and it must run 24/7 for all players.
Yeh im happy that someone understood me :)
and thanks so much for the command you said ie explorer etc, and as for lynx I will try it later :)

But are you sure this will work with the task manager?
I mean you were right about the thing that update stats, I want to run a file every 10 minutes on my site and on my database that update all my players stats, but will it work if its executed from my browser and not from the server?
Because i dont host myself , lycos is my host.

Thanks!
--eh
 
thanx for pointing out swirlee. :)
-if the hosting company allows you can use the cron jobs
that will run every x minute and will call the script and update the database. just like swirlee told about schedualar.
 
yes my host allow cron jobs etc but i still want to know that
eh said:
but will it work if its executed from my browser and not from the server?
Because i dont host myself , lycos is my host.
--eh
 
If it's just a PHP script, then yes, it'll work. But do be careful to that malicious third parties aren't able to access this script if it could cause any problems. Consider password-protecting it or similar.
 
Ok i set up the job and now it works at 50%.
Actually it only run once.
I have to stop it and then it start again or i have to close IE then it start again.
It only run once if i dont do anything, the prob is when i set up the times i dont really know what to do.

(My computer isnt in english so it will be hard for me to traduce but i will try it)

Task scheduled :
Each day

Start hour :
10:16 PM

- Now i clicked on advenced

End date:
I didnt write anything there

Repeat task :
Each 1 minute

Until : Hour - I didnt write anything there
Duration - 9999 Hours 0 Minutes
and i didnt check - Stop if still running

So whats wrong?
Thanks!
--eh
 
-daemon called crond which reads the file and executes the commands given to it.
/etc/init.d/crond (isp will not allow you to stop or start it)
-you better make that cron file from php. you will have web like interface for the cron jobs.
-search about cron daemons and their working, hope it solves, gives some ideas.

-also you can use .htaccess file to restrict non-valid users to not view the directory contents.

:roll:
 
Hrmm

Ok I figured out a way to make it refresh...
it will be client side but it takes my computer hour so it will be always the same time. I added setimeout in my php file. And now it refresh and i use task manager to run it so if it crash task manager start it again.

Thanks guys :)
--eh
 
There's a reason I told you to use a simple browser like Lynx. Using IE is just asking for trouble. Lynx will do what you ask it to, and only what you ask it to. IE will do all sorts of stuff that you didn't ask for, which is going to foul things up.
 
swirlee said:
There's a reason I told you to use a simple browser like Lynx. Using IE is just asking for trouble. Lynx will do what you ask it to, and only what you ask it to. IE will do all sorts of stuff that you didn't ask for, which is going to foul things up.
yes you are right
lynx is very simple console based use-agent.
 
Back
Top