本文整理汇总了PHP中get_server_name函数的典型用法代码示例。如果您正苦于以下问题:PHP get_server_name函数的具体用法?PHP get_server_name怎么用?PHP get_server_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_server_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init_sneak
function init_sneak()
{
global $globals, $db, $current_user;
// Create temporary table for chat if it does not exist
$db->query('CREATE TABLE IF NOT EXISTS `chats` ( `chat_time` DECIMAL( 12, 2 ) UNSIGNED NOT NULL DEFAULT 0 , `chat_uid` INTEGER UNSIGNED NOT NULL DEFAULT 0, `chat_room` enum("all","friends","admin") NOT NULL default "all", `chat_user` CHAR( 32 ) NOT NULL , `chat_text` CHAR( 255 ) NOT NULL , INDEX USING BTREE ( `chat_time` ) ) ENGINE = MEMORY MAX_ROWS = 2000');
$db->query('CREATE TABLE IF NOT EXISTS `sneakers` ( `sneaker_id` CHAR(24) NOT NULL, `sneaker_time` INTEGER UNSIGNED NOT NULL DEFAULT 0, `sneaker_user` INTEGER UNSIGNED NOT NULL DEFAULT 0, UNIQUE ( `sneaker_id` ) ) ENGINE = MEMORY MAX_ROWS = 1000');
// Check number of users if it's annonymous
if ($current_user->user_id == 0) {
$nusers = $db->get_var("select count(*) from sneakers");
if ($nusers > $globals['max_sneakers']) {
header('Location: http://' . get_server_name() . $globals['base_url'] . 'toomuch.html');
die;
}
}
// Check number of connections from the same IP addres
// if it comes from Netvibes, allow more
if (preg_match('/Netvibes Ajax/', $_SERVER["HTTP_USER_AGENT"])) {
$max_conn = 50;
} else {
$max_conn = 10;
}
$nusers = $db->get_var("select count(*) from sneakers where sneaker_id like '" . $globals['user_ip'] . "-%'");
if ($nusers > $max_conn) {
header('Location: http://' . get_server_name() . $globals['base_url'] . 'toomuch.html');
die;
}
// Delete all connections from the same IP, just to avoid stupid cheating
$db->query("delete from sneakers where sneaker_id like '" . $globals['user_ip'] . "%'");
}
示例2: init_sneak
function init_sneak()
{
global $globals, $db, $current_user;
// Create temporary table for chat if it does not exist
$db->query('CREATE TABLE IF NOT EXISTS `chats` ( `chat_time` DECIMAL( 12, 2 ) UNSIGNED NOT NULL DEFAULT 0 , `chat_uid` INTEGER UNSIGNED NOT NULL DEFAULT 0, `chat_room` enum("all","friends","admin") NOT NULL default "all", `chat_user` CHAR( 32 ) NOT NULL , `chat_text` CHAR( 255 ) NOT NULL , INDEX USING BTREE ( `chat_time` ) ) ENGINE = MEMORY MAX_ROWS = 2000');
$db->query('CREATE TABLE IF NOT EXISTS `sneakers` ( `sneaker_id` CHAR(24) NOT NULL, `sneaker_time` INTEGER UNSIGNED NOT NULL DEFAULT 0, `sneaker_user` INTEGER UNSIGNED NOT NULL DEFAULT 0, UNIQUE ( `sneaker_id` ) ) ENGINE = MEMORY MAX_ROWS = 1000');
// Check number of users if it's annonymous
if ($current_user->user_id == 0) {
$nusers = $db->get_var("select count(*) from sneakers");
if ($nusers > $globals['max_sneakers']) {
header('Location: ' . $globals['scheme'] . '//' . get_server_name() . $globals['base_url_general'] . 'toomuch.html');
die;
}
}
// Check number of connections from the same IP addres
$max_conn = 50;
$nusers = $db->get_var("select count(*) from sneakers where sneaker_id like '" . $globals['user_ip'] . "-%'");
if ($nusers > $max_conn) {
header('Location: ' . $globals['scheme'] . '//' . get_server_name() . $globals['base_url_general'] . 'toomuch.html');
die;
}
// Delete all connections from the same IP, just to avoid stupid cheating
$db->query("delete from sneakers where sneaker_id like '" . $globals['user_ip'] . "%'");
// Force to show conv counters even if they are zero
if ($current_user->user_id > 0) {
$globals['show_conv_counters'] = true;
}
}
示例3: do_credits
function do_credits()
{
global $dblang, $globals;
echo '<br style="clear: both;" />' . "\n";
echo '<div class="credits-strip">' . "\n";
echo '<span class="credits-strip-text">' . "\n";
// IMPORTANT: legal note only for our servers, CHANGE IT!!
if (preg_match('/meneame.net$/', get_server_name())) {
echo '<a href="http://bitassa.com/legal-meneame.php"><strong>' . _('información legal y condiciones de uso') . '</strong></a> | ';
}
// IMPORTANT: read above
echo '<a href="' . $globals['base_url'] . 'faq-' . $dblang . '.php#we">' . _('quiénes somos') . '</a>';
echo '<br />';
echo '<a href="http://meneame.wikispaces.com/" title="wiki meneame">' . _('wiki') . '</a>' . "\n";
echo ' | ' . _('código: ') . ' <a href="' . $globals['base_url'] . 'COPYING">' . _('licencia') . '</a>, <a href="' . $globals['base_url'] . 'archives/meneame-src.tgz">' . _('descargar') . '</a>';
echo ' | <a href="http://creativecommons.org/licenses/by-sa/2.5/">' . _('licencia de los gráficos') . '</a>' . "\n";
echo '</span>' . "\n";
echo '<span class="credits-strip-buttons">' . "\n";
echo '<a href="http://validator.w3.org/check?uri=referer"><img src="' . $globals['base_url'] . 'img/common/valid-xhtml10.png" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>' . "\n";
echo ' ' . "\n";
echo '<a href="http://jigsaw.w3.org/css-validator/check/referer"><img style="border:0;width:88px;height:31px" src="' . $globals['base_url'] . 'img/common/vcss.png" alt="Valid CSS!" /></a> ' . "\n";
echo '<a href="http://feedvalidator.org/check.cgi?url=http://meneame.net/rss2.php"><img src="' . $globals['base_url'] . 'img/common/valid-rss.png" alt="[Valid RSS]" title="Validate my RSS feed" /></a>' . "\n";
echo '</span>' . "\n";
echo '</div>' . "\n";
echo "<!--ben-tmp-functions:do_credits-->\n";
}
示例4: send_recover_mail
function send_recover_mail($user)
{
global $site_key, $globals;
if (!check_email($user->email)) {
return false;
}
$now = time();
if (!empty($globals['email_domain'])) {
$domain = $globals['email_domain'];
} else {
$domain = get_server_name();
}
$key = md5($user->id . $user->pass . $now . $site_key . get_server_name());
$url = $globals['base_url'] . 'profile?login=' . $user->username . '&t=' . $now . '&k=' . $key;
//echo "$user->username, $user->email, $url<br />";
$to = $user->email;
$subject = _('Recuperación o verificación de contraseña de ') . get_server_name();
$subject = mb_encode_mimeheader($subject, "UTF-8", "B", "\n");
$message = $to . ': ' . _('para poder acceder sin la clave, conéctate a la siguiente dirección en menos de 15 minutos:') . "\n\n{$url}\n\n";
$message .= _('Pasado este tiempo puedes volver a solicitar acceso en: ') . "\nhttp://" . get_server_name() . $globals['base_url'] . "login?op=recover\n\n";
$message .= _('Una vez en tu perfil, puedes cambiar la clave de acceso.') . "\n" . "\n";
$message .= "\n\n" . _('Este mensaje ha sido enviado a solicitud de la dirección: ') . $globals['user_ip'] . "\n\n";
$message .= "-- \n " . _('el equipo de menéame');
$message = wordwrap($message, 70);
$headers = 'Content-Type: text/plain; charset="utf-8"' . "\n" . 'From: ' . _('Avisos') . ' ' . $domain . ' <' . _('no_contestar') . "@{$domain}>\n" . 'Reply-To: ' . _('no_contestar') . "@{$domain}\n" . 'X-Mailer: meneame.net' . "\n";
$headers .= 'MIME-Version: 1.0' . "\n";
//$pars = '-fweb@'.get_server_name();
mail($to, $subject, $message, $headers);
echo '<p><strong>' . _('Correo enviado, mira tu buzón, allí están las instrucciones. Mira también en la carpeta de spam.') . '</strong></p>';
return true;
}
示例5: do_login
function do_login()
{
global $current_user, $globals;
$form_ip_check = check_form_auth_ip();
$previous_login_failed = log_get_date('login_failed', $globals['form_user_ip_int'], 0, 300);
echo '<form action="' . get_auth_link() . 'login.php" id="xxxthisform" method="post">' . "\n";
if ($_POST["processlogin"] == 1) {
// Check the IP, otherwise redirect
if (!$form_ip_check) {
header("Location: http://" . get_server_name() . $globals['base_url'] . "login.php");
die;
}
$username = clean_input_string(trim($_POST['username']));
$password = trim($_POST['password']);
if ($_POST['persistent']) {
$persistent = 3600000;
// 1000 hours
} else {
$persistent = 0;
}
// Check form
if (($previous_login_failed > 2 || $globals['captcha_first_login'] == true && !UserAuth::user_cookie_data()) && !ts_is_human()) {
log_insert('login_failed', $globals['form_user_ip_int'], 0);
recover_error(_('el código de seguridad no es correcto'));
} elseif ($current_user->Authenticate($username, md5($password), $persistent) == false) {
log_insert('login_failed', $globals['form_user_ip_int'], 0);
recover_error(_('usuario o email inexistente, sin validar, o clave incorrecta'));
$previous_login_failed++;
} else {
UserAuth::check_clon_from_cookies();
if (!empty($_REQUEST['return'])) {
header('Location: ' . $_REQUEST['return']);
} else {
header('Location: ./');
}
die;
}
}
echo '<p><label for="name">' . _('usuario o email') . ':</label><br />' . "\n";
echo '<input type="text" name="username" size="25" tabindex="1" id="name" value="' . htmlentities($username) . '" /></p>' . "\n";
echo '<p><label for="password">' . _('clave') . ':</label><br />' . "\n";
echo '<input type="password" name="password" id="password" size="25" tabindex="2"/></p>' . "\n";
echo '<p><label for="remember">' . _('recuérdame') . ': </label><input type="checkbox" name="persistent" id="remember" tabindex="3"/></p>' . "\n";
// Print captcha
if ($previous_login_failed > 2 || $globals['captcha_first_login'] == true && !UserAuth::user_cookie_data()) {
ts_print_form();
}
get_form_auth_ip();
echo '<p><input type="submit" value="login" tabindex="4" />' . "\n";
echo '<input type="hidden" name="processlogin" value="1"/></p>' . "\n";
echo '<input type="hidden" name="return" value="' . htmlspecialchars($_REQUEST['return']) . '"/>' . "\n";
echo '</form>' . "\n";
echo '<div><strong><a href="login.php?op=recover">' . _('¿has olvidado la contraseña?') . '</a></strong></div>' . "\n";
echo '<div style="margin-top: 30px">';
print_oauth_icons($_REQUEST['return']);
echo '</div>' . "\n";
}
示例6: __construct
private function __construct()
{
if (extension_loaded("apc")) {
$this->setKeyPrefix(get_server_name());
} else {
$message = __METHOD__ . "() apc extension not loaded.";
throw new Sabel_Exception_Runtime($message);
}
}
示例7: do_legal
function do_legal($legal_name, $target = '')
{
// IMPORTANT: legal note only for our servers, CHANGE IT!!
if (preg_match('/meneame.net$/', get_server_name())) {
echo '<a href="http://bitassa.com/legal-meneame.php" ' . $target . '>' . $legal_name . '</a>';
} else {
echo _('condiciones legales');
}
// IMPORTANT: read above
}
示例8: check_stats
function check_stats($string) {
global $globals;
if (preg_match('/^!statsu/', $string)) return do_statsu($string);
if (preg_match('/^!stats2/', $string)) return do_stats2($string);
if (preg_match('/^!stats1{0,1}/', $string)) return do_stats1($string);
if (preg_match('/^!help/', $string)) return _('comandos') . ': <a href="http://meneame.wikispaces.com/Comandos">meneame.wikispaces.com/Comandos</a>';
if (preg_match('/^!cabal/', $string)) return do_cabal($string);
if (preg_match('/^!wiki/', $string)) return 'wiki: <a href="http://meneame.wikispaces.com/">meneame.wikispaces.com</a>';
if (preg_match('/^!promote/', $string)) return '<a href="http://' . get_server_name().$globals['base_url']. 'archives/promote.html">promote.html</a>';
return '';
}
示例9: __construct
private function __construct($host, $port)
{
if (extension_loaded("memcache")) {
$this->memcache = new Memcache();
$this->addServer($host, $port);
$this->setKeyPrefix(get_server_name());
} else {
$message = __METHOD__ . "() memcache extension not loaded.";
throw new Sabel_Exception_Runtime($message);
}
}
示例10: do_header
function do_header($title, $id = 'home')
{
global $current_user, $dblang, $globals;
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
//echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $dblang . '" lang="' . $dblang . '">' . "\n";
echo '<head>' . "\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
echo "<title>" . _($title) . " // menéame</title>\n";
echo '<meta name="generator" content="Bluefish 1.0.4"/>' . "\n";
echo '<meta name="keywords" content="' . $globals['tags'] . '" />' . "\n";
echo '<link rel="microsummary" type="application/x.microsummary+xml" href="' . $globals['base_url'] . 'microsummary.xml" />' . "\n";
echo '<style type="text/css" media="screen">@import "' . $globals['base_url'] . 'css/es/mnm15.css";</style>' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('publicadas') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php" />' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('pendientes') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php?status=queued" />' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('todas') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php?status=all" />' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('comentarios') . '" href="http://' . get_server_name() . $globals['base_url'] . 'comments_rss2.php" />' . "\n";
echo '<link rel="icon" href="' . $globals['base_url'] . 'favicon.ico" type="image/x-icon" />' . "\n";
echo '<script type="text/javascript">var base_url="' . $globals['base_url'] . '";</script>';
echo '<script src="' . $globals['base_url'] . 'js/xmlhttp05.js" type="text/javascript"></script>' . "\n";
echo '</head>' . "\n";
echo "<body id=\"{$id}\" " . $globals['body-args'] . ">\n";
echo '<div id="container">' . "\n";
echo '<div id="logo">' . "\n";
echo '<a href="' . $globals['base_url'] . '"><img src="' . $globals['base_url'] . 'img/es/logo01.png" alt="meneame, noticias colaborativas" /></a>';
echo '</div>' . "\n";
echo '<div id="header">' . "\n";
// benjami: later - echo '<h1><a href="/">menéame</a></h1>' . "\n";
echo '<ul>' . "\n";
echo '<li><a href="' . $globals['base_url'] . 'telnet.php">' . _('¡la jefa!') . '</a></li>' . "\n";
echo '<li><a href="' . $globals['base_url'] . 'faq-' . $dblang . '.php">' . _('acerca de menéame') . '</a></li>' . "\n";
if ($title != "login") {
if ($current_user->authenticated) {
echo '<li><a href="' . $globals['base_url'] . 'login.php?op=logout&return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('cerrar sesión') . '</a></li>' . "\n";
echo '<li><a href="' . $globals['base_url'] . 'user.php?login=' . urlencode($current_user->user_login) . '">' . _('perfil de') . ' ' . $current_user->user_login . '</a></li>' . "\n";
} else {
echo '<li><a href="' . $globals['base_url'] . 'register.php">' . _('registrarse') . '</a></li>' . "\n";
echo '<li><a href="' . $globals['base_url'] . 'login.php?return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('login') . '</a></li>' . "\n";
}
}
echo '<li>' . "\n";
echo '<form action="' . $globals['base_url'] . '" method="get" id="thisform-search">' . "\n";
echo '<label for="search" accesskey="100" class="inside">' . _('buscar') . '</label>' . "\n";
if (!empty($_REQUEST['search'])) {
echo '<input type="text" name="search" id="search" value="' . htmlspecialchars(strip_tags($_REQUEST['search'])) . '" />' . "\n";
} else {
// benjami: onblur and onfocus to this
echo '<input name="search" id="search" value="' . _('buscar...') . '" type="text" onblur="if(this.value==\'\') this.value=\'' . _('buscar...') . '\';" onfocus="if(this.value==\'' . _('buscar...') . '\') this.value=\'\';"/>' . "\n";
}
echo '</form>' . "\n";
echo '</li>' . "\n";
echo '</ul>' . "\n";
echo '</div>' . "\n";
}
示例11: print_summary
function print_summary($type = 'full', $karma_best_comment = 0, $show_tags = true)
{
global $current_user, $current_user, $globals, $db;
if (!$this->read) {
return;
}
$this->is_votable();
switch ($this->status) {
case 'queued':
// another color box for not-published
$box_class = 'mnm-queued';
break;
case 'abuse':
// another color box for discarded
// another color box for discarded
case 'autodiscard':
// another color box for discarded
// another color box for discarded
case 'discard':
// another color box for discarded
$box_class = 'mnm-discarded';
break;
case 'published':
// default for published
// default for published
default:
$box_class = 'mnm-published';
break;
}
$this->has_warning = !(!$this->check_warn() || $this->is_discarded());
$this->is_editable = $this->author == $current_user->user_id && $this->is_editable();
$this->total_votes = $this->votes + $this->anonymous;
$this->rpermalink = $this->get_relative_permalink();
$this->author_html = '<a href="' . get_user_uri($this->username, 'history') . '">' . $this->username . '</a>';
$this->normal_link = preg_replace('/\\/mobile\\//', '/', $this->get_relative_permalink());
$this->show_shakebox = $type != 'preview' && $this->votes > 0;
$this->thumb_url = $this->has_thumb();
if ($this->status == 'abuse' || $this->has_warning) {
$this->negative_text = FALSE;
$negatives = $db->get_row("select SQL_CACHE vote_value, count(vote_value) as count from votes where vote_type='links' and vote_link_id={$this->id} and vote_value < 0 group by vote_value order by count desc limit 1");
if ($negatives->count > 2 && $negatives->count >= $this->negatives / 2 && ($negatives->vote_value == -6 || $negatives->vote_value == -8)) {
$this->negative_text = get_negative_vote($negatives->vote_value);
}
}
$text = $this->content;
$my_domain = get_server_name();
$parent_domain = preg_replace('/m\\./', '', $my_domain);
if ($parent_domain != $my_domain && preg_match('#[^\\.]' . preg_quote($parent_domain) . '/#', $text)) {
$text = preg_replace('#([^\\.])' . preg_quote($parent_domain) . '/#', "\$1{$my_domain}/", $text);
}
$vars = compact('type', 'karma_best_comment', 'show_tags', 'box_class', 'nofollow', 'url', 'text');
$vars['self'] = $this;
return Haanga::Load('mobile/link_summary.html', $vars);
}
示例12: do_header
function do_header($title)
{
echo '<!DOCTYPE NETSCAPE-Bookmark-file-1>' . "\n";
echo '<!-- This file was generated by Meneame -->' . "\n";
echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">' . "\n";
echo '<TITLE>Bookmarks</TITLE>' . "\n";
echo '<H1 LAST_MODIFIED="' . time() . '">Bookmarks</H1>' . "\n";
echo '<DL><P>' . "\n";
echo '<DT><H3 FOLDED >' . $title . '//' . get_server_name() . '</H3>' . "\n";
echo '<DL><P>' . "\n";
}
示例13: do_published
function do_published($page)
{
global $globals, $index_size;
$start = 1 + $page * $index_size;
$sql = "SELECT SQL_NO_CACHE link_uri from links where link_status='published' order by link_date asc limit {$start}, {$index_size}";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
while ($res = mysql_fetch_object($result)) {
echo '<url>' . "\n";
echo '<loc>http://' . get_server_name() . $globals['base_url'] . $globals['base_story_url'] . $res->link_uri . '</loc>' . "\n";
echo '</url>' . "\n";
}
echo '</urlset>' . "\n";
}
示例14: check_stats
function check_stats($string)
{
global $globals, $current_user;
if (preg_match('/^!top/', $string)) {
return do_top($string);
}
if (preg_match('/^!statsu/', $string)) {
return do_statsu($string);
}
if (preg_match('/^!stats2/', $string)) {
return do_stats2($string);
}
if (preg_match('/^!stats3/', $string)) {
return do_stats3($string);
}
if (preg_match('/^!stats1{0,1}/', $string)) {
return do_stats1($string);
}
if (preg_match('/^!time/', $string)) {
return date(" d-m-Y H:i:s") . ', ' . _('una hora menos en Canarias');
}
if (preg_match('/^!help/', $string)) {
return _('comandos') . ': http://meneame.wikispaces.com/Comandos';
}
if (preg_match('/^!cabal/', $string)) {
return do_cabal($string);
}
if (preg_match('/^!dariaunojo/', $string)) {
return do_ojo($string);
}
if (preg_match('/^!wiki/', $string)) {
return 'wiki: http://meneame.wikispaces.com/';
}
if (preg_match('/^!promote/', $string)) {
return 'http://' . get_server_name() . $globals['base_url'] . 'promote.php';
}
if (preg_match('/^!hoygan/', $string)) {
return '¡HOYGAN! BISITEN http://' . get_server_name() . $globals['base_url'] . 'sneak.php?hoygan=1 GRASIAS DE HANTEMANO';
}
if (preg_match('/^!webstats/', $string)) {
return 'http://www.quantcast.com/' . get_server_name();
}
if (preg_match('/^!ignore/', $string)) {
return do_ignore($string);
}
if (preg_match('/^!admins/', $string)) {
return do_admins($string);
}
return false;
}
示例15: get_uri_prefix
function get_uri_prefix($secure = false, $absolute = false)
{
$prefix = "";
if ($secure || $absolute) {
$server = get_server_name();
$prefix = ($secure ? "https" : "http") . "://" . $server;
}
if ($bus = Sabel_Context::getContext()->getBus()) {
if ($bus->get("NO_VIRTUAL_HOST") && defined("URI_PREFIX")) {
$prefix .= URI_PREFIX;
}
}
return $prefix;
}