1. Check to see if a setting is equal to 1 in the database.
2. if it is 1 then the cron file that runs once a day would have code to chk the value of the settings is 1 and then from there would chk the day of week.
3. if the day of the week is MON thru FRI then it would go on to do the cron job code already in place. if the day is saturday or sunday then it would NOT do the cron job. I hope i am making since
here is my code
Code: Select all
<?php
session_start();
require_once('inc/db.php');
$dbc = db_connect();
$q = mysql_query("SELECT * FROM package_settings WHERE id='1'") or die(mysql_error());
$pack_settings = mysql_fetch_array($q, MYSQL_ASSOC);
@mysql_free_result($q);
if($pack_settings['week_only_pay']='1')
{
//$day_of_week = date("l");//get todays weekday
$day_of_week = 'Saturday'; //test to see if it would work but will be removed
if($day_of_week != 'Saturday' || 'Sunday')//check to be sure today isnt a weekend
{
echo'You get paid';
}
else
{
echo 'Sorry its a weekend';
}
} else
{
//do cron work if today is anyday but sat or sun
echo'today isnt saturday or sunday so we can do our normal thing here';
}
?>if anyone can fix the code or tell me what i may be missing it would help.
Thanks