本文整理汇总了PHP中sys::client_ip方法的典型用法代码示例。如果您正苦于以下问题:PHP sys::client_ip方法的具体用法?PHP sys::client_ip怎么用?PHP sys::client_ip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sys
的用法示例。
在下文中一共展示了sys::client_ip方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
function error($description, $error_place = '', $params = array())
{
if (defined('DEVELOPER_ENVIROMENT')) {
trigger_error('error', E_USER_WARNING);
echo $description . '<br>' . $error_place . '<br><pre>';
print_r($params);
echo '</pre>';
}
debug::write_error($description, $error_place, $params);
rollback_user_transaction();
if (debug::is_console_enabled()) {
echo debug::parse_html_console();
} else {
$message = '';
if ($user_id = user::get_id()) {
$message .= "user id:\t{$user_id}\nlogin:\t\t" . user::get_login() . "\ne-mail:\t\t" . user::get_email() . "\n";
}
$message .= "ip:\t\t" . sys::client_ip() . "\nrequest:\t" . REQUEST_URI . "\nerror:\t\t{$title}\ndescription:\t{$msg}";
$mail = new mime_mail();
$mail->set_body($message);
$mail->build_message();
$mail->send('developer', DEVELOPER_EMAIL, '', WEBSITE_EMAIL, $_SERVER['HTTP_HOST'] . ' internal error!');
}
ob_end_flush();
exit;
}
示例2: write
function write($log_file_data, $string)
{
$log_dir = $log_file_data[0];
$log_name = $log_file_data[1];
$file_name = $log_dir . $log_name;
if (!is_dir($log_dir)) {
fs::mkdir($log_dir, 0775, true);
}
$oldumask = @umask(0);
$file_existed = @file_exists($file_name);
$log_file = @fopen($file_name, 'a');
if ($log_file) {
$time = strftime("%b %d %Y %H:%M:%S", strtotime('now'));
$notice = '[ ' . $time . " ]\n";
$user =& user::instance();
if (($user_id = $user->get_id()) != DEFAULT_USER_ID) {
$notice .= '[ ' . $user_id . ' ] [ ' . $user->get_login() . ' ] [ ' . $user->get_email() . ' ] ';
}
$notice .= '[' . sys::client_ip() . '] [' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "]\n" . $string . "\n\n";
@fwrite($log_file, $notice);
@fclose($log_file);
if (!$file_existed) {
@chmod($file_name, 0664);
}
@umask($oldumask);
$result = true;
} else {
@umask($oldumask);
$result = false;
debug::write_error("Cannot open log file '{$file_name}' for writing\n" . "The web server must be allowed to modify the file.\n" . "File logging for '{$file_name}' is disabled.", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, false);
}
return $result;
}
示例3: login
function login($login, $password)
{
$this->_delete_cookie();
$user_ip = sys::client_ip(true);
$sid = md5(uniqid($user_ip));
session::set('phpbb_sid', $sid);
$phpbb_user_data = array();
$phpbb_user_data['session_user_id'] = user::get_id();
$phpbb_user_data['session_id'] = $sid;
$phpbb_user_data['session_ip'] = $user_ip;
$phpbb_user_data['session_logged_in'] = 1;
$phpbb_user_data['session_start'] = time();
$phpbb_user_data['session_time'] = time();
$db_table =& db_table_factory::create('phpbb_sessions');
return $db_table->insert($phpbb_user_data);
}
示例4: progress
function progress()
{
$this->db =& db_factory::instance();
$this->session_id = sys::client_ip();
}
示例5: array
function test_login()
{
$this->_login_user(5, array());
$this->assertTrue($this->object->login('', ''));
$db_table =& db_table_factory :: instance('phpbb_sessions');
$conditions['session_user_id'] = 5;
$rows = $db_table->get_list($conditions, '', null);
$record = current($rows);
$this->assertEqual($record['session_ip'], ip :: encode_ip(sys :: client_ip()));
$this->assertEqual($record['session_logged_in'], 1);
}
示例6: _send_mail
function _send_mail($description, $verbosity_level)
{
$title = '';
$headers = array();
switch ($verbosity_level) {
case DEBUG_LEVEL_NOTICE:
$title .= ' debug notice';
$headers['X-Priority'] = '0 (Low)';
break;
case DEBUG_LEVEL_WARNING:
$title .= ' debug warning';
break;
case DEBUG_LEVEL_ERROR:
$title .= ' debug error';
$headers['X-Priority'] = '1 (High)';
break;
case DEBUG_TIMING_POINT:
$title .= ' timig point';
break;
}
$message = '';
$user =& user::instance();
if (($user_id = $user->get_id()) != DEFAULT_USER_ID) {
$message .= "user id:\t" . "{$user_id}\n" . "login:\t\t" . $user->get_login() . "\n" . "e-mail:\t\t" . $user->get_email() . "\n";
}
$message .= "ip:\t\t" . sys::client_ip() . "\n" . "request:\t" . REQUEST_URI . "\n" . "description:\n" . $description;
send_plain_mail(array(DEVELOPER_EMAIL), $_SERVER['SERVER_ADMIN'] . '<' . $_SERVER['HTTP_HOST'] . '> ', $title, $message, $headers);
}
示例7: get_client_ip
function get_client_ip()
{
return ip::encode_ip(sys::client_ip());
}
示例8: fopen
function &parse_html_console($server_file_path = VAR_WEB_DIR)
{
if (!debug::is_debug_enabled()) {
return '';
}
$debug =& debug::instance();
$report =& $debug->_parse_report_internal(true);
$ip = sys::client_ip();
$js_window = "\r\n <script language='javascript'>\r\n <!-- hide this script from old browsers\r\n\r\n function show_debug( file_name, title )\r\n {\r\n rn = Math.random();\r\n debug_window = window.open( file_name + '?rn=' + rn, title, 'top=370,left=550,height=300,width=400,scrollbars,resizable');\r\n }\r\n\r\n show_debug('{$server_file_path}{$ip}-debug.html', 'debug');\r\n\r\n //-->\r\n </script>";
$header = '<html><head><script>var NEED_TO_FOCUS = false</script><title>debug</title></head><body onload="if(NEED_TO_FOCUS)window.focus();else window.blur()">';
$footer = '</body></html>';
fs::mkdir(VAR_DIR);
$fp = fopen(VAR_DIR . $ip . '-debug.html', 'w+');
fwrite($fp, $header);
fwrite($fp, $report);
fwrite($fp, $footer);
fclose($fp);
return $js_window;
}
示例9: register_answer
function register_answer($answer_id)
{
if (!$answer_id) {
return false;
}
if (!($poll_data = $this->get_active_poll())) {
return false;
}
$poll_id = $poll_data['id'];
if (!$poll_id) {
return false;
}
if (!$this->can_vote()) {
return false;
}
if (!$this->_add_vote_to_answer($poll_data['answers'][$answer_id]['record_id'])) {
return false;
}
$poll_session =& session::get('poll_session');
$poll_session[$poll_id] = $poll_id;
switch ($poll_data['restriction']) {
case 1:
return true;
break;
case 2:
$cookie = $_COOKIE;
if (isset($cookie['poll_ids'])) {
$poll_ids = $cookie['poll_ids'];
$poll_ids += ',' . $poll_id;
} else {
$poll_ids = $poll_id;
}
$one_week = 7 * 24 * 60 * 60;
setcookie('poll_ids', $poll_ids, time() + $one_week, '/');
break;
case 3:
$this->_register_new_ip($poll_id, sys::client_ip());
break;
}
return true;
}
示例10: _send_mail
function _send_mail($debug_info)
{
include_once LIMB_DIR . 'core/lib/mail/send_plain_mail.inc.php';
$title = '';
$headers = array();
$description = debug::_parse_text_debug_info($debug_info);
$verbosity_level = $debug_info['level'];
switch ($verbosity_level) {
case DEBUG_LEVEL_NOTICE:
$title .= ' debug notice';
$headers['X-Priority'] = '0 (Low)';
break;
case DEBUG_LEVEL_WARNING:
$title .= ' debug warning';
break;
case DEBUG_LEVEL_ERROR:
$title .= ' debug error';
$headers['X-Priority'] = '1 (High)';
break;
case DEBUG_TIMING_POINT:
$title .= ' timig point';
break;
}
$message = '';
$user =& user::instance();
if (($user_id = $user->get_id()) != DEFAULT_USER_ID) {
$message .= "user id:\t" . "{$user_id}\n" . "login:\t\t" . $user->get_login() . "\n" . "e-mail:\t\t" . $user->get_email() . "\n";
}
$message .= "ip:\t\t" . sys::client_ip() . "\n" . "request:\t" . $_SERVER['REQUEST_URI'] . "\n" . "description:\n" . $description;
if (sys::exec_mode() == 'cli') {
send_plain_mail(array(DEVELOPER_EMAIL), 'cli', $title, $message, $headers);
} else {
send_plain_mail(array(DEVELOPER_EMAIL), $_SERVER['SERVER_ADMIN'] . '<' . $_SERVER['HTTP_HOST'] . '> ', $title, $message, $headers);
}
}