Skip to content

Commit

Permalink
"MDL-19037, use getremoteaddr to get remote ip address"
Browse files Browse the repository at this point in the history
  • Loading branch information
dongsheng committed May 1, 2009
1 parent 224eccb commit b8aa76c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion auth/ldap/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,7 @@ function loginpage_hook() {
&& !empty($this->config->ntlmsso_subnet) // have a subnet to test for
&& empty($_GET['authldap_skipntlmsso']) // haven't failed it yet
&& (isguestuser() || !isloggedin()) // guestuser or not-logged-in users
&& address_in_subnet($_SERVER['REMOTE_ADDR'], $this->config->ntlmsso_subnet)) {
&& address_in_subnet(getremoteaddr(), $this->config->ntlmsso_subnet)) {

// First, let's remember where we were trying to get to before we got here
if (empty($SESSION->wantsurl)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/form/recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function verify($challenge_field, $response_field) {
global $CFG;
require_once $CFG->libdir . '/recaptchalib.php';
$response = recaptcha_check_answer($CFG->recaptchaprivatekey,
$_SERVER['REMOTE_ADDR'],
getremoteaddr(),
$challenge_field,
$response_field,
$this->_https);
Expand Down
2 changes: 1 addition & 1 deletion mod/hotpot/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
if (!hotpot_is_visible($cm)) {
$error = get_string("activityiscurrentlyhidden");
// check network address
} else if ($hotpot->subnet && !address_in_subnet($_SERVER['REMOTE_ADDR'], $hotpot->subnet)) {
} else if ($hotpot->subnet && !address_in_subnet(getremoteaddr(), $hotpot->subnet)) {
$error = get_string("subneterror", "quiz");
// check number of attempts
} else if ($hotpot->attempts && $hotpot->attempts <= $DB->count_records_select('hotpot_attempts', 'hotpot=? AND userid=?', array($hotpot->id, $USER->id), 'COUNT(DISTINCT clickreportid)')) {
Expand Down
2 changes: 1 addition & 1 deletion mod/resource/type/file/resource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ function set_encrypted_parameter() {
return extern_server_file($this->resource->reference);
}
}
return md5($_SERVER['REMOTE_ADDR'].$CFG->resource_secretphrase);
return md5(getremoteaddr().$CFG->resource_secretphrase);
}

function setup_preprocessing(&$defaults){
Expand Down
2 changes: 1 addition & 1 deletion mod/resource/type/repository/resource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ function set_encrypted_parameter() {
return extern_server_file($this->resource->reference);
}
}
return md5($_SERVER['REMOTE_ADDR'].$CFG->resource_secretphrase);
return md5(getremoteaddr().$CFG->resource_secretphrase);
}


Expand Down

0 comments on commit b8aa76c

Please sign in to comment.