Raised This Month: $170 Target: $400
 42% 

Warning: date(): It is not safe to rely on the system's timezone settings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KentuckyWilly
Junior Member
Join Date: Apr 2018
Old 05-01-2018 , 14:18   Warning: date(): It is not safe to rely on the system's timezone settings
Reply With Quote #1

How do I fix this? I'm already in page.home.php.

Quote:
Warning: date(): 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 /home/visndkgp/public_html/bans/pages/page.home.php on line 48
Where do I insert it? I want for example the timezone to be CEST or Denmark timezone. I don't understand php.net. Please help!

PHP Code:
                                FROM " . DB_PREFIX . "_banlog AS bl
                                LEFT JOIN 
" . DB_PREFIX . "_bans AS b ON b.bid bl.bid
                                ORDER BY time DESC LIMIT 10
");

$GLOBALS['server_qry'] = "";
$stopped               = array();
$blcount               = 0;
while (!
$res->EOF) {
    
$info               = array();
    
$info['date']       = date($dateformat$res->fields[1]);
    
$info['name']       = stripslashes(filter_var($res->fields[0], FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
    
$info['short_name'] = trunc($info['name'], 40, false);
    
$info['auth']       = $res->fields['authid'];
    
$info['ip']         = $res->fields['ip'];
    
$info['server']     = "block_" . $res->fields['sid'] . "_$blcount";
    if (
$res->fields['type'] == 1) {
        
$info['search_link'] = "index.php?p=banlist&advSearch=" . $info['ip'] . "&advType=ip&Submit";
    } else {
        
$info['search_link'] = "index.php?p=banlist&advSearch=" . $info['auth'] . "&advType=steamid&Submit";
    }
    
$info['link_url'] = "window.location '" . $info['search_link'] . "';";
    
$info['name']     = htmlspecialchars(addslashes($info['name']), ENT_QUOTES, 'UTF-8');
    
$info['popup']    = "ShowBox('Blocked player: " . $info['name'] . "''" . $info['name'] . " tried to enter<br />' document.getElementById('" . $info['server'] . "').title '<br />at " . $info['date'] . "<br /><div align=middle><a href=" . $info['search_link'] . ">Click here for ban details.</a></div>''red'''true);";

    
$GLOBALS['server_qry'] .= "xajax_ServerHostProperty(" . $res->fields['sid'] . "'block_" . $res->fields['sid'] . "_$blcount''title'100);";

    array_push(
$stopped$info);
    
$res->MoveNext();
    ++
$blcount;
}

$res      = $GLOBALS['db']->Execute("SELECT count(bidFROM " . DB_PREFIX . "_bans");
$BanCount = (int) $res->fields[0];

$res  = $GLOBALS['db']->Execute("SELECT bidba.ipba.authidba.namecreatedendslengthreasonba.aidba.sidad.userCONCAT(se.ip,':',se.port), se.sidmo.iconba.RemoveTypeba.type
                                FROM 
" . DB_PREFIX . "_bans AS ba
                                LEFT JOIN 
" . DB_PREFIX . "_admins AS ad ON ba.aid ad.aid
                                LEFT JOIN 
" . DB_PREFIX . "_servers AS se ON se.sid ba.sid
                                LEFT JOIN 
" . DB_PREFIX . "_mods AS mo ON mo.mid se.modid
                                ORDER BY created DESC LIMIT 10
");
$bans = array();
while (!
$res->EOF) {
    
$info = array();
    if (
$res->fields['length'] == 0) {
        
$info['perm']     = true;
        
$info['unbanned'] = false;
    } else {
        
$info['temp']     = true;
        
$info['unbanned'] = false;
    }
    
$info['name']    = stripslashes($res->fields[3]);
    
$info['created'] = date($dateformat$res->fields['created']);
    
$ltemp           = explode(",", $res->fields[6] == 0 ? 'Permanent' : SecondsToString(intval($res->fields[6])));
    
$info['length']  = $ltemp[0];
    
$info['icon']    = empty($res->fields[13]) ? 'web.png' : $res->fields[13];
    
$info['authid']  = $res->fields[2];
    
$info['ip']      = $res->fields[1];
    if (
$res->fields[15] == 1) {
        
$info['search_link'] = "index.php?p=banlist&advSearch=" . $info['ip'] . "&advType=ip&Submit";
    } else {
        
$info['search_link'] = "index.php?p=banlist&advSearch=" . $info['authid'] . "&advType=steamid&Submit";
    }
    
$info['link_url']   = "window.location '" . $info['search_link'] . "';";
    
$info['short_name'] = trunc($info['name'], 25, false);

    if (
$res->fields[14] == 'D' || $res->fields[14] == 'U' || $res->fields[14] == 'E' || ($res->fields[6] && $res->fields[5] < time())) {
        
$info['unbanned'] = true;

        if (
$res->fields[14] == 'D') {
            
$info['ub_reason'] = 'D';
        } elseif (
$res->fields[14] == 'U') {
            
$info['ub_reason'] = 'U';
        } else {
            
$info['ub_reason'] = 'E';
        }
    } else {
        
$info['unbanned'] = false;
    }

    array_push(
$bans$info);
    
$res->MoveNext();
}

$res       = $GLOBALS['db']->Execute("SELECT count(bidFROM " . DB_PREFIX . "_comms");
$CommCount = (int) $res->fields[0];

$res   = $GLOBALS['db']->Execute("SELECT bidba.authidba.typeba.namecreatedendslengthreasonba.aidba.sidad.userCONCAT(se.ip,':',se.port), se.sidmo.iconba.RemoveTypeba.type
                                    FROM 
" . DB_PREFIX . "_comms AS ba
                                    LEFT JOIN 
" . DB_PREFIX . "_admins AS ad ON ba.aid ad.aid
                                    LEFT JOIN 
" . DB_PREFIX . "_servers AS se ON se.sid ba.sid
                                    LEFT JOIN 
" . DB_PREFIX . "_mods AS mo ON mo.mid se.modid
                                    ORDER BY created DESC LIMIT 10
");
$comms = array();
while (!
$res->EOF) {
    
$info = array();
    if (
$res->fields['length'] == 0) {
        
$info['perm']     = true;
        
$info['unbanned'] = false;
    } else {
        
$info['temp']     = true;
        
$info['unbanned'] = false;
    }
    
$info['name']        = stripslashes($res->fields[3]);
    
$info['created']     = date($dateformat$res->fields['created']);
    
$ltemp               = explode(",", $res->fields[6] == 0 ? 'Permanent' : SecondsToString(intval($res->fields[6])));
    
$info['length']      = $ltemp[0];
    
$info['icon']        = empty($res->fields[13]) ? 'web.png' : $res->fields[13];
    
$info['authid']      = $res->fields['authid'];
    
$info['search_link'] = "index.php?p=commslist&advSearch=" . $info['authid'] . "&advType=steamid&Submit";
    
$info['link_url']    = "window.location '" . $info['search_link'] . "';";
    
$info['short_name']  = trunc($info['name'], 25, false);
    
$info['type']        = $res->fields['type'] == 2 ? "images/type_c.png" : "images/type_v.png";

    if (
$res->fields[14] == 'D' || $res->fields[14] == 'U' || $res->fields[14] == 'E' || ($res->fields[6] && $res->fields[5] < time())) {
        
$info['unbanned'] = true;

        if (
$res->fields[14] == 'D') {
            
$info['ub_reason'] = 'D';
        } elseif (
$res->fields[14] == 'U') {
            
$info['ub_reason'] = 'U';
        } else {
            
$info['ub_reason'] = 'E';
        }
    } else {
        
$info['unbanned'] = false;
    }

    array_push(
$comms$info);
    
$res->MoveNext();
}


require(TEMPLATES_PATH . "
/page.servers.php"); //Set theme vars from servers page

$theme->assign('dashboard_lognopopup', (isset($GLOBALS['config']['dash.lognopopup']) && $GLOBALS['config']['dash.lognopopup'] == "1"));
$theme->assign('dashboard_title', stripslashes($GLOBALS['config']['dash.intro.title']));
$theme->assign('dashboard_text', stripslashes($GLOBALS['config']['dash.intro.text']));
$theme->assign('players_blocked', $stopped);
$theme->assign('total_blocked', $totalstopped);

$theme->assign('players_banned', $bans);
$theme->assign('total_bans', $BanCount);

$theme->assign('total_comms', $CommCount);
$theme->assign('players_commed', $comms);

$theme->display('page_dashboard.tpl'); 
KentuckyWilly is offline
arne1288
SourceMod Moderator
Join Date: Apr 2012
Old 05-01-2018 , 16:26   Re: Warning: date(): It is not safe to rely on the system's timezone settings
Reply With Quote #2

According to your "warning", it appears that your hosting provider hasn't configured the timezone in their php.ini.

Sometimes you can adjust certain php.ini settings with some hosting providers, for more information about that, you need to consult your hosting provider on how to do it.

Try adding either:

Code:
ini_set("date.timezone", "Europe/Copenhagen");
or
Code:
date_default_timezone_set("Europe/Copenhagen");
somewhere in your SourceBans' config.inc.php file.

All things like the functions you are referring to, are happening at a later time, and as such, the settings "set" with one of the above lines in config.inc.php should also have effect at that stage and prevent the warning from happening.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread]
arne1288 is offline
KentuckyWilly
Junior Member
Join Date: Apr 2018
Old 05-11-2018 , 09:23   Re: Warning: date(): It is not safe to rely on the system's timezone settings
Reply With Quote #3

Thanks

Last edited by KentuckyWilly; 05-11-2018 at 09:44.
KentuckyWilly is offline
KentuckyWilly
Junior Member
Join Date: Apr 2018
Old 05-11-2018 , 11:34   Re: Warning: date(): It is not safe to rely on the system's timezone settings
Reply With Quote #4

But something is wrong. There's still CEthCEST in ban invoke when i'm banning someone. How can I fix it? @arne1288
KentuckyWilly is offline
arne1288
SourceMod Moderator
Join Date: Apr 2012
Old 05-11-2018 , 15:58   Re: Warning: date(): It is not safe to rely on the system's timezone settings
Reply With Quote #5

Quote:
Originally Posted by KentuckyWilly View Post
But something is wrong. There's still CEthCEST in ban invoke when i'm banning someone. How can I fix it? @arne1288
What exactly do you mean with "CEthCEST"?
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread]
arne1288 is offline
KentuckyWilly
Junior Member
Join Date: Apr 2018
Old 05-13-2018 , 09:44   Re: Warning: date(): It is not safe to rely on the system's timezone settings
Reply With Quote #6

Quote:
Originally Posted by arne1288 View Post
What exactly do you mean with "CEthCEST"?
As you can see " http://visn.dk/bans/ " Their bans date/time invoked in CEthCEST
KentuckyWilly is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Old 05-15-2018 , 12:34   Re: Warning: date(): It is not safe to rely on the system's timezone settings
Reply With Quote #7

It looks like you set the Date Format setting to "CEST", which is wrong. Just use "m-d-y H:i".
__________________
DJ Tsunami is offline
KentuckyWilly
Junior Member
Join Date: Apr 2018
Old 05-16-2018 , 12:23   Re: Warning: date(): It is not safe to rely on the system's timezone settings
Reply With Quote #8

Quote:
Originally Posted by DJ Tsunami View Post
It looks like you set the Date Format setting to "CEST", which is wrong. Just use "m-d-y H:i".
Like this? 16-05-2018 17:41/1000000

EDIT: Solved

Last edited by KentuckyWilly; 05-19-2018 at 09:36. Reason: Solved
KentuckyWilly is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:48.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode