spiritssight Posted January 25, 2008 Share Posted January 25, 2008 Hello all, I have a scrpt that does something very simple, it compares the date to a date entered into a form and also one that is in a database, this works the way it should :-) The problem is it display a error for every time it runs one of the date () error: Strict Standards: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /home/dev/www/user-sys/activation_process.php on line 21 Strict Standards: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /home/dev/www/user-sys/activation_process.php on line 22 The question is how can I fix this, I don't know what TZ the people are in that create the accounts, when they create a account it adds a date to a table called activation which is three days older then the real date and also when they activate their account they have to enter a the date of activation (todays date) if a TZ is set then how does it compare these right. here is my code: <?php if(isset($_POST['activate'])) { include '/home/dev/www/lib/db_config_cr-dev.php'; include '/home/dev/www/lib/db_conn-select.php'; $user_id = $_POST["user_id"]; $activation_code = $_POST["activation_code"]; $activation_date = $_POST["activation_date"]; $query_s = "SELECT * FROM activation WHERE user_id = '$user_id' AND activation_code = '$activation_code' "; $result_s = mysql_query($query_s) OR die("Sorry". mysql_error()); $record = mysql_fetch_array($result_s); $count = mysql_affected_rows(); // If result matched $userid and $activation_code, table row must be 1 row if($count && $activation_date == date("Y-m-d")) { $exp_date = $record["expire_date"]; $expiration_date = strtotime($exp_date); $todays_date = date("Y-m-d"); $today = strtotime($todays_date); if ($expiration_date > $today) { $valid = "is"; } else { $valid = "is not"; } echo "Your activation ". $valid ." valid!"; } else { echo "Sorry you did not enter vaild infomation on the activation form, please use your browers back button and corect the input and try again!"; } include '/home/dev/www/lib/db_close.php'; } ?> Any ideas or feed back is grateful Sincerely, Christopher Link to comment https://forums.phpfreaks.com/topic/87707-solved-help-with-date/ Share on other sites More sharing options...
ziv Posted January 25, 2008 Share Posted January 25, 2008 http://php.net/date_default_timezone_set Link to comment https://forums.phpfreaks.com/topic/87707-solved-help-with-date/#findComment-448645 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.