Zen Cart Logo
Forums / General Questions / Timezone error .... help plz

Timezone error .... help plz

Views: 1,861

Results 1 to 20 of 22
21 Jul 2015, 11:49 PM
#1
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Timezone error .... help plz

Hi there

I have just completed a fresh installation of Zencart v1.5.4. The front of the site is working great but when i get to the admin i get the error below :

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /websites/123reg/LinuxPackage22/fa/tm/oo/fa$$$$$$$$$.com/public_html/admin$$$$$$/login.php on line 13

I have followed some advice on this forum but its not helped with the issue at all.....

PHP Version: 5.6.11 (Zend: 2.6.0)

can anyone help please?

Thanks

22 Jul 2015, 1:34 AM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,843
Plugin Contributions:
17

Re: Timezone error .... help plz

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

22 Jul 2015, 7:42 AM
#4
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Timezone error .... help plz

mc12345678:

I might suggest the following specific post which relates to ZC 1.5.2 and above:
https://www.zen-cart.com/showthread.php?208662-date-timezone-patch-for-v1-5-1-1-5-0-1-3-9-on-PHP-5-3-5-4-5-5&p=1270805#post1270805

Hi there

Yes i have been searching for threads on trying to fix this issue and i have tried adding the location in to the script too... but that error is still there ....

not sure what else there is ???

thanks

22 Jul 2015, 7:59 AM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Timezone error .... help plz

amebb:

Hi there

Yes i have been searching for threads on trying to fix this issue and i have tried adding the location in to the script too... but that error is still there ....

not sure what else there is ???

thanks

Could you be a little more descriptive? What. Location information was "plugged" in?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

22 Jul 2015, 8:08 AM
#6
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Timezone error .... help plz

ok i followed one of the threads to place a location in the script.

The script was located at - /includes/extra_configures/set_time_zone.php

so i then placed my location as stated.

my location is Europe/London

hope that helps

22 Jul 2015, 8:48 AM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Timezone error .... help plz

amebb:

ok i followed one of the threads to place a location in the script.

The script was located at - /includes/extra_configures/set_time_zone.php

so i then placed my location as stated.

my location is Europe/London

hope that helps

So the code looks something like:

