function get_location_info() { $ak = C('BAIDU_MAP_API_AK'); $ip = get_user_ip(); $url = "http://api.map.baidu.com/location/ip?ak=" . $ak . "&ip=" . $ip; $res = @file_get_contents($url); $res = json_decode($res, true); return $res; }
function gen_online_id($uid, $sid, $zeit) { global $text_function_text; global $config; $ipx = get_user_ip(); $ClientInfo = getenv("HTTP_USER_AGENT"); $sql = "INSERT INTO st_online_details (uid,sid,first_online,last_online,ip1,ip2,ip3,ip4,ip_all,browser) VALUES({$uid},'{$sid}',{$zeit},{$zeit},'{$ipx['0']}','{$ipx['1']}','{$ipx['2']}','{$ipx['3']}','{$ipx['4']}','{$ClientInfo}')"; $rst = mysql_w_query($sql); return mysql_insert_id(); }
/** * Sends an email confirmation to the teacher for a submitted project * * @param string $project_name * @param string $email * @return boolean */ public function sendSubmitConfirmationToAdmin($project_name, $email) { $subject = _('Projet remis!'); $date = date('d/m/Y \à h:i:s', time()); // loads get_user_ip() helper $this->load->helper('system'); $message = $_SESSION['name'] . ' ' . $_SESSION['last_name'] . ' a remis le projet "' . $project_name . '" ce ' . $date . ' depuis l\'adresse ' . get_user_ip() . '.'; return $this->sendObjectMessageToEmail($subject, $message, $email); }
$list = ""; $attaches = get_posts(array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => get_the_ID())); foreach ($attaches as $k => $v) { $likes = get_post_meta($v->ID, 'competition_like', true); $likes = $likes ? $likes : 0; $attaches[$k]->likes = $likes; } uasort($attaches, "sort_objects_by_likes"); foreach ($attaches as $attach) { $type = get_post_mime_type($attach->ID); if (strpos($type, 'image') !== false) { $url = get_image_by_id($attach->ID, array(194, 194), true, true); $full_path = get_image_by_id($attach->ID, array(800, 600), true, true); $ips = get_post_meta($attach->ID, 'competition_ips', true); $ips = $ips ? json_decode($ips) : array(); $disabled = in_array(get_user_ip(), $ips); $list .= '<li>'; $list .= '<a href="' . $full_path . '">'; $list .= '<img src="' . $url . '" alt="' . $attach->post_title . '" width="194" height="194" /></a>'; if ($disabled) { $list .= '<div class="likes disabled"><i class="like-ico"></i><span class="count">' . $attach->likes . '</span></div>'; } else { $list .= '<div class="likes"><a href="#like-' . $attach->ID . '"><i class="like-ico"></i></a><span class="count">' . $attach->likes . '</span></div>'; } $list .= '</li>'; } } echo $list; ?> </ul>
function save_cform_data($cf7) { global $wpdb; $data = $cf7->posted_data; $post_id = $data['cform_current_post_id']; if (isset($post_id) && intval($post_id) > 0) { $time = current_time('mysql'); $comments_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->comments} AS c WHERE c.comment_post_ID = %d AND c.comment_parent = 0", $post_id)); $args = array('comment_post_ID' => $post_id, 'comment_author' => 'Вопрос ' . ++$comments_count . ', ' . $wpdb->escape($data['name']), 'comment_author_email' => filter_var($data['email'], FILTER_VALIDATE_EMAIL) ? $data['email'] : '', 'comment_author_url' => '', 'comment_content' => $wpdb->escape($data['message']), 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 0, 'comment_author_IP' => get_user_ip(), 'comment_agent' => $_SERVER['HTTP_USER_AGENT'], 'comment_date' => $time, 'comment_approved' => 0); wp_insert_comment($args); } }
<?php include_once "../../includes/basics/basics.inc"; if (!empty($_GET['save_ratings']) && !empty($_GET['rating'])) { $extn_rating = new extn_rating_values(); $extn_rating->rating = !empty($_GET['rating']) ? $_GET['rating'] : ''; $extn_rating->reference_id = !empty($_GET['reference_id']) ? $_GET['reference_id'] : ''; $extn_rating->reference_table = !empty($_GET['reference_table']) ? $_GET['reference_table'] : ''; $extn_rating->ip_address = get_user_ip(); $extn_rating->vote_time = current_time(); try { $extn_rating->save(); $dbc->confirm(); $data = ['result' => 'Thank You']; } catch (Exception $e) { $data = ['result' => '']; } if (count($data) == 0) { return false; } else { echo header('Content-Type: application/json'); echo json_encode($data); } }
function generate_guid() { $uid = uniqid('', true); $data = get_user_ip(); $hash = hash('sha256', $uid . md5($data)); return $hash; }
/** * startup * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Startup * @author Henry Ruhs */ function startup() { /* ini set */ if (function_exists('ini_set')) { if (error_reporting() == 0) { ini_set('display_startup_errors', 0); ini_set('display_errors', 0); } ini_set('session.use_trans_sid', 0); ini_set('url_rewriter.tags', 0); } /* session start */ session_start(); /* define general */ define('FILE', get_file()); define('ROOT', get_root()); define('TOKEN', get_token()); /* prefix and salt */ define('PREFIX', Redaxscript\Config::get('prefix')); define('SALT', Redaxscript\Config::get('salt')); /* database connect */ database_connect(Redaxscript\Config::get('host'), Redaxscript\Config::get('name'), Redaxscript\Config::get('user'), Redaxscript\Config::get('password')); /* define session */ define('DB_CONNECTED', $_SESSION[ROOT . '/db_connected']); define('DB_ERROR', $_SESSION[ROOT . '/db_error']); define('LOGGED_IN', $_SESSION[ROOT . '/logged_in']); define('ATTACK_BLOCKED', $_SESSION[ROOT . '/attack_blocked']); /* setup charset */ if (function_exists('ini_set')) { ini_set('default_charset', s('charset')); } /* define parameter */ define('FIRST_PARAMETER', get_parameter('first')); define('FIRST_SUB_PARAMETER', get_parameter('first_sub')); define('SECOND_PARAMETER', get_parameter('second')); define('SECOND_SUB_PARAMETER', get_parameter('second_sub')); define('THIRD_PARAMETER', get_parameter('third')); define('THIRD_SUB_PARAMETER', get_parameter('third_sub')); if (LOGGED_IN == TOKEN && FIRST_PARAMETER == 'admin') { define('ADMIN_PARAMETER', get_parameter('admin')); define('TABLE_PARAMETER', get_parameter('table')); define('ID_PARAMETER', get_parameter('id')); define('ALIAS_PARAMETER', get_parameter('alias')); } else { undefine(array('ADMIN_PARAMETER', 'TABLE_PARAMETER', 'ID_PARAMETER', 'ALIAS_PARAMETER')); } define('LAST_PARAMETER', get_parameter('last')); define('LAST_SUB_PARAMETER', get_parameter('last_sub')); define('TOKEN_PARAMETER', get_parameter('token')); /* define routes */ define('FULL_ROUTE', get_route(0)); define('FULL_TOP_ROUTE', get_route(1)); if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()) == '' || file_exists('.htaccess') == '' || FILE == 'install.php') { define('REWRITE_ROUTE', '?p='); define('LANGUAGE_ROUTE', '&l='); define('TEMPLATE_ROUTE', '&t='); } else { define('REWRITE_ROUTE', ''); define('LANGUAGE_ROUTE', '.'); define('TEMPLATE_ROUTE', '.'); } /* redirect to install */ if (DB_CONNECTED == 0 && file_exists('install.php')) { define('REFRESH_ROUTE', ROOT . '/install.php'); } /* define tables */ if (FULL_ROUTE == '' || FIRST_PARAMETER == 'admin' && SECOND_PARAMETER == '') { /* check for homepage */ if (s('homepage') > 0) { $table = 'articles'; $id = s('homepage'); } else { $table = 'categories'; $id = 0; /* check order */ if (s('order') == 'asc') { $function = 'min'; } else { if (s('order') == 'desc') { $function = 'max'; } } $rank = query_plumb('rank', $table, $function); /* if category is published */ if ($rank) { $status = retrieve('status', $table, 'rank', $rank); if ($status == 1) { $id = retrieve('id', $table, 'rank', $rank); } } } define('FIRST_TABLE', $table); define('SECOND_TABLE', ''); define('THIRD_TABLE', ''); define('LAST_TABLE', $table); } else { if (FIRST_PARAMETER) { define('FIRST_TABLE', query_table(FIRST_PARAMETER)); } else { define('FIRST_TABLE', ''); } if (FIRST_TABLE) { define('SECOND_TABLE', query_table(SECOND_PARAMETER)); } else { define('SECOND_TABLE', ''); } if (SECOND_TABLE) { define('THIRD_TABLE', query_table(THIRD_PARAMETER)); } else { define('THIRD_TABLE', ''); } if (LAST_PARAMETER) { define('LAST_TABLE', query_table(LAST_PARAMETER)); } else { define('LAST_TABLE', ''); } if (LAST_TABLE) { $id = retrieve('id', LAST_TABLE, 'alias', LAST_PARAMETER); } } /* define ids */ if (LAST_TABLE == 'categories') { define('CATEGORY', $id); define('ARTICLE', ''); define('LAST_ID', $id); } else { if (LAST_TABLE == 'articles') { define('CATEGORY', ''); define('ARTICLE', $id); define('LAST_ID', $id); } else { undefine(array('CATEGORY', 'ARTICLE', 'LAST_ID')); } } /* define content error */ $aliasValidator = new Redaxscript\Validator\Alias(); if (LAST_ID == '' && $aliasValidator->validate(FIRST_PARAMETER, Redaxscript\Validator\Alias::MODE_DEFAULT) == Redaxscript\Validator\Validator::FAILED) { define('CONTENT_ERROR', 1); } else { define('CONTENT_ERROR', 0); } /* define user */ define('MY_IP', get_user_ip()); define('MY_BROWSER', get_user_agent(0)); define('MY_BROWSER_VERSION', get_user_agent(1)); define('MY_ENGINE', get_user_agent(2)); define('MY_MOBILE', get_user_agent(4)); define('MY_TABLET', get_user_agent(5)); /* if mobile or tablet */ if (MY_MOBILE || MY_TABLET) { define('MY_DESKTOP', ''); } else { define('MY_DESKTOP', get_user_agent(3)); } /* if logged in */ if (LOGGED_IN == TOKEN) { define('MY_ID', $_SESSION[ROOT . '/my_id']); define('MY_NAME', $_SESSION[ROOT . '/my_name']); define('MY_USER', $_SESSION[ROOT . '/my_user']); define('MY_EMAIL', $_SESSION[ROOT . '/my_email']); define('MY_GROUPS', $_SESSION[ROOT . '/my_groups']); /* define access */ $access_array = array('categories', 'articles', 'extras', 'comments', 'groups', 'users'); foreach ($access_array as $value) { define(strtoupper($value) . '_NEW', $_SESSION[ROOT . '/' . $value . '_new']); define(strtoupper($value) . '_EDIT', $_SESSION[ROOT . '/' . $value . '_edit']); define(strtoupper($value) . '_DELETE', $_SESSION[ROOT . '/' . $value . '_delete']); if (TABLE_PARAMETER == 'users' && ID_PARAMETER == MY_ID && $value == 'users') { define('USERS_EXCEPTION', 1); } else { if ($value == 'users') { define('USERS_EXCEPTION', 0); } } } define('MODULES_INSTALL', $_SESSION[ROOT . '/modules_install']); define('MODULES_EDIT', $_SESSION[ROOT . '/modules_edit']); define('MODULES_UNINSTALL', $_SESSION[ROOT . '/modules_uninstall']); define('SETTINGS_EDIT', $_SESSION[ROOT . '/settings_edit']); define('FILTER', $_SESSION[ROOT . '/filter']); } else { define('FILTER', 1); } /* define table access */ define('TABLE_NEW', constant(strtoupper(TABLE_PARAMETER) . '_NEW')); define('TABLE_INSTALL', constant(strtoupper(TABLE_PARAMETER) . '_INSTALL')); define('TABLE_EDIT', constant(strtoupper(TABLE_PARAMETER) . '_EDIT')); define('TABLE_DELETE', constant(strtoupper(TABLE_PARAMETER) . '_DELETE')); define('TABLE_UNINSTALL', constant(strtoupper(TABLE_PARAMETER) . '_UNINSTALL')); /* define time */ define('GMDATE', gmdate('D, d M Y H:i:s') . ' GMT'); define('GMDATE_PLUS_WEEK', gmdate('D, d M Y H:i:s', strtotime('+1 week')) . ' GMT'); define('GMDATE_PLUS_YEAR', gmdate('D, d M Y H:i:s', strtotime('+1 year')) . ' GMT'); define('NOW', date('Y-m-d H:i:s')); define('DELAY', date('Y-m-d H:i:s', strtotime('+1 minute'))); define('TODAY', date('Y-m-d')); /* future update */ define('UPDATE', $_SESSION[ROOT . '/update']); if (UPDATE == '') { future_update('articles'); future_update('extras'); $_SESSION[ROOT . '/update'] = DELAY; } else { if (UPDATE < NOW) { $_SESSION[ROOT . '/update'] = ''; } } }
function synlogin($get, $post) { $uid = $get['uid']; $username = $get['username']; if (!API_SYNLOGIN) { return API_RETURN_FORBIDDEN; } $data = $this->db->fetch_first('select uid from ' . $this->tablepre . 'member where username=\'' . mysql_real_escape_string($username) . '\' limit 1'); header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); if (isset($data['uid'])) { _setcookie('member_uid', $data['uid'], 86400 * 365); _setcookie('member_cookie', substr(md5(SITE_KEY . $data['uid']), 5, 20), 86400 * 365); $this->db->query('replace into ' . $this->tablepre . 'member_session value (' . $data['uid'] . ',\'' . get_user_ip() . '\',\'' . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . '\',' . time() . ')'); } }
/** * 在Update前,新增使用者的IP資料 * @param type $data */ protected function _pre_update($data) { $data["ip"] = get_user_ip(); return $data; }
logReaderEnabled: true, // Pause right away thresholdMax: 100, // Show a maximum of 100 messages in the console thresholdMin: 10 // When thresholdMax is reached, clear out all messages // in the console except the last 10 }); GAIA_log_reader.collapse(); </script> <? endif; ?> <? if ($layout->get('pageload_tracker')) : ?> <!-- BEGIN internal pixel tracker --> <img src="http://<?php echo MAIN_SERVER; ?> /internal/dev_t.php?ip=<?php echo ip2long(get_user_ip()); ?> &sip=<?php echo ip2long($_SERVER['SERVER_ADDR']); ?> &pid=<?php echo SC::get('session_page'); ?> &cls=<?php echo urlencode(SC::get('CIRCUIT_REQUEST_NAME')); ?> &tm=<?php echo SC::get('board_config.time_now'); ?> " width="1" height="1" border="0" /> <!-- END internal pixel tracker -->
function get_ip_to_country() { $country = ''; $ip = get_user_ip(); //$ip = '182.185.164.87'; if (!empty($ip)) { $api_url = 'http://www.geoplugin.net/json.gp?ip=' . $ip; $response = wp_remote_get($api_url); if (!is_wp_error($response)) { if ($response['response']['code'] == 200 && $response['response']['message'] == 'OK') { $json = $response['body']; $resp_array = json_decode($json, true); $country = $resp_array['geoplugin_countryName']; } } } return $country; }
function initializeBase() { // set the default timezone if (function_exists('date_default_timezone_set')) { @date_default_timezone_set('Asia/Shanghai'); } // define the start of our script define('MICROTIME', microtime(TRUE)); // path to the html templates folder. // base path define('DIR_BASE', dirname(dirname(__FILE__)) . '/'); // path to the private source code define('DIR_PRIVATE', DIR_BASE . 'private/'); // path to the 3rd Party vendors define('DIR_VENDORS', DIR_BASE . 'vendors/'); // path public_html folder //define('DIR_PUBLIC_HTML', DIR_BASE .'wp-content/themes/seecblog/'); define('DIR_PUBLIC_HTML', DIR_BASE); // define the path to the classes directory define('DIR_CLASSES', DIR_PRIVATE . 'classes/'); // path to php includes define('DIR_INCLUDES', DIR_PRIVATE . 'includes/'); // path to script includes. define('DIR_SCRIPT_INCLUDES', DIR_PRIVATE . 'script_includes/'); // path to circuit application directory root define('DIR_CIRCUIT_APPS', DIR_PRIVATE . 'circuit-apps/'); // include general fuctions include_once DIR_INCLUDES . 'functions.php'; // EVENTUALLY INTEGRATE THIS FILE INTO THIS PAGE // get rid of stupid errors. if (!defined('IN_PHPBB')) { define('IN_PHPBB', true); } // This will NOT report uninitialized variables if (SC::isEmpty('board_config.report_errors')) { error_reporting(E_ERROR | E_WARNING | E_PARSE); } else { error_reporting(E_ALL); ini_set('report_errors', 1); // ini_set('display_errors', 1); } // // Obtain and encode users IP $user_ip_address = get_user_ip(); define('USER_IP', encode_ip($user_ip_address)); SC::setGlobal('user_ip', USER_IP); // not sure if we still need this but just trying to keep consistent. // i converted to string replace instead of preg_match then preg_replace. // still not sure we need it tho. foreach ($_SERVER as $key => $ex_check) { if (is_string($ex_check)) { $_SERVER[$key] = str_replace(array('"', "'"), '', $ex_check); } } // becuase register_globals is turned off... // $PHP_SELF doesn't work anymore... // so, we have to force it to work for bw compatibility. // as soon as possible, remove this! SC::setGlobal('PHP_SELF', $_SERVER['PHP_SELF']); // start output buffering buffer_browser_output(); }
/** * Utility to test if the post is already liked * @since 0.5 */ function already_liked($post_id) { $post_users = NULL; $user_id = NULL; if (is_user_logged_in()) { // User is logged in // Get user ID $user_id = get_current_user_id(); $post_meta_users = get_post_meta($post_id, "_user_liked"); if (count($post_meta_users) != 0) { $post_users = $post_meta_users[0]; } } else { // User is anonymous $user_id = get_user_ip(); $post_meta_users = get_post_meta($post_id, "_user_IP"); if (count($post_meta_users) != 0) { // meta exists, set up values $post_users = $post_meta_users[0]; } } if (is_array($post_users) && in_array($user_id, $post_users)) { return true; } else { return false; } }
<p class="r-name"> <span><a title="<?php echo get_user_name($q_user); ?> " target="_blank" href="<?php echo WEB_PATH; ?> /uname/<?php echo idjia($item['q_uid']); ?> "><?php echo get_user_name($q_user); ?> </a></span> (<em><?php echo get_user_ip($item['id'], 'ipcity'); ?> </em>) </p> <p> 本雨参与: <span class="r-num"><?php echo $user_shop_number; ?> </span>人次 <a id="a_luckynum" class="r-look" href="javascript:;">点击查看</a> </p> <p>揭晓时间: <span><?php echo microt($item['q_end_time']); ?> </span>