ok, i don't know if this is a problem with the script, or a problem elsewhere
The script runs via a cron job every hour. The script is supposed to check to see if its between 9am and 5pm in the users area.
When i run the script manually its fine, when ran by a cron it runs via the server time
<?php
// Connect to the database
include("db_config.php");
// Get users time zone
$sql = "SELECT ID, timezone, name, personnelpayment FROM members ORDER BY ID ASC";
$result = mysql_query($sql) or die(sql_error());
while($row = mysql_fetch_array($result)) {
if (substr($row['timezone'], 0, 1) == '-')
{
$time = (gmmktime() - (floatval(substr($row['timezone'],1)) * 3600));
}
else
{
$time = (gmmktime() + (floatval($row['timezone']) * 3600));
}
// Update Factories, Warehuouses, Stores and Items
$time = gmdate("H:i:s", $time);
print $time." - ".$row['name']."\n";
if($time >= "09:00:00" && $time <= "17:00:00") {
// Include Approved
include("approved.php");
// Include Items
include("items.php");
// Include Warehouse
include("warehouse.php");
// Include Transit
include("transit.php");
// Include Stores
include("stores.php");
// Include Wages
include("wages.php");
}
}
?>
For some reason its running by the server time, not the time specified in the script, since the one that ran earlier says
04:30:02 - desbrina
No
04:30:02 - Mnemosyne
No
04:30:02 - CrimsonSeal
No
running it manually gives
12:31:51 - desbrina
Yes
Approved ran
items ran
warehouse ran
transit ran
stores ran
wages ran
12:31:51 - Mnemosyne
Yes
Approved ran
items ran
warehouse ran
transit ran
stores ran
wages ran
12:31:51 - CrimsonSeal
Yes
Approved ran
items ran
warehouse ran
transit ran
stores ran
wages ran
anyone any ideas?