ukscotth Posted February 25, 2009 Share Posted February 25, 2009 Hi, I run a social network and it has a shoutbox on it. At 9pm each night i would like to remove the bad word filter on the shoutbox and then at say 5am put it back on. The shoutbox has a config file which contains the set bad words so I thought the best way to achieve what I want would be to use cron jobs and some kind of simple php upload and replace script. Any ideas on how i can code the php file to upload and replace the shoutbox config file ? Or maybe it would be better to have 2 config files and rename them at set times, im not sure. Thanks, Scott. Link to comment https://forums.phpfreaks.com/topic/146843-upload-a-file-using-cron-and-php/ Share on other sites More sharing options...
phpdragon Posted February 25, 2009 Share Posted February 25, 2009 Question? Does the shoutcast config file run everytime a user enters a message? If so just set the timezone to what ever you like in this file and use php to check the time and if it falls between x & x use this config info, if it falls between y & y use this config info. Link to comment https://forums.phpfreaks.com/topic/146843-upload-a-file-using-cron-and-php/#findComment-770926 Share on other sites More sharing options...
DarkSuperHero Posted February 25, 2009 Share Posted February 25, 2009 I agree it would be easier to do a time check at runtime, if there are a lot of users, would a small conditional statement like that create much overhead ? [i dont think it would, but I dont know hahahah..] Anyways heres a useful link to a cronjob resource if your using cpanel to configure your cron job: http://www.siteground.com/tutorials/cpanel/cron_jobs.htm You can get some good results from google, or is it some php specific question you still have? Link to comment https://forums.phpfreaks.com/topic/146843-upload-a-file-using-cron-and-php/#findComment-770954 Share on other sites More sharing options...
DarkSuperHero Posted February 25, 2009 Share Posted February 25, 2009 <?php $format = 'G'; //G is the 0-24 hour format for date() $mytime = date($format);//Returns a number from 0-24 0-midnight if($mytime < 5 || $mytime > 21){ require_once('/path/to/your/config.php'); } else{ require_once('/path/to/your/configAdult.php'); } ?> Link to comment https://forums.phpfreaks.com/topic/146843-upload-a-file-using-cron-and-php/#findComment-770967 Share on other sites More sharing options...
JonnoTheDev Posted February 25, 2009 Share Posted February 25, 2009 Make sure that you set no-cache in your META tags also otherwise people may see bad words no matter what the time. Link to comment https://forums.phpfreaks.com/topic/146843-upload-a-file-using-cron-and-php/#findComment-771143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.