From: paca70 Date: Sat, 4 Sep 2004 11:30:16 +0000 (+0000) Subject: Use getremoteaddr() in place of getenv("REMOTE_ADDR") and $_SERVER["REMOTE_ADDR"] X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2ca24fc3abe38fa388f715dcf90a1cc31757f0c0;p=moodle.git Use getremoteaddr() in place of getenv("REMOTE_ADDR") and $_SERVER["REMOTE_ADDR"] --- diff --git a/mod/chat/gui_header/chatmsg.php b/mod/chat/gui_header/chatmsg.php index 635188df5a..3f399b36bf 100644 --- a/mod/chat/gui_header/chatmsg.php +++ b/mod/chat/gui_header/chatmsg.php @@ -58,7 +58,7 @@ if ($arsc_my = arsc_getdatafromsid($arsc_sid)) echo arsc_filter_posting($arsc_a["user"], $arsc_a["sendtime"], $arsc_a["message"], $arsc_room, $arsc_a["flag_ripped"])."\n"; } $arsc_ping = time(); - $arsc_ip = getenv("REMOTE_ADDR"); + $arsc_ip = getremoteaddr(); mysql_query("UPDATE arsc_users SET lastping = '$arsc_ping', ip = '$arsc_ip' WHERE user = '$arsc_user'"); ?> diff --git a/mod/chat/gui_push_js/chatmsg.php b/mod/chat/gui_push_js/chatmsg.php index 6ec3678be5..91dce60af1 100644 --- a/mod/chat/gui_push_js/chatmsg.php +++ b/mod/chat/gui_push_js/chatmsg.php @@ -78,7 +78,7 @@ if ($arsc_my = arsc_getdatafromsid($arsc_sid)) } $arsc_lastid = $arsc_lastid_save; $arsc_ping = time(); - $arsc_ip = getenv("REMOTE_ADDR"); + $arsc_ip = getremoteaddr(); mysql_query("UPDATE arsc_users SET lastping = '$arsc_ping', ip = '$arsc_ip' WHERE sid = '$arsc_sid'"); echo " "; flush(); diff --git a/mod/chat/gui_text/index.php b/mod/chat/gui_text/index.php index 85e38341e5..d6157713f6 100644 --- a/mod/chat/gui_text/index.php +++ b/mod/chat/gui_text/index.php @@ -107,7 +107,7 @@ if ($arsc_my = arsc_getdatafromsid($arsc_sid)) $arsc_message = "/msg ".$arsc_my["user"]." ".$arsc_lang["welcome"]; echo arsc_filter_posting("System", $arsc_sendtime, $arsc_message, $arsc_room, 0); $arsc_ping = time(); - $arsc_ip = getenv("REMOTE_ADDR"); + $arsc_ip = getremoteaddr(); mysql_query("UPDATE arsc_users SET lastping = '$arsc_ping', ip = '$arsc_ip' WHERE user = '$arsc_user'"); ?> diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index afbbebff5c..201c5a05f2 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -71,7 +71,7 @@ } /// Check subnet access - if ($quiz->subnet and !address_in_subnet($_SERVER['REMOTE_ADDR'], $quiz->subnet)) { + if ($quiz->subnet and !address_in_subnet(getremoteaddr(), $quiz->subnet)) { error(get_string("subneterror", "quiz"), "view.php?id=$cm->id"); } diff --git a/mod/wiki/ewiki/ewiki.php b/mod/wiki/ewiki/ewiki.php index 3645c2eed5..8d2dec24ec 100644 --- a/mod/wiki/ewiki/ewiki.php +++ b/mod/wiki/ewiki/ewiki.php @@ -2887,7 +2887,7 @@ function ewiki_log($msg, $error_type=3) { if ((EWIKI_LOGLEVEL >= 0) && ($error_type <= EWIKI_LOGLEVEL)) { $msg = time() . " - " . - $_SERVER["REMOTE_ADDR"] . ":" . $_SERVER["REMOTE_PORT"] . " - " . + getremoteaddr() . ":" . $_SERVER["REMOTE_PORT"] . " - " . $_SERVER["REQUEST_METHOD"] . " " . $_SERVER["REQUEST_URI"] . " - " . strtr($msg, "\n\r\000\377\t\f", "\r\r\r\r\t\f") . "\n"; error_log($msg, 3, EWIKI_LOGFILE); @@ -2983,7 +2983,7 @@ function ewiki_array($array, $key=false, $am=1, $ci=EWIKI_CASE_INSENSITIVE) { function ewiki_author($defstr="") { $author = @$GLOBALS["ewiki_author"]; - ($ip = &$_SERVER["REMOTE_ADDR"]) or ($ip = "127.0.0.0"); + ($ip = getremoteaddr()) or ($ip = "127.0.0.0"); ($port = $_SERVER["REMOTE_PORT"]) or ($port = "null"); $hostname = gethostbyaddr($ip); $remote = (($ip != $hostname) ? $hostname . " " : "") diff --git a/mod/wiki/ewiki/plugins/email_protect.php b/mod/wiki/ewiki/plugins/email_protect.php index 9c684b2b15..55cfc15afe 100644 --- a/mod/wiki/ewiki/plugins/email_protect.php +++ b/mod/wiki/ewiki/plugins/email_protect.php @@ -206,7 +206,7 @@ if (!defined("STR_ROT17")) { $i = @$_SERVER["SERVER_SOFTWARE"] . @$_SERVER["HTTP_USER_AGENT"] . - @$_SERVER["REMOTE_ADDR"]; + getremoteaddr(); $i .= 'MxQXF^e-0OKC1\\s{\"?i!8PRoNnljHf65`Eb&A(\':g[D}_|S#~3hG>*9yvdI%<=.urcp/@$ZkqL,TWBw]a;72UzYJ)4mt+ V'; $f = ""; while (strlen($i)) { @@ -263,7 +263,7 @@ switch ($dom = $domains[rand(0, $n_dom)]) { case "123webhosting.org": - $m = strtr(".", "-", $_SERVER["REMOTE_ADDR"])."-".$_SERVER["SERVER_NAME"]."-".time(); + $m = strtr(".", "-", getremoteaddr())."-".$_SERVER["SERVER_NAME"]."-".time(); break; default: @@ -302,4 +302,4 @@ } -?> \ No newline at end of file +?>