if (version_compare(PHP_VERSION, 5.3, '>='))
{
// put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
$TZ = 'Europe/London'; // eg: 'Europe/Oslo'

Looking over PHP manual, they make it sound like 5.3 should be a string. Perhaps a conversion does (or does not) take place above, assuming that you've cleared your cache after setting the above value and tried to load the admin then try changing this same above snippet to:

if (version_compare(PHP_VERSION, '5.3', '>='))
{
// put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
$TZ = 'Europe/London'; // eg: 'Europe/Oslo'

I've also oddly seen that possibly actually modifying the "string" to something like this for the applicable version of PHP has been necessary:

if (version_compare(PHP_VERSION, '5.6', '>='))
{
// put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
$TZ = 'Europe/London'; // eg: 'Europe/Oslo'

Or, adding an additional sub-comparison value (that could then be run through the same above modifications):

if (version_compare(PHP_VERSION, 5.3.0, '>='))
{
// put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
$TZ = 'Europe/London'; // eg: 'Europe/Oslo'

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

22 Jul 2015, 9:33 AM
#8
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Timezone error .... help plz

RESULTS TIME>....

Ok, i have gone to the file in question - found at /includes/extra_configures/set_time_zone.php

Firstly, i carried out the following changes, but they made no difference at all.

if (version_compare(PHP_VERSION, '5.3', '>='))
{
// put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
$TZ = 'Europe/London'; // eg: 'Europe/Oslo'

and

if (version_compare(PHP_VERSION, '5.6', '>='))
{
// put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
$TZ = 'Europe/London'; // eg: 'Europe/Oslo'

these edits made no difference and i was still getting the error message.

I then did the final suggested edit ....

if (version_compare(PHP_VERSION, 5.3.0, '>='))
{
// put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
$TZ = 'Europe/London'; // eg: 'Europe/Oslo'

when i did this change the admin login page was blank.

i then changed back to the previous settings where i got the admin login page back with the error.

Hope that helps?

thanks

22 Jul 2015, 9:58 AM
#9
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Timezone error .... help plz

Blank screen usually generates an error message in the logs directory. Did one appear? Contents?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

22 Jul 2015, 10:33 AM
#10
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Timezone error .... help plz

It may have created an error in the log folder. I didnt check because i contacted the host to run a few checks with them.

My version of PHP was stuck on 5.3 and due to a .htaccess file i was not able to change the version. However, the tech team managed to change the php version to 5.6.

I then reinstalled the cart again. Remember, now its using Php Version 5.6

Front end of the shop works great..... the admin login page is still showing this error :

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /websites/123reg/LinuxPackage22/fa/tm/oo/f************.com/public_html/admin*************/login.php on line 13

I am not really sure what else i can try.....

22 Jul 2015, 10:40 AM
#11
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Timezone error .... help plz

I'm tapped at the moment. Really hope that someone else has a path to resolution to offer..

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

22 Jul 2015, 10:48 AM
#12
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Timezone error .... help plz

This is a log from the fresh install that i have just done :

[22-Jul-2015 10:28:12 UTC] PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /websites/123reg/LinuxPackage22/fa/tm/oo//public_html/a/login.php:13) in /websites/123reg/LinuxPackage22/fa/tm/oo/***/public_html/includes/functions/sessions.php on line 115

[22-Jul-2015 10:28:12 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /websites/123reg/LinuxPackage22/fa/tm/oo/f**************.com/public_html/admin8/login.php:13) in /websites/123reg/LinuxPackage22/fa/tm/oo/f********.com/public_html/*********/includes/init_includes/init_templates.php on line 28

22 Jul 2015, 12:44 PM
#14
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Timezone error .... help plz

hi, i have tried that too......

is this a common issue on the new version ??

22 Jul 2015, 12:57 PM
#15
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Timezone error .... help plz

It's not a common issue. It sounds like you've partially uploaded a version of /YOUR_ADMIN/login.php. Try re-uploading the Zen Cart distribution's version of the file.

Change your admin folder's name, since it's been announced to the universe via your posting of that admin-level debug-log file's contents!

For your original issue, try totally replacing the contents of /includes/extra_configures/set_time_zone.php with:

<?php
/**
 * @package initSystem
 * @copyright Copyright 2003-2013 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: DrByte  Sat Nov 2 01:21:28 2013 -0400 New in v1.5.2 $
 */
/*
 * Set time zone
*/
if (version_compare(PHP_VERSION, 5.3, '>='))
{
  // put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
  $TZ = 'Europe/London';  // eg: 'Europe/Oslo' 



  /**
   * MAKE NO CHANGES BELOW THIS LINE
   *
   * The following will take the timezone you specified above and apply it in your store.
   * If you didn't specify one, it will try to use the setting from your server's PHP configuration
   */
  if ($TZ == '') {
    $TZ = date_default_timezone_get();
  }
  if ($TZ != '') {
    putenv('TZ=' . $TZ);
    @date_default_timezone_set($TZ);
  }
}

If you still get a "blank screen" from your admin, check your /logs folder and post the contents of that file (this time, xxx-out your admin folder's name).

22 Jul 2015, 1:09 PM
#16
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Timezone error .... help plz

hi

thank you for your reply lat9.

i caried out the changes as requested and still i am having the same issues as before.

Yes your right about the admin folder.... lol i will change that now....

thanks

btw here are the logs from that change

[22-Jul-2015 10:28:12 UTC] PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /websites/123reg/LinuxPackage22/fa/tm/oo/EXAMPLE.com/public_html/admin8/login.php:13) in /websites/123reg/LinuxPackage22/fa/tm/oo/EXAMPLE.com/public_html/includes/functions/sessions.php on line 115

[22-Jul-2015 10:28:12 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /websites/123reg/LinuxPackage22/fa/tm/oo/EXAMPLE.com/public_html/admin8/login.php:13) in /websites/123reg/LinuxPackage22/fa/tm/oo/EXAMPLE.com/public_html/admin8/includes/init_includes/init_templates.php on line 28

22 Jul 2015, 1:18 PM
#17
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Timezone error .... help plz

I continue to maintain that there's an issue with /YOUR_ADMIN/login.php. Line 13 from a "stock" Zen Cart installation reads:

define('ADMIN_PASSWORD_EXPIRES_INTERVAL', strtotime('- 90 day'));

Would you post the first 20-25 lines of the version on your site?

22 Jul 2015, 1:21 PM
#18
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Timezone error .... help plz

here is the full file :

<?php
/**

  • @package admin
  • @copyright Copyright 2003-2014 Zen Cart Development Team
  • @copyright Portions Copyright 2003 osCommerce
  • @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  • @version GIT: $Id: Author: Ian Wilson Modified in v1.5.4 $
    */
    define('ADMIN_SWITCH_SEND_LOGIN_FAILURE_EMAILS', 'Yes'); // Can be set to 'No' if you don't want warning/courtesy emails to be sent after several login failures have occurred

// PCI-DSS / PA-DSS requirements for lockouts and intervals:
define('ADMIN_LOGIN_LOCKOUT_TIMER', (30 * 60));
define('ADMIN_PASSWORD_EXPIRES_INTERVAL', strtotime('- 90 day'));

//////////
require ('includes/application_top.php');
$admin_name = $admin_pass = $message = "";
$errors = array();
$error = $expired = false;
if (isset($_POST['action']) && $_POST['action'] != '')
{
if ((! isset($_SESSION['securityToken']) || ! isset($_POST['securityToken'])) || ($_SESSION['securityToken'] !== $_POST['securityToken']))
{
$error = true;
$message = ERROR_SECURITY_ERROR;
zen_record_admin_activity(TEXT_ERROR_ATTEMPTED_ADMIN_LOGIN_WITHOUT_CSRF_TOKEN, 'warning');
}
if ($_POST['action'] == 'do' . $_SESSION['securityToken'])
{
$admin_name = zen_db_prepare_input($_POST['admin_name']);
$admin_pass = zen_db_prepare_input($_POST['admin_pass']);
if ($admin_name == '' && $admin_pass == '')
{
sleep(4);
$error = true;
$message = ERROR_WRONG_LOGIN;
zen_record_admin_activity(TEXT_ERROR_ATTEMPTED_ADMIN_LOGIN_WITHOUT_USERNAME, 'warning');
} else
{
list($error, $expired, $message, $redirect) = zen_validate_user_login($admin_name, $admin_pass);
if ($redirect != '') zen_redirect($redirect);
}
} elseif ($_POST['action'] == 'rs' . $_SESSION['securityToken'])
{
$expired = true;
$admin_name = zen_db_prepare_input($_POST['admin_name-' . $_SESSION['securityToken']]);
$adm_old_pwd = zen_db_prepare_input($_POST['oldpwd-' . $_SESSION['securityToken']]);
$adm_new_pwd = zen_db_prepare_input($_POST['newpwd-' . $_SESSION['securityToken']]);
$adm_conf_pwd = zen_db_prepare_input($_POST['confpwd-' . $_SESSION['securityToken']]);

$errors = zen_validate_pwd_reset_request($admin_name, $adm_old_pwd, $adm_new_pwd, $adm_conf_pwd);
if (sizeof($errors) > 0)
{
  $error = TRUE;
  foreach ($errors as $text)
  {
    $message .= '<br />' . $text;
  }
} else
{
  $message = SUCCESS_PASSWORD_UPDATED;
  list($error, $expired, $message, $redirect) = zen_validate_user_login($admin_name, $adm_new_pwd);
  if ($redirect != '') zen_redirect($redirect);
  zen_redirect(zen_href_link(FILENAME_DEFAULT, '', 'SSL'));
}
if ($error) sleep(3);

}
}
if ($expired && $message == '') $message = sprintf(ERROR_PASSWORD_EXPIRED . ' ' . ERROR_PASSWORD_RULES, ((int)ADMIN_PASSWORD_MIN_LENGTH < 7 ? 7 : (int)ADMIN_PASSWORD_MIN_LENGTH));
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link href="includes/stylesheet.css" rel="stylesheet" type="text/css" /> <meta name="robots" content="noindex, nofollow" /> <script language="javascript" type="text/javascript"><!-- function animate(f) { var button = document.getElementById("btn_submit"); var img = document.getElementById("actionImg"); button.style.cursor="wait"; button.disabled = true; button.className = 'hiddenField'; img.className = ''; return true; } //--></script> </head> <?php if (!isset($expired) || $expired == FALSE) { ?> <body id="login" onload="document.getElementById('admin_name').focus()"> <form id="loginForm" name="loginForm" action="<?php echo zen_href_link(FILENAME_LOGIN, zen_get_all_get_params(), 'SSL'); ?>" method="post" onsubmit="animate(this)"> <fieldset> <legend><?php echo HEADING_TITLE; ?></legend> <label class="loginLabel" for="admin_name"><?php echo TEXT_ADMIN_NAME; ?></label> <input style="float: left" type="text" id="admin_name" name="admin_name" value="<?php echo zen_output_string($admin_name); ?>" autocomplete="off" /> <br class="clearBoth" /> <label class="loginLabel" for="admin_pass"><?php echo TEXT_ADMIN_PASS; ?></label> <input style="float: left" type="password" id="admin_pass" name="admin_pass" value="" autocomplete="off" /> <br class="clearBoth" /> <p class="messageStackError"><?php echo $message; ?></p> <input type="hidden" name="securityToken" value="<?php echo $_SESSION['securityToken']; ?>"> <input type="submit" name="submit" class="button" value="Login" id="btn_submit"/> <input type="hidden" name="action" value="do<?php echo $_SESSION['securityToken']; ?>" id="action1"/> <img id="actionImg" src = "images/loading.gif" class="hiddenField" /> <br /><a style="float: right;" href="<?php echo zen_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL');?>"><?php echo TEXT_PASSWORD_FORGOTTEN; ?></a> </fieldset> </form> <div id="loginExpiryPolicy"><?php echo LOGIN_EXPIRY_NOTICE; ?></div> </body> <?php } else { ?> <body id="login" onload="document.getElementById('old_pwd').focus()"> <form id="loginForm" name="loginForm" action="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" method="post" onsubmit="animate(this)"> <fieldset> <legend><?php echo HEADING_TITLE_EXPIRED; ?></legend> <p class="messageStackError"><?php echo $message; ?></p> <label class="loginLabel" for="admin_name-<?php echo $_SESSION['securityToken']; ?>"><?php echo TEXT_ADMIN_NAME; ?></label> <input style="float: left" type="text" id="admin_name" name="admin_name-<?php echo $_SESSION['securityToken']; ?>" value="<?php echo zen_output_string($admin_name); ?>" autocomplete="off"/> <br class="clearBoth" /> <label class="loginLabel" for="oldpwd-<?php echo $_SESSION['securityToken']; ?>"><?php echo TEXT_ADMIN_OLD_PASSWORD; ?></label> <input style="float: left" type="password" id="old_pwd" name="oldpwd-<?php echo $_SESSION['securityToken']; ?>" autocomplete="off" /> <br class="clearBoth" /> <label class="loginLabel" for="newpwd-<?php echo $_SESSION['securityToken']; ?>"><?php echo TEXT_ADMIN_NEW_PASSWORD; ?></label> <input style="float: left" type="password" id="admin_pass" name="newpwd-<?php echo $_SESSION['securityToken']; ?>" autocomplete="off" /> <br class="clearBoth" /> <label class="loginLabel" for="confpwd"-<?php echo $_SESSION['securityToken']; ?>><?php echo TEXT_ADMIN_CONFIRM_PASSWORD; ?></label> <input style="float: left" type="password" id="admin_pass2" name="confpwd-<?php echo $_SESSION['securityToken']; ?>" autocomplete="off" /> <br class="clearBoth" /> <input type="hidden" name="securityToken" value="<?php echo $_SESSION['securityToken']; ?>"> <input type="submit" name="submit" class="button" value="Submit" id="btn_submit" /> <input type="hidden" name="action" value="rs<?php echo $_SESSION['securityToken']; ?>" id="action1"/> <img id="actionImg" src = "images/loading.gif" class="hiddenField" /> </fieldset> </form> </body> <?php } ?> </html> <?php require('includes/application_bottom.php'); ?>
22 Jul 2015, 1:36 PM
#19
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Timezone error .... help plz

Perhaps an errant space or blank line before the <?php in that file?

22 Jul 2015, 1:44 PM
#20
amebb avatar

amebb

Zen Follower

Join Date:
May 2008
Location:
UK
Posts:
408
Plugin Contributions:
0

Re: Timezone error .... help plz

it could be, but remember none of the script has been changed in anyway.

It has been downloaded - unzipped and uploaded and then run....

no modification has occured on this script - yet.

thanks