• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Disabling Notice (errors) on webpage

The extros

New Member
Joined
Jun 28, 2010
Messages
98
Reaction score
1
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined index: dateFormat

Filename: frags/injection.php

Line Number: 16


I want to disable that info... always it happens... I read alot and the only answer I got was.. put this at index.php

Code:
<?php
error_reporting( E_ALL & ~E_NOTICE );
ini_set( 'display_errors', 0 );
session_start();




This is the script:

Code:
<?php
    if(!defined('BASEPATH')) exit('No direct script access allowed');

    $accountId = (!empty($_SESSION['account_id']) ? $_SESSION['account_id'] : false);
    $player = $GLOBALS['player'];
    $config = $GLOBALS['config'];

    if($player->getAccount() == $accountId)
    {
        $SQL = POT::getInstance()->getDBHandle();
        $frags = $SQL->query("SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = {$player->getId()} ORDER BY `date` DESC LIMIT 0,10;");

        if($frags->rowCount())
        {
            echo "<div class=\"bar\">Player Kills</div>";

            foreach($frags as $frag)
                echo "<table style=\"width: 100%;\"><tr class=\"highlight\"><td width=\"25%\">".date($config['dateFormat'], $frag['date'])."</td><td width=\"65%\">Killed <a href=\"".WEBSITE."/index.php/character/view/{$frag['name']}\">{$frag['name']}</a> at Level {$frag['level']}.</td><td width=\"10%\"><span style=\"color: ".($frag['unjustified'] ? "red;\">unjustified" : "green;\">ok")."</span></td></tr></table>";
        }
    }
?>
 
read again.. plz
"I want to disable that info... always it happens... I read alot and the only answer I got was.. put this at index.php"

In conclution I can say... I read (use the search function) a lot... and no answer, that is why im posting...
 
Solve the problem rather than remove the errors,

The problem line is here:
PHP:
echo "<table style=\"width: 100%;\"><tr class=\"highlight\"><td width=\"25%\">".date($config['dateFormat'], $frag['date'])."</td><td width=\"65%\">Killed <a href=\"".WEBSITE."/index.php/character/view/{$frag['name']}\">{$frag['name']}</a> at Level {$frag['level']}.</td><td width=\"10%\"><span style=\"color: ".($frag['unjustified'] ? "red;\">unjustified" : "green;\">ok")."</span></td></tr></table>";

There is no config index for $config['dateFormat'] dateFormat is not an index, you can either add the dateFormat to the config file like so:
$config['dateFormat'] = "d-m-Y - H:i a" // can change this to whatever date format you like just look here for information PHP: date - Manual

or you can remove that line from the table in the script:
PHP:
echo "<table style=\"width: 100%;\"><tr class=\"highlight\"><td width=\"25%\"><!--removed--></td><td width=\"65%\">Killed <a href=\"".WEBSITE."/index.php/character/view/{$frag['name']}\">{$frag['name']}</a> at Level {$frag['level']}.</td><td width=\"10%\"><span style=\"color: ".($frag['unjustified'] ? "red;\">unjustified" : "green;\">ok")."</span></td></tr></table>";
 
Back
Top