AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   SourceBans / SourceBans++ (https://forums.alliedmods.net/forumdisplay.php?f=152)
-   -   Warning: date(): It is not safe to rely on the system's timezone settings (https://forums.alliedmods.net/showthread.php?t=307234)

KentuckyWilly 05-01-2018 14:18

Warning: date(): It is not safe to rely on the system's timezone settings
 
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'); 


DarkDeviL 05-01-2018 16:26

Re: Warning: date(): It is not safe to rely on the system's timezone settings
 
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.

KentuckyWilly 05-11-2018 09:23

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

KentuckyWilly 05-11-2018 11:34

Re: Warning: date(): It is not safe to rely on the system's timezone settings
 
But something is wrong. There's still CEthCEST in ban invoke when i'm banning someone. How can I fix it? @arne1288

DarkDeviL 05-11-2018 15:58

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

Originally Posted by KentuckyWilly (Post 2591720)
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"?

KentuckyWilly 05-13-2018 09:44

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

Originally Posted by arne1288 (Post 2591748)
What exactly do you mean with "CEthCEST"?

As you can see " http://visn.dk/bans/ " Their bans date/time invoked in CEthCEST

DJ Tsunami 05-15-2018 12:34

Re: Warning: date(): It is not safe to rely on the system's timezone settings
 
It looks like you set the Date Format setting to "CEST", which is wrong. Just use "m-d-y H:i".

KentuckyWilly 05-16-2018 12:23

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

Originally Posted by DJ Tsunami (Post 2592300)
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


All times are GMT -4. The time now is 09:20.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.