ich habe ein Problem wenn jemand auf unserem server joint kommt Fehlermeldung
03-Mar-2014 18:12:14 UTC] PHP Notice: Undefined offset: 8192 in /xxx/xxx/CallofDuty4-170/adminmod/internals/functions.php on line 57
20:19 [03.03.14 19:12:14] PHP-Error: in home/s115429/CallofDuty4-170/adminmod/plugins/iplogger.php:92 => Function ereg() is deprecated
[03-Mar-2014 18:12:14 UTC] PHP Notice: Undefined offset: 8192 in /xxx/xxx/CallofDuty4-170/adminmod/internals/functions.php on line 57
20:19 [03.03.14 19:12:14] PHP-Error: in home/s115429/CallofDuty4-170/adminmod/plugins/iplogger.php:97 => Function ereg() is deprecated
woran liegt das bzw wie kann ich es beheben
habe ip logger php angehangen
Spoiler anzeigen
ZitatAlles anzeigen<?php
$mod->registerEvent("playerJoined", "iplogger_log_joined");
$mod->registerEvent("playerNameChange", "iplogger_log_namechange");$mod->registerEvent("playerJoined", "iplogger_log_sorted_joined");
$mod->registerEvent("playerNameChange", "iplogger_log_sorted_namechange");$mod->setDefaultCV("iplog", "enabled", "1");
$mod->setDefaultCV("iplog", "S_enabled", "1");
$mod->setDefaultCV("iplog", "dateformat", "d.n.Y, G:i");
$mod->setDefaultCV("iplog", "logformat_joined", "[{date}] {action}: -- Name: {name} - IP: {ip} - GUID: {guid}{break}");
$mod->setDefaultCV("iplog", "logformat_namechange", "[{date}] {action}: -- Old: {oldname} - New: {newname} - IP: {ip} - GUID: {guid}{break}");function iplogger_log_joined($guid) {
global $mod;
global $players;if(!$mod->getCV("iplog", "enabled")) {
return;
}
$iplog_fp_log = fopen($mod->getConfigDir()."/plugins/iplogger_log.txt", "a");
$action = "Player joined";
$playerlist = $mod->rconPlayerlist();foreach ($playerlist as $value) {
if ($guid == $value["guid"]) {
$name = $value["name"];
$ip = $value["ip"];
$name = $mod->removecolor($name);
$log_text = replacetext($action, $name, $ip, $guid);fwrite($iplog_fp_log, replacetext($action, $name, $ip, $guid));
fclose($iplog_fp_log);}
}
}function iplogger_log_namechange($param) {
global $mod;
global $players;if(!$mod->getCV("iplog", "enabled")) {
return;
}
$name = false;
$iplog_fp_log = fopen($mod->getConfigDir()."/plugins/iplogger_log.txt", "a");
list($guid, $old_name, $new_name) = $param;
$action = "Player changed name";
$playerlist = $mod->rconPlayerlist();foreach ($playerlist as $value) {
if ($guid == $value["guid"]) {
$ip = $value["ip"];
$name_old = $mod->removecolor($old_name);
$name_new = $mod->removecolor($new_name);
$log_text = replacetext($action, $name, $ip, $guid, $old_name, $new_name);
fwrite($iplog_fp_log, replacetext($action, $name, $ip, $guid, $old_name, $new_name));
fclose($iplog_fp_log);
break;
}
}
}function iplogger_log_sorted_joined ($guid) {
global $mod;
global $players;
if(!$mod->getCV("iplog", "S_enabled")) {
return;
}
$playerlist = $mod->rconPlayerlist();
foreach ($playerlist as $value) {
if ($guid == $value["guid"]) {
$name = $value["name"];
$ip = $value["ip"];
break;
}
}
$name = $mod->removecolor($name);
$file = $mod->getConfigDir()."/plugins/iplogger_guid.txt";
$arr_sorted_log = file($file);
$change_arr = false;
if($key_guid = array_search("[".$guid."]\n", $arr_sorted_log) and $key_guid >= 0) {
$key_ip = $key_guid+1;
$key_name = $key_guid+2;
if(!ereg("'".$ip."'", $arr_sorted_log[$key_ip])) {
$arr_sorted_log[$key_ip] = str_replace("\n", "", $arr_sorted_log[$key_ip]);
$arr_sorted_log[$key_ip].= " '".$ip."';\n";
$change_arr = true;
}
if(!ereg("'".$name."'", $arr_sorted_log[$key_name])) {
$arr_sorted_log[$key_name] = str_replace("\n", "", $arr_sorted_log[$key_name]);
$arr_sorted_log[$key_name].= " '".$name."';\n";
$change_arr = true;
}
if($change_arr) {
$write_string = implode("", $arr_sorted_log);
$iplog_fp_sort = fopen($mod->getConfigDir()."/plugins/iplogger_guid.txt", "w");
fwrite($iplog_fp_sort, $write_string);
fclose($iplog_fp_sort);
}} else {
$arr_write = array();
$arr_write[0] = " ";
$arr_write[1] = "[".$guid."]";
$arr_write[2] = "IPs : '".$ip."';";
$arr_write[3] = "Names: '".$name."';\n";
$write_string = implode("\n", $arr_write);
$iplog_fp_sort = fopen($mod->getConfigDir()."/plugins/iplogger_guid.txt", "a");
fwrite($iplog_fp_sort, $write_string);
fclose($iplog_fp_sort);
}
}function iplogger_log_sorted_namechange($params) {
global $mod;
global $players;
if(!$mod->getCV("iplog", "S_enabled")) {
return;
}
list($guid, $oldname, $newname) = $params;
$oldname = $mod->removecolor($oldname);
$newname = $mod->removecolor($newname);
$file = $mod->getConfigDir()."/plugins/iplogger_guid.txt";
$arr_sorted_log = file($file);
$change_arr = false;
if($key_guid = array_search("[".$guid."]\n", $arr_sorted_log) and $key_guid >= 0) {
$key_name = $key_guid+2;
if(!ereg("'".$newname."'", $arr_sorted_log[$key_name])) {
$arr_sorted_log[$key_name] = str_replace("\n", "", $arr_sorted_log[$key_name]);
$arr_sorted_log[$key_name].= " '".$newname."';\n";
$change_arr = true;
}
if($change_arr) {
$write_string = implode("", $arr_sorted_log);
$iplog_fp_sort = fopen($file, "w");
fwrite($iplog_fp_sort, $write_string);
fclose($iplog_fp_sort);
}
} else {
$arr_write = array();
$arr_write[0] = " ";
$arr_write[1] = "[".$guid."]";
$arr_write[2] = "IPs :";
$arr_write[3] = "Names: '".$newname."';\n";
$write_string = implode("\n", $arr_write);
$iplog_fp_sort = fopen($file, "a");
fwrite($iplog_fp_sort, $write_string);
fclose($iplog_fp_sort);
}}
function replacetext($action, $name, $ip, $guid, $oldname=false, $newname=false) {
global $mod;
if($action == "Player joined") {
$logformat = $mod->getCV("iplog", "logformat_joined");
$logformat = str_replace("{date}", date($mod->getCV("iplog", "dateformat")), $logformat);
$logformat = str_replace("{action}", $action, $logformat);
$logformat = str_replace("{name}", $name, $logformat);
$logformat = str_replace("{ip}", $ip, $logformat);
$logformat = str_replace("{guid}", $guid, $logformat);
$logformat = str_replace("{break}", "\n", $logformat);
} else {
$logformat = $mod->getCV("iplog", "logformat_namechange");
$logformat = str_replace("{date}", date($mod->getCV("iplog", "dateformat")), $logformat);
$logformat = str_replace("{action}", $action, $logformat);
$logformat = str_replace("{oldname}", $oldname, $logformat);
$logformat = str_replace("{newname}", $newname, $logformat);
$logformat = str_replace("{ip}", $ip, $logformat);
$logformat = str_replace("{guid}", $guid, $logformat);
$logformat = str_replace("{break}", "\n", $logformat);
}
return $logformat;
}
?>