本文整理汇总了PHP中cms_utils::get_real_ip方法的典型用法代码示例。如果您正苦于以下问题:PHP cms_utils::get_real_ip方法的具体用法?PHP cms_utils::get_real_ip怎么用?PHP cms_utils::get_real_ip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cms_utils
的用法示例。
在下文中一共展示了cms_utils::get_real_ip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
$homepage = $tmp[0] . '?' . implode('&', $tmp3);
// and redirect.
$homepage = html_entity_decode($homepage);
redirect($homepage);
}
}
return;
#redirect("index.php");
} else {
if (isset($_POST['loginsubmit'])) {
//No error if changing languages
$error .= lang('usernameincorrect');
debug_buffer("Login failed. Error is: " . $error);
Events::SendEvent('Core', 'LoginFailed', array('user' => $_POST['username']));
// put mention into the admin log
$ip_login_failed = cms_utils::get_real_ip();
if ($ip_login_failed) {
// <- Silently ignore audit if return values is not ture, had admin XSS vulne.
audit('', '(IP: ' . $ip_login_failed . ') ' . "Admin Username: " . $username, 'Login Failed');
}
#Now call the event
//Events::SendEvent('Core', 'LoginPost', $username);
} else {
debug_buffer($_POST["loginsubmit"]);
}
}
}
// Language shizzle
cms_admin_sendheaders();
header("Content-Language: " . CmsNlsOperations::get_current_language());
//CHANGED
示例2: audit
/**
* Put an event into the audit (admin) log. This should be
* done on most admin events for consistency.
*
* @since 0.3
* @param integer The item id (perhaps a content id, or a record id from a module)
* @param string The item name (perhaps Content, or the module name)
* @param string The action that needs to be audited
* @return void
*/
function audit($itemid, $itemname, $action)
{
$db = cmsms()->GetDb();
$userid = 0;
$username = '';
$ip_addr = '';
if ($itemid == '') {
$itemid = -1;
}
if (isset($_SESSION["cms_admin_user_id"])) {
$userid = $_SESSION["cms_admin_user_id"];
$ip_addr = cms_utils::get_real_ip();
} else {
if (isset($_SESSION['login_user_id'])) {
$userid = $_SESSION['login_user_id'];
$username = $_SESSION['login_user_username'];
}
}
if (isset($_SESSION["cms_admin_username"])) {
$username = $_SESSION["cms_admin_username"];
}
if (!isset($userid) || $userid == "") {
$userid = 0;
}
$query = "INSERT INTO " . cms_db_prefix() . "adminlog (timestamp, user_id, username, item_id, item_name, action, ip_addr) VALUES (?,?,?,?,?,?,?)";
$db->Execute($query, array(time(), $userid, $username, $itemid, $itemname, $action, $ip_addr));
}