mandukar Posted April 24, 2007 Share Posted April 24, 2007 hi I am trying to write up a script that when the timer gets to a time e.g. 12:00 it automaticly runs a page called reset.php basiclly my question is how would I get the script to run my reset.php page here is the script I galthered so fare. any help will be greatful <?php $target = mktime(0, 0, 0, 2, 10, 2007) ; $today = time () ; $difference =($target-$today) ; $days =(int) ($difference/86400) ; ?> Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/ Share on other sites More sharing options...
MadTechie Posted April 24, 2007 Share Posted April 24, 2007 CRONing is the best option Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/#findComment-236875 Share on other sites More sharing options...
mandukar Posted April 24, 2007 Author Share Posted April 24, 2007 do you know where I can get a script that does that then please? Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/#findComment-236878 Share on other sites More sharing options...
V34 Posted April 24, 2007 Share Posted April 24, 2007 Otherwise you have to view the page every time the time is 12:00. But I could be done like this. <?php $date = date(H); if ($date = "12") { header("Location: reset.php"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/#findComment-236881 Share on other sites More sharing options...
jitesh Posted April 24, 2007 Share Posted April 24, 2007 Refer a CRON JOB Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/#findComment-236883 Share on other sites More sharing options...
V34 Posted April 24, 2007 Share Posted April 24, 2007 If you have access to the server you're pages are running on, you could use CRON. http://www.scrounge.org/linux/cron.html Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/#findComment-236884 Share on other sites More sharing options...
mandukar Posted April 24, 2007 Author Share Posted April 24, 2007 so if i used <?php $date = date(H); if ($date = "12") { header("Location: reset.php"); } ?> would that mean i'd have to view the page? that this script is on? or would it work on its own? and thanks for that cron job link, i'll have a look at that too Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/#findComment-236893 Share on other sites More sharing options...
mandukar Posted April 24, 2007 Author Share Posted April 24, 2007 i've had a read of that cron job thing and they gave an example # DO NOT EDIT THIS FILE - edit the master and reinstall. # (ipwatch.cron installed on Thu Nov 18 11:48:02 1999) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) 10 3 * * * /usr/bin/foo do I put <? and ?> at the start n end of that script or just leave it as it is and save it as a txt document? Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/#findComment-236895 Share on other sites More sharing options...
V34 Posted April 24, 2007 Share Posted April 24, 2007 PHP itself can't do anything without a viewer, viewing the page. What CRON do, it runs the file every X time. But it isn't enough to just have access to the FTP server, you need to install it on the server you're using, so it's quite a problem if you have rented a Web hotel. Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/#findComment-236896 Share on other sites More sharing options...
mandukar Posted April 25, 2007 Author Share Posted April 25, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/#findComment-237949 Share on other sites More sharing options...
MadTechie Posted April 25, 2007 Share Posted April 25, 2007 mandukar Read the post If you have access to the server you're pages are running on, you could use CRON. http://www.scrounge.org/linux/cron.html Quote Link to comment https://forums.phpfreaks.com/topic/48447-timer-reset/#findComment-237971 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.