Jump to content

Recommended Posts

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

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.