• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] Solution for Timezone

Started by vingar,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

vingarTopic starter

I have a big problem, my host is Hostgator,
I don't change timezone, i tried set to .htaccess with:
SetEnv TZ Europe/Rome
but  the timezone not change is America/Chicago
I tried set from php, 
add line to tplglobal.php, function.php, com_login.php with
date_default_timezone_set("Europe/Rome");

but i see from DB user,last login time from Chicago!
Please, Any Solution?

Thanks
  •  

PHPVibe A.

Hi, the timezone setting is in vibe.setts.php in the root.

vingarTopic starter

i have changed this, but dont work.
Login user date is timezone for server.
:(
Why?

clean cache, but not change
  •  

sikor

create time.php file and add this code.
<?php 
echo date('Y-m-d H:i:s T', time()) . "\n";
date_default_timezone_set('America/Chicago');
echo date('Y-m-d H:i:s T', time()) . "\n";
?>


Share with us the results.
  •  

vingarTopic starter

with your script:
<?php
echo date('Y-m-d H:i:s T', time()) . "\n";
date_default_timezone_set('America/Chicago');
echo date('Y-m-d H:i:s T', time()) . "\n";
?>

result is
2015-07-08 17:18:40 CDT 2015-07-08 17:18:40 CDT      CHICAGO same the server!

if set Europe/Rome i have the time correct
2015-07-08 17:20:12 CDT 2015-07-09 00:20:12 CEST.

The problem is to phpvibe, I tried set vibe_sett,  all page with timezone Europe/Rome and tried .htaccess, but not changed.
  •  

PHPVibe A.

Remove what you've added, use only the change in vibe.setts.php, they may conflict.

Or http://stackoverflow.com/questions/6156833/cant-set-default-timezone-in-php

vingarTopic starter

delete all entry....

config vibe_setts.php but not resolved...  :-\ :-\ :-\

<?php
/** Timezone (set your own) **/
date_default_timezone_set('Europe/Rome');

/** Arrays with options for logins **/
$conf_twitter = array();
$conf_facebook = array();
$conf_google = array();
  •  

vingarTopic starter

functions.user.php have:
//insert to db
$sql = "INSERT INTO ".DB_PREFIX."users (name,username,email,type,lastlogin,date_registered,gid,fid,oauth_token,avatar,local,country,group_id,pass,password,bio)"
. " VALUES ('" . toDb($userData['name']) . "','" . toDb($userData['username']) . "','" . esc_attr($userData['email']) . "','" . $userData['type'] . "', now(), now(), '".$userData['gid']."', '".$userData['fid']."', '".$userData['oauth_token']."', '".$userData['avatar']."', '".toDb($userData['local'])."', '".toDb($userData['country'])."', '4', '".$pass."','".toDb($userData['password'])."', '".toDb($userData['bio'])."')";
     
and


function LastOnline() {
global $db;
if(is_user( )){   
$db->query ("UPDATE  ".DB_PREFIX."users SET lastNoty=current_timestamp WHERE id ='" . sanitize_int(user_id( )) . "'");
}
}
function user_noty() {
global $db;
if(is_user( )){      
$x = $db->get_row("SELECT lastNoty from  ".DB_PREFIX."users WHERE id ='" . sanitize_int(user_id( )) . "'");
if($x) {
return    $x->lastNoty;
}
  •  

vingarTopic starter

i have fixed the problem with:
$oraattuale= "".strftime('%F %T',time())."\n";
$db->query ("UPDATE  ".DB_PREFIX."users SET lastlogin='".$oraattuale."' WHERE id ='" . sanitize_int($id) . "'");
}

O0
  •  

PHPVibe A.

I see, but it should not be like this, once set in vibe.setts.php it should be all good with the timezone, maybe look at the server settings also.

Similar topics (7)