本文整理汇总了PHP中get_ip_address函数的典型用法代码示例。如果您正苦于以下问题:PHP get_ip_address函数的具体用法?PHP get_ip_address怎么用?PHP get_ip_address使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_ip_address函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: info
/**
* Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
*
* @param ?ID_TEXT Catalogue we'll be using (NULL: unknown).
* @return ?array Map of award content-type info (NULL: disabled).
*/
function info($catalogue_name = NULL)
{
$info = array();
$info['connection'] = $GLOBALS['SITE_DB'];
$info['table'] = 'catalogue_entries';
$info['date_field'] = 'ce_add_date';
$info['id_field'] = 'id';
$info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues') ? build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => $catalogue_name), get_module_zone('cms_catalogues')) : new ocp_tempcode();
$info['category_field'] = array('c_name', 'cc_id');
$info['category_type'] = array('catalogues_catalogue', 'catalogues_category');
$info['parent_spec__table_name'] = 'catalogue_categories';
$info['parent_spec__parent_name'] = 'cc_parent_id';
$info['parent_spec__field_name'] = 'id';
$info['parent_field_name'] = 'cc_id';
$info['submitter_field'] = 'ce_submitter';
$info['id_is_string'] = false;
require_lang('catalogues');
$info['title'] = do_lang_tempcode('CATALOGUE_ENTRIES');
$info['validated_field'] = 'ce_validated';
$info['category_is_string'] = array(true, false);
$info['archive_url'] = build_url(array('page' => 'catalogues'), get_module_zone('catalogues'));
$info['cms_page'] = 'cms_catalogues';
$info['views_field'] = 'ce_views';
return $info;
}
示例2: info
/**
* Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
*
* @return ?array Map of award content-type info (NULL: disabled).
*/
function info()
{
$info = array();
$info['connection'] = $GLOBALS['SITE_DB'];
$info['table'] = 'download_downloads';
$info['date_field'] = 'add_date';
$info['id_field'] = 'id';
$info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads') ? build_url(array('page' => 'cms_downloads', 'type' => 'ad'), get_module_zone('cms_downloads')) : new ocp_tempcode();
$info['category_field'] = 'category_id';
$info['category_type'] = 'downloads';
$info['parent_spec__table_name'] = 'download_categories';
$info['parent_spec__parent_name'] = 'parent_id';
$info['parent_spec__field_name'] = 'id';
$info['parent_field_name'] = 'id';
$info['submitter_field'] = 'submitter';
$info['id_is_string'] = false;
require_lang('downloads');
$info['title'] = do_lang_tempcode('SECTION_DOWNLOADS');
$info['validated_field'] = 'validated';
$info['category_is_string'] = false;
$info['archive_url'] = build_url(array('page' => 'downloads'), get_module_zone('downloads'));
$info['cms_page'] = 'cms_downloads';
$info['views_field'] = 'download_views';
$info['supports_custom_fields'] = true;
return $info;
}
示例3: info
/**
* Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
*
* @return ?array Map of award content-type info (NULL: disabled).
*/
function info()
{
$info = array();
$info['connection'] = $GLOBALS['SITE_DB'];
$info['table'] = 'seedy_posts';
$info['date_field'] = 'date_and_time';
$info['id_field'] = 'id';
$info['add_url'] = has_submit_permission('low', get_member(), get_ip_address(), 'cedi') ? build_url(array('page' => 'cedi', 'type' => 'add_post'), get_module_zone('cedi')) : new ocp_tempcode();
$info['category_field'] = 'page_id';
$info['category_type'] = 'seedy_page';
$info['parent_spec__table_name'] = 'seedy_children';
$info['parent_spec__parent_name'] = 'parent_id';
$info['parent_spec__field_name'] = 'child_id';
$info['parent_field_name'] = 'page_id';
$info['submitter_field'] = 'the_user';
$info['id_is_string'] = false;
require_lang('cedi');
$info['title'] = do_lang_tempcode('CEDI_POSTS');
$info['validated_field'] = 'validated';
$info['category_is_string'] = false;
$info['archive_url'] = build_url(array('page' => 'cedi'), get_module_zone('cedi'));
$info['cms_page'] = 'cedi';
$info['supports_custom_fields'] = true;
return $info;
}
示例4: add_report
function add_report()
{
access_control($this);
# Get the passed details into the url data array if any
$urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
# Pick all assigned data
$data = assign_to_data($urldata);
#Get the report details if the user is editing
if (!empty($data['i'])) {
$editid = decryptValue($data['i']);
$data['formdata'] = $this->Query_reader->get_row_as_array('get_report_by_id', array('id' => $editid));
}
#Save the report details
if ($this->input->post('savereport')) {
$required_fields = array('reportname');
$_POST = clean_form_data($_POST);
$validation_results = validate_form('', $_POST, $required_fields);
#Only proceed if the validation for required fields passes
if ($validation_results['bool']) {
$save_result = false;
#Save/Update an existing report's details
if (!empty($data['formdata']) && !empty($data['i'])) {
$updateStr = '';
#check if report has changed
if (!empty($_FILES['fileurl']['tmp_name'])) {
$new_file_url = 'ny_' . strtotime('now') . generate_random_letter() . "." . end(explode('.', $_FILES['fileurl']['name']));
if (copy(str_replace("/kunden/", "/", $_FILES['fileurl']['tmp_name']), UPLOAD_DIRECTORY . "reports/" . $new_file_url)) {
#Delete the previous report from the server if it exists
if (!empty($data['formdata']['fileurl'])) {
@unlink(UPLOAD_DIRECTORY . "reports/" . $data['formdata']['fileurl']);
}
$save_result = $this->db->query($this->Query_reader->get_query_by_code('update_report', array('updatestring' => ', fileurl = \'' . $new_file_url . '\' , uploadip = \'' . get_ip_address() . '\'', 'reportname' => $_POST['reportname'], 'id' => $editid)));
}
} else {
$save_result = $this->db->query($this->Query_reader->get_query_by_code('update_report', array_merge($_POST, array('id' => $editid, 'updatestring' => ''))));
}
} else {
$new_file_url = 'ny_' . strtotime('now') . generate_random_letter() . "." . end(explode('.', $_FILES['fileurl']['name']));
#First move the report to the correct folder and then add the report
if (copy(str_replace("/kunden/", "/", $_FILES['fileurl']['tmp_name']), UPLOAD_DIRECTORY . "reports/" . $new_file_url)) {
$save_result = $this->db->query($this->Query_reader->get_query_by_code('add_report', array('fileurl' => $new_file_url, 'reportname' => $_POST['reportname'], 'uploadip' => get_ip_address())));
}
}
if ($save_result) {
$data['msg'] = "The report has been saved.";
$this->session->set_userdata('sres', $data['msg']);
redirect(base_url() . "reports/manage_reports/m/sres");
} else {
$data['msg'] = "ERROR: The report was not saved. Please contact your administrator.";
}
}
#VALIDATION end
if ((empty($validation_results['bool']) || !empty($validation_results['bool']) && !$validation_results['bool']) && empty($data['msg'])) {
$data['msg'] = "WARNING: The highlighted fields are required.";
}
$data['requiredfields'] = $validation_results['requiredfields'];
$data['formdata'] = $_POST;
}
$this->load->view('reports/add_report_view', $data);
}
示例5: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @param boolean Whether to look deep into the database (or whatever else might be time-intensive) for links
* @return array Array of links and where to show
*/
function run($exhaustive = false)
{
if (!addon_installed('catalogues')) {
return array();
}
$ret = array();
if (has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_catalogues')) {
$ret[] = array('cms', 'catalogues', array('cms_catalogues', array('type' => 'misc'), get_module_zone('cms_catalogues')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('CATALOGUES'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'COUNT(*)', NULL, '', true))))), 'DOC_CATALOGUES');
}
if ($exhaustive) {
$catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('c_name', 'c_title', 'c_description', 'c_ecommerce'), NULL, '', 10, NULL, true);
if (!is_null($catalogues)) {
$ret2 = array();
foreach ($catalogues as $row) {
if (substr($row['c_name'], 0, 1) == '_') {
continue;
}
if ($row['c_ecommerce'] == 0 || addon_installed('shopping')) {
if (has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues', array('catalogues_catalogue', $row['c_name']))) {
$ret2[] = array('cms', 'of_catalogues', array('cms_catalogues', array('type' => 'misc', 'catalogue_name' => $row['c_name']), get_module_zone('cms_catalogues')), do_lang_tempcode('ITEMS_HERE', escape_html(get_translated_text($row['c_title'])), escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('catalogue_entries', 'COUNT(*)', array('c_name' => $row['c_name']), '', true)))), get_translated_text($row['c_description']));
}
}
}
if (count($ret2) < 10) {
$ret = array_merge($ret, $ret2);
}
}
}
return $ret;
}
示例6: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('catalogues');
require_lang('catalogues');
require_css('catalogues');
$number = array_key_exists('param', $map) ? intval($map['param']) : 10;
$catalogue = array_key_exists('catalogue', $map) ? $map['catalogue'] : 'faqs';
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('catalogues');
$root = array_key_exists('root', $map) && $map['root'] != '' ? intval($map['root']) : NULL;
$catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $catalogue), '', 1);
if (!array_key_exists(0, $catalogues)) {
return do_lang_tempcode('MISSING_RESOURCE', escape_html($catalogue));
}
$catalogue_row = $catalogues[0];
$entries = $GLOBALS['SITE_DB']->query_select('catalogue_entries', array('*'), array('c_name' => $catalogue, 'ce_validated' => 1), 'ORDER BY ce_add_date DESC', $number);
$tpl_set = $catalogue;
$display_type = array_key_exists('display_type', $map) ? intval($map['display_type']) : NULL;
list($content, , ) = get_catalogue_category_entry_buildup(db_get_first_id(), $catalogue, $catalogue_row, 'SEARCH', $tpl_set, $number, 0, NULL, $root, $display_type, false, $entries);
$catalogue_title = get_translated_text($catalogue_row['c_title']);
if ($content->is_empty()) {
if (has_actual_page_access(NULL, 'cms_catalogues', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues')) {
$submit_url = build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => $catalogue, 'redirect' => SELF_REDIRECT), get_module_zone('cms_catalogues'));
} else {
$submit_url = new ocp_tempcode();
}
return do_template('BLOCK_NO_ENTRIES', array('HIGH' => false, 'TITLE' => do_lang_tempcode('RECENT', escape_html(integer_format($number)), escape_html($catalogue_title)), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('CATALOGUE_GENERIC_ADD', escape_html($catalogue_title)), 'SUBMIT_URL' => $submit_url));
}
return do_template('BLOCK_MAIN_RECENT_CC_ENTRIES', array('_GUID' => 'a57fa1b83d1b6fe3acbceb2b618e6d7f', 'CATALOGUE_TITLE' => $catalogue_title, 'CATALOGUE' => $catalogue, 'CONTENT' => $content, 'NUMBER' => integer_format($number)));
}
示例7: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('downloads');
require_css('downloads');
require_lang('downloads');
require_code('ocfiltering');
$number = array_key_exists('param', $map) ? intval($map['param']) : 10;
$filter = array_key_exists('filter', $map) ? $map['filter'] : '*';
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
$sql_filter = ocfilter_to_sqlfragment($filter, 'p.category_id', 'download_categories', 'parent_id', 'p.category_id', 'id');
// Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'download_downloads p WHERE validated=1 AND (' . $sql_filter . ') ORDER BY add_date DESC', $number);
$title = do_lang_tempcode('RECENT', make_string_tempcode(integer_format($number)), do_lang_tempcode('SECTION_DOWNLOADS'));
if (array_key_exists('title', $map) && $map['title'] != '') {
$title = protect_from_escaping(escape_html($map['title']));
}
$out = new ocp_tempcode();
foreach ($rows as $i => $row) {
if ($i != 0) {
$out->attach(do_template('BLOCK_SEPARATOR'));
}
$out->attach(get_download_html($row, true, true, $zone));
}
if ($out->is_empty()) {
if (has_actual_page_access(NULL, 'cms_downloads', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads')) {
$submit_url = build_url(array('page' => 'cms_downloads', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_downloads'));
} else {
$submit_url = new ocp_tempcode();
}
return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '74399763a51102bdd6e6d92c2c11354f', 'HIGH' => false, 'TITLE' => $title, 'MESSAGE' => do_lang_tempcode('NO_DOWNLOADS_YET'), 'ADD_NAME' => do_lang_tempcode('ADD_DOWNLOAD'), 'SUBMIT_URL' => $submit_url));
}
return do_template('BLOCK_MAIN_RECENT_DOWNLOADS', array('_GUID' => '257fa1b83d1b6fe3acbceb2b618e6d7f', 'TITLE' => $title, 'CONTENT' => $out, 'NUMBER' => integer_format($number)));
}
示例8: signin
public function signin($id, $password, $type = UserContact::TYPE_EMAIL)
{
if (!is_scalar($id)) {
return false;
}
$auth = UserContact::where('type', '=', $type)->where('value', '=', $id)->first();
if (empty($auth)) {
return false;
}
$obj = User::where('id', '=', $auth->user_id)->where('password', '=', password_crypt($password))->with('session')->first();
if (!empty($obj->id)) {
$session = $obj->session;
if (empty($session->id)) {
$session = new UserSession();
}
$session->session_id = $this->session->id(true);
$session->user_id = $obj->id;
$session->ip_address = get_ip_address();
$session->stamp = time();
$session->save();
$this->autorization = true;
$this->user = $session->user;
$smarty = new \Smarty();
$smarty->assignGlobal('auth_user', $this->user);
$smarty->assignGlobal('auth', $this);
return true;
}
return false;
}
示例9: info
/**
* Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
*
* @return ?array Map of award content-type info (NULL: disabled).
*/
function info()
{
$info = array();
$info['connection'] = $GLOBALS['SITE_DB'];
$info['table'] = 'videos';
$info['date_field'] = 'add_date';
$info['id_field'] = 'id';
$info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_galleries') ? build_url(array('page' => 'cms_galleries', 'type' => 'av'), get_module_zone('cms_galleries')) : new ocp_tempcode();
$info['category_field'] = 'cat';
$info['category_type'] = 'galleries';
$info['parent_spec__table_name'] = 'galleries';
$info['parent_spec__parent_name'] = 'parent_id';
$info['parent_spec__field_name'] = 'name';
$info['parent_field_name'] = 'cat';
$info['submitter_field'] = 'submitter';
$info['id_is_string'] = false;
require_lang('galleries');
$info['title'] = do_lang_tempcode('VIDEOS');
$info['validated_field'] = 'validated';
$info['category_is_string'] = true;
$info['archive_url'] = build_url(array('page' => 'galleries'), get_module_zone('galleries'));
$info['cms_page'] = 'cms_galleries';
$info['where'] = 'cat NOT LIKE \'' . db_encode_like('download\\_%') . '\'';
$info['views_field'] = 'video_views';
$info['supports_custom_fields'] = true;
return $info;
}
示例10: _initialize
protected function _initialize()
{
/* 读取站点配置 */
$config = api('Config/lists');
C($config);
//添加配置
if (!C('WEB_SITE_CLOSE')) {
$this->error('站点已经关闭,请稍后访问~');
}
/**垂直菜单**/
$category = D('Category')->getCategory();
$this->assign('category', $category);
/**购物车**/
$cart = D('shopcart')->getcart();
$this->assign('usercart', $cart);
/* 热门搜索 */
$str = M('config')->where('id="40"')->getField("value");
$hotsearch = explode(",", $str);
$this->assign('hotsearch', $hotsearch);
/* 广告位 */
$adData = D('ad')->getlist();
$this->assign('adData', $adData);
/**底部菜单**/
$footer = D('Category')->getfooter();
$this->assign('footer', $footer);
/**所在地**/
if (!session("user_area")) {
$arr = get_ip_address();
$area = $arr->city;
} else {
$area = session("user_area");
}
$this->assign("user_area", $area);
}
示例11: settings
function settings($data)
{
# a) save the main record
$result = $this->_query_reader->run('update_organization_settings', array('logo_url' => $data['logo_url'], 'name' => htmlentities($data['name'], ENT_QUOTES), 'description' => htmlentities($data['description'], ENT_QUOTES), 'contact_address' => $data['address'], 'contact_city' => $data['city'], 'contact_region' => $data['region'], 'contact_zipcode' => $data['zipcode'], 'contact_country_id' => $data['contact__countries'], 'date_established' => !empty($data['registrationdate']) ? $data['registrationdate'] : '', 'registration_number' => $data['registrationno'], 'registration_country_id' => !empty($data['registration__countries']) ? $data['registration__countries'] : '', 'user_id' => $this->native_session->get('__user_id'), 'organization_id' => $this->native_session->get('__organization_id')));
# d) log action
$this->_logger->add_event(array('user_id' => $this->native_session->get('__user_id'), 'activity_code' => 'updated_organization_settings', 'result' => $result ? 'SUCCESS' : 'FAIL', 'log_details' => "organization_id=" . $this->native_session->get('__organization_id') . "|device=" . get_user_device() . "|browser=" . $this->agent->browser(), 'uri' => uri_string(), 'ip_address' => get_ip_address()));
return array('boolean' => $result, 'reason' => '');
}
示例12: ip_to_currency
/**
* Convert an IP address to a currency code.
*
* @param ?IP IP address (NULL: that of current member).
* @return ID_TEXT The currency code.
*/
function ip_to_currency($ip = NULL)
{
if (is_null($ip)) {
$ip = get_ip_address();
}
$country = geolocate_ip($ip);
return country_to_currency($country);
}
示例13: post_create
function post_create($fid, $tid, $reply_pid, $fuid, $tuid, $content, $hide_ipaddress = false)
{
if (!($db = db::get())) {
return -1;
}
$post_content = $db->escape($content);
$ipaddress = $hide_ipaddress == false ? get_ip_address() : '';
if (!is_numeric($tid)) {
return -1;
}
if (!is_numeric($reply_pid)) {
return -1;
}
if (!is_numeric($fuid)) {
return -1;
}
if (!is_numeric($tuid)) {
return -1;
}
$current_datetime = date(MYSQL_DATETIME, time());
if (!($table_prefix = get_table_prefix())) {
return -1;
}
// Check that the post needs approval. If the user is a moderator their posts are self-approved.
if (perm_check_folder_permissions($fid, USER_PERM_POST_APPROVAL, $fuid) && !perm_is_moderator($fuid, $fid)) {
$sql = "INSERT INTO `{$table_prefix}POST` (TID, REPLY_TO_PID, FROM_UID, ";
$sql .= "TO_UID, CREATED, APPROVED, IPADDRESS) VALUES ({$tid}, {$reply_pid}, {$fuid}, ";
$sql .= "{$tuid}, CAST('{$current_datetime}' AS DATETIME), NULL, '{$ipaddress}')";
} else {
$sql = "INSERT INTO `{$table_prefix}POST` (TID, REPLY_TO_PID, FROM_UID, ";
$sql .= "TO_UID, CREATED, APPROVED, APPROVED_BY, IPADDRESS) VALUES ({$tid}, {$reply_pid}, ";
$sql .= "{$fuid}, {$tuid}, CAST('{$current_datetime}' AS DATETIME), ";
$sql .= "CAST('{$current_datetime}' AS DATETIME), {$fuid}, '{$ipaddress}')";
}
if (!$db->query($sql)) {
return -1;
}
$new_pid = $db->insert_id;
$sql = "INSERT INTO `{$table_prefix}POST_CONTENT` (TID, PID, CONTENT) ";
$sql .= "VALUES ('{$tid}', '{$new_pid}', '{$post_content}')";
if (!$db->query($sql)) {
return -1;
}
$sql = "INSERT INTO `{$table_prefix}POST_SEARCH_ID` (TID, PID) ";
$sql .= "VALUES('{$tid}', '{$new_pid}')";
if (!$db->query($sql)) {
return -1;
}
post_update_thread_length($tid, $new_pid);
user_increment_post_count($fuid);
if (perm_check_folder_permissions($fid, USER_PERM_POST_APPROVAL, $fuid) && !perm_is_moderator($fuid, $fid)) {
admin_send_post_approval_notification($fid);
}
return $new_pid;
}
示例14: IsProxy
function IsProxy()
{
$proxyAPI = file_get_contents('http://winmxunlimited.net/api/proxydetection/v1/query/?ip=' . get_ip_address());
if ($proxyAPI === false) {
return false;
}
if ($proxyAPI != "0" || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errstr, $errno, 1)) {
return true;
} else {
return false;
}
}
示例15: get_proxy_ip_address
/**
* Получение IP-адреса проскси.
* Возвращает IP-адрес прокси или пустую строку
*
* @return string
*/
function get_proxy_ip_address()
{
$obj =& get_instance();
$ip_address = $obj->input->storage_server('REMOTE_ADDR');
// Проверяем на валидность
if (!$obj->input->valid_ip($ip_address)) {
$ip_address = '';
}
if ($ip_address == get_ip_address()) {
$ip_address = '';
}
return $ip_address;
}