Jump to content

Recommended Posts

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

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.

 

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?

<?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');
}
?>

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.