Also ich lasse ja die Bans mitloggen usw. Nun möchte ich gerne das in dieser LogDatei nicht die vollständige GUID angezeigt wird wie mache ich das?
PHP
<?php
$mysqlhost="localhost";
$mysqluser="XXX";
$mysqlpasswd="XXX";
$mysqldbname="XXX";
mysql_connect($mysqlhost, $mysqluser, $mysqlpasswd);
mysql_select_db($mysqldbname);
$logkickbans_filehandle = fopen(LOGDIR . "/kickbans.log", "a");
$mod->registerEvent("playerKicked", "logkickbans_kick");
$mod->registerEvent("playerBanned", "logkickbans_ban");
$mod->registerEvent("playerTempBanned", "logkickbans_tempban");
function logkickbans_kick($args) {
global $logkickbans_filehandle;
list($player, $reason, $kicker) = $args;
$date = date("[d.m.y H:i:s]");
$nickname = $GLOBALS['players'][$player]->getName();
if (!$kicker) {
$str = "$date Player \"$nickname\" ($player) got AUTO KICKED for reason: $reason\n";
}
else {
$kicker = $GLOBALS['players'][$kicker]->getName();
$str = "$date Player \"$nickname\" ($player) got KICKED by \"$kicker\" for reason: $reason\n";
}
fwrite($logkickbans_filehandle, $str);
$nickname = mysql_real_escape_string($nickname);
$reason = mysql_real_escape_string($reason);
$kicker = mysql_real_escape_string($kicker);
$guid_short = substr($player, 0, 6);
$eintragen = mysql_query("INSERT INTO `kick_bans` (`ID`, `Datum`, `Nickname`, `Player`, `Was`, `Grund`, `Kicker`) VALUES (NULL, '$date', '$nickname', '$guid_short', 'Kick', '$reason', '$kicker');");
}
function logkickbans_ban($args) {
global $logkickbans_filehandle;
list($player, $reason, $kicker) = $args;
$date = date("[d.m.y H:i:s]");
$nickname = $GLOBALS['players'][$player]->getName();
if (!$kicker) {
$str = "$date Player \"$nickname\" ($player) got AUTO BANNED for reason: $reason\n";
}
else {
$kicker = $GLOBALS['players'][$kicker]->getName();
$str = "$date Player \"$nickname\" ($player) got BANNED by \"$kicker\" for reason: $reason\n";
}
fwrite($logkickbans_filehandle, $str);
$nickname = mysql_real_escape_string($nickname);
$reason = mysql_real_escape_string($reason);
$kicker = mysql_real_escape_string($kicker);
$guid_short = substr($player, 0, 6);
$eintragen = mysql_query("INSERT INTO `kick_bans` (`ID`, `Datum`, `Nickname`, `Player`, `Was`, `Grund`, `Kicker`) VALUES (NULL, '$date', '$nickname', '$guid_short', 'Ban', '$reason', '$kicker');");
}
function logkickbans_tempban($args) {
global $logkickbans_filehandle;
list($player, $reason, $time, $kicker) = $args;
$date = date("[d.m.y H:i:s]");
$nickname = $GLOBALS['players'][$player]->getName();
if (!$kicker) {
$str = "$date Player \"$nickname\" ($player) got AUTO TEMPBANNED ($time mins) for reason: $reason\n";
}
else {
$kicker = $GLOBALS['players'][$kicker]->getName();
$str = "$date Player \"$nickname\" ($player) got TEMPBANNED ($time mins) by \"$kicker\" for reason: $reason\n";
}
fwrite($logkickbans_filehandle, $str);
$nickname = mysql_real_escape_string($nickname);
$reason = mysql_real_escape_string($reason);
$kicker = mysql_real_escape_string($kicker);
$guid_short = substr($player, 0, 6);
$eintragen = mysql_query("INSERT INTO `kick_bans` (`ID`, `Datum`, `Nickname`, `Player`, `Was`, `Grund`, `Kicker`) VALUES (NULL, '$date', '$nickname', '$guid_short', 'Tempban', '$reason', '$kicker');");
}
?>
Alles anzeigen