本文整理汇总了PHP中clean_input_string函数的典型用法代码示例。如果您正苦于以下问题:PHP clean_input_string函数的具体用法?PHP clean_input_string怎么用?PHP clean_input_string使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clean_input_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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";
}
示例2: authorize
function authorize()
{
global $globals, $db;
$oauth_token = clean_input_string($_GET['oauth_token']);
$request_token_secret = $_COOKIE['oauth_token_secret'];
if (!empty($oauth_token) && !empty($request_token_secret)) {
$this->oauth->setToken($oauth_token, $request_token_secret);
try {
$access_token_info = $this->oauth->getAccessToken($this->access_token_url);
} catch (Exception $e) {
do_error(_('error de conexión a') . " {$this->service} (authorize1)", false, false);
}
} else {
do_error(_('acceso denegado'), false, false);
}
$this->token = $access_token_info['oauth_token'];
$this->secret = $access_token_info['oauth_token_secret'];
$this->uid = $access_token_info['user_id'];
$this->username = User::get_valid_username($access_token_info['screen_name']);
if (!$this->user_exists()) {
$this->oauth->setToken($access_token_info['oauth_token'], $access_token_info['oauth_token_secret']);
try {
$data = $this->oauth->fetch($this->credentials_url);
} catch (Exception $e) {
do_error(_('error de conexión a') . " {$this->service} (authorize2)", false, false);
}
if ($data) {
$response_info = $this->oauth->getLastResponse();
$response = json_decode($response_info);
if ($access_token_info['screen_name'] != $response->screen_name) {
do_error(_('datos incorrectos') . " {$this->service}", false, false);
}
$this->url = $response->url;
$this->names = $response->name;
$this->avatar = $response->profile_image_url;
}
$db->transaction();
$this->store_user();
} else {
$db->transaction();
}
$this->store_auth();
$db->commit();
$this->user_login();
}
示例3: clean_input_string
<?php
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include 'config.php';
include mnminclude . 'html1.php';
$globals['ads'] = true;
// Clean return variable
if (!empty($_REQUEST['return'])) {
$_REQUEST['return'] = clean_input_string($_REQUEST['return']);
}
if ($_GET["op"] === 'logout') {
$current_user->Logout($_REQUEST['return']);
}
// We need it because we modify headers
ob_start();
do_header("login");
do_navbar("login");
echo '<div id="genericform-contents">' . "\n";
//echo '<div id="genericform">'."\n";
if ($_GET["op"] === 'recover' || !empty($_POST['recover'])) {
do_recover();
} else {
do_login();
}
echo '</div>' . "\n";
//echo '</div>'."\n";
示例4: elseif
// The order is not exactly the votes
// but a time-decreasing function applied to the number of votes
$sql = "select link_id, (link_votes-link_negatives*2)*(1-(unix_timestamp(now())-unix_timestamp(link_date))*0.8/129600) as value from links, sub_statuses where id = " . SitesMgr::my_id() . " AND link_id = link AND status='published' and date > '{$min_date}' order by value desc limit 25";
} elseif (isset($_REQUEST['top_visited'])) {
$min_date = date("Y-m-d H:i:00", $globals['now'] - 172800);
// 48 hours
// The order is not exactly the votes
// but a time-decreasing function applied to the number of votes
$sql = "select link_id, counter*(1-(unix_timestamp(now())-unix_timestamp(link_date))*0.5/172800) as value from links, link_clicks, sub_statuses where sub_statuses.id = " . SitesMgr::my_id() . " AND link_id = link AND status='published' and date > '{$min_date}' and link_clicks.id = link order by value desc limit 25";
} else {
/////
// All the others
/////
// The link_status to search
if (!empty($_REQUEST['status'])) {
$status = $db->escape(clean_input_string(trim($_REQUEST['status'])));
} else {
// By default it searches on all
if ($_REQUEST['q']) {
$status = 'all';
include mnminclude . 'search.php';
$search_ids = do_search(true);
if ($search_ids['ids']) {
$search = ' link_id in (' . implode(',', $search_ids['ids']) . ')';
}
} else {
$status = 'published';
}
}
switch ($status) {
case 'published':
示例5: header
<?php
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include '../config.php';
header('Content-Type: text/plain; charset=UTF-8');
$type = clean_input_string($_REQUEST['type']);
$name = clean_input_string($_GET["name"]);
#echo "$type, $name...";
switch ($type) {
case 'username':
if (strlen($name) < 3) {
echo _('nombre demasiado corto');
return;
}
if (strlen($name) > 24) {
echo _('nombre demasiado largo');
return;
}
if (!check_username($name)) {
echo _('caracteres inválidos');
return;
}
if (!($current_user->user_id > 0 && $current_user->user_login == $name) && user_exists($name)) {
echo _('el usuario ya existe');
return;
}
示例6: redirect
}
} else {
if ($uid > 0) {
// Avoid anonymous and non admins users to use the id, it's a "duplicated" page
redirect(html_entity_decode(get_user_uri($login, $_REQUEST['view'])));
die;
}
$user->username = $login;
}
if (!$user->read()) {
do_error(_('usuario inexistente'), 404);
}
$login = $user->username;
// Just in case, we user the database username
$globals['search_options'] = array('u' => $user->username);
$view = clean_input_string($_REQUEST['view']);
if (empty($view)) {
$view = 'profile';
}
// The profile's use marked the current one as friend
if ($current_user->user_id) {
$user->friendship = User::friend_exists($user->id, $current_user->user_id);
} else {
$user->friendship = 0;
}
// For editing notes and sending privates
if ($current_user->user_id == $user->id || $current_user->admin || $user->friendship) {
$globals['extra_js'][] = 'ajaxupload.min.js';
}
// Enable user AdSense
// do_user_ad: 0 = noad, > 0: probability n/100
示例7: check_auth_page
include mnminclude . 'html1.php';
include mnminclude . 'avatars.php';
$globals['ads'] = false;
$globals['secure_page'] = True;
check_auth_page();
// We need it because we modify headers
ob_start();
$user_levels = array('autodisabled', 'disabled', 'normal', 'special', 'blogger', 'admin', 'god');
$bio_max = 300;
// Max bio length
// User recovering her password
if (!empty($_GET['login']) && !empty($_GET['t']) && !empty($_GET['k'])) {
$time = intval($_GET['t']);
$key = $_GET['k'];
$user = new User();
$user->username = clean_input_string($_GET['login']);
if ($user->read()) {
$now = time();
$key2 = md5($user->id . $user->pass . $time . $site_key . get_server_name());
//echo "$now, $time; $key == $key2\n";
if ($time > $now - 900 && $time < $now && $key == $key2) {
$db->query("update users set user_validated_date = now() where user_id = {$user->id} and user_validated_date is null");
$current_user->Authenticate($user->username, false);
header('Location: ' . get_user_uri($user->username));
die;
}
}
}
//// End recovery
// Check user, admin and authenticated user
if ($current_user->user_id > 0 && (empty($_REQUEST['login']) || $_REQUEST['login'] == $current_user->user_login)) {
示例8: store_extended_properties
public static function store_extended_properties($id = false, &$prefs)
{
if ($id == false) {
$id = self::my_id();
}
$dict = array();
$defaults = self::$extended_properties;
foreach ($prefs as $k => $v) {
if ($v !== '' && isset($defaults[$k]) && $defaults[$k] != $v) {
switch ($k) {
case 'rules':
case 'message':
$dict[$k] = clean_text_with_tags($v, 0, false, 300);
break;
default:
$dict[$k] = mb_substr(clean_input_string($v), 0, 100);
}
}
}
$key = self::PREFERENCES_KEY . $id;
$a = new Annotation($key);
if (!empty($dict)) {
$json = json_encode($dict);
$a->text = $json;
return $a->store();
}
return $a->delete();
}
示例9:
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include 'config.php';
include mnminclude . 'html1.php';
$globals['extra_js'][] = 'autocomplete/jquery.autocomplete.min.js';
$globals['extra_css'][] = 'jquery.autocomplete.css';
$globals['extra_js'][] = 'jquery.user_autocomplete.js';
$page_size = 20;
$offset = (get_current_page() - 1) * $page_size;
$globals['ads'] = true;
$u1 = User::get_valid_username(clean_input_string($_REQUEST['u1']));
$u2 = User::get_valid_username(clean_input_string($_REQUEST['u2']));
$id1 = User::get_user_id($u1);
$id2 = User::get_user_id($u2);
switch ($_REQUEST['type']) {
case 'comments':
$type = 'comments';
$prefix = 'comment';
break;
case 'posts':
default:
$type = 'posts';
$prefix = 'post';
}
do_header(sprintf(_('debate entre %s y %s'), $u1, $u2));
do_tabs('main', _('debate'), $globals['uri']);
/*** SIDEBAR ****/
示例10: array
<?php
include_once '../config.php';
$forbidden = array('ip', 'email', 'ip_int', 'user_level');
header('Content-Type: application/json; charset=utf-8');
if (empty($_GET['id']) || empty($_GET['fields'])) {
die;
}
$id = intval($_GET['id']);
$fields = clean_input_string($_GET['fields']);
// It has to remove parenthesis
if (empty($_GET['what'])) {
$what = 'link';
} else {
$what = $_GET['what'];
}
$object = false;
switch ($what) {
case 'link':
case 'links':
$object = Link::from_db($id, null, false);
break;
case 'comment':
case 'comments':
$object = Comment::from_db($id);
break;
case 'post':
case 'posts':
$object = Post::from_db($id);
break;
}
示例11: pingback_ping
function pingback_ping($args)
{
global $db, $globals;
$pagelinkedfrom = clean_input_string($args[0]);
//$pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom);
$pagelinkedto = clean_input_string($args[1]);
$title = '';
$urlfrom = parse_url($pagelinkedfrom);
$urltest = parse_url($pagelinkedto);
if (!$urlfrom || !$urltest) {
return new IXR_Error(0, 'Is there no link to us?');
}
if ($urltest['host'] != get_server_name()) {
return new IXR_Error(0, 'Is there no link to us?');
}
$base_uri = preg_quote($globals['base_url'] . $globals['base_story_url'], '/');
$uri = preg_replace("/^{$base_uri}/", '', $urltest[path]);
if (check_ban($globals['user_ip'], 'ip')) {
syslog(LOG_NOTICE, "Meneame: pingback, IP is banned ({$globals['user_ip']}): {$pagelinkedfrom} - {$pagelinkedto}");
return new IXR_Error(33, 'IP is banned.');
}
// Antispam of sites like xxx.yyy-zzz.info/archives/xxx.php
if (preg_match('/http:\\/\\/[a-z0-9]\\.[a-z0-9]+-[^\\/]+\\.info\\/archives\\/.+\\.php$/', $pagelinkedfrom)) {
return new IXR_Error(33, 'Host not allowed.');
}
if (check_ban($urlfrom[host], 'hostname', false)) {
syslog(LOG_NOTICE, "Meneame: pingback, site is banned: {$pagelinkedfrom} - {$pagelinkedto}");
return new IXR_Error(33, 'Site is banned.');
}
$link = new Link();
$link->uri = preg_replace('/#[\\w\\-\\_]+$/', '', $uri);
if (empty($uri) || !$link->read('uri')) {
syslog(LOG_NOTICE, "Meneame: pingback, story does not exist: {$pagelinkedto}");
return new IXR_Error(33, 'Story doesn\'t exist.');
}
if ($link->get_permalink() == $pagelinkedfrom) {
syslog(LOG_NOTICE, "Meneame: pingback, points to the same post: {$pagelinkedfrom} - {$pagelinkedto}");
return new IXR_Error(48, 'The pingback points to the same post.');
}
if ($link->date < time() - 86400 * 15) {
syslog(LOG_NOTICE, "Meneame: pingback, story is too old: {$pagelinkedto}");
return new IXR_Error(33, 'Story is too old for pingbacks.');
}
$trackres = new Trackback();
$trackres->link_id = $link->id;
$trackres->type = 'in';
$trackres->link = $pagelinkedfrom;
$trackres->url = $pagelinkedfrom;
if ($trackres->abuse()) {
return new IXR_Error(33, 'Don\'t send so many pings.');
}
$dupe = $trackres->read();
if ($dupe) {
syslog(LOG_NOTICE, "Meneame: pingback, we already have a ping from that URI for this post: {$pagelinkedfrom} - {$pagelinkedto}");
return new IXR_Error(48, 'The pingback has already been registered.');
}
// very stupid, but gives time to the 'from' server to publish !
sleep(1);
// Let's check the remote site
if (version_compare(phpversion(), '5.1.0') >= 0) {
$contents = @file_get_contents($pagelinkedfrom, FALSE, NULL, 0, 100000);
} else {
$contents = @file_get_contents($pagelinkedfrom);
}
if (!$contents) {
syslog(LOG_NOTICE, "Meneame: pingback, the provided URL does not seem to work: {$pagelinkedfrom} - {$pagelinkedto}");
return new IXR_Error(16, 'The source URL does not exist.');
}
if (preg_match('/charset=([a-zA-Z0-9-_]+)/i', $contents, $matches)) {
$this->encoding = trim($matches[1]);
if (strcasecmp($this->encoding, 'utf-8') != 0) {
$contents = iconv($this->encoding, 'UTF-8//IGNORE', $contents);
}
}
// Check is links back to us
$permalink = $link->get_permalink();
$permalink_q = preg_quote($permalink, '/');
$pattern = "/<\\s*a[^>]+href=[\"']" . $permalink_q . "[#\\/0-9a-z\\-]*[\"'][^>]*>/i";
if (!preg_match($pattern, $contents)) {
syslog(LOG_NOTICE, "Meneame: pingback, the provided URL does not have a link back to us: {$pagelinkedfrom} - {$pagelinkedto}");
return new IXR_Error(17, 'The source URL does not contain a link to the target URL, and so cannot be used as a source.');
}
// Search Title
if (preg_match('/<title[^<>]*>([^<>]*)<\\/title>/si', $contents, $matches)) {
$url_title = clean_text($matches[1]);
if (mb_strlen($url_title) > 3) {
$title = $url_title;
}
}
if (empty($title)) {
syslog(LOG_NOTICE, "Meneame: pingback, cannot find a title on that page: {$pagelinkedfrom} - {$pagelinkedto}");
return new IXR_Error(32, 'We cannot find a title on that page.');
}
$title = mb_strlen($title) > 120 ? mb_substr($title, 0, 120) . '...' : $title;
$trackres->title = $title;
$trackres->status = 'ok';
$trackres->store();
syslog(LOG_NOTICE, "Meneame: pingback ok: {$pagelinkedfrom} - {$pagelinkedto}");
return "Pingback from registered. Keep the web talking! :-)";
}
示例12: do_register2
function do_register2()
{
global $db, $current_user, $globals;
if (!ts_is_human()) {
register_error(_('el código de seguridad no es correcto'));
return;
}
if (!check_user_fields()) {
return;
}
// Extra check
if (!check_security_key($_POST['base_key'])) {
register_error(_('código incorrecto o pasó demasiado tiempo'));
return;
}
$username = clean_input_string(trim($_POST['username']));
// sanity check
$dbusername = $db->escape($username);
// sanity check
$password = UserAuth::hash(trim($_POST['password']));
$email = clean_input_string(trim($_POST['email']));
// sanity check
$dbemail = $db->escape($email);
// sanity check
$user_ip = $globals['form_user_ip'];
if (!user_exists($username)) {
if ($db->query("INSERT INTO users (user_login, user_login_register, user_email, user_email_register, user_pass, user_date, user_ip) VALUES ('{$dbusername}', '{$dbusername}', '{$dbemail}', '{$dbemail}', '{$password}', now(), '{$user_ip}')")) {
echo '<fieldset>' . "\n";
echo '<legend><span class="sign">' . _("registro de usuario") . '</span></legend>' . "\n";
$user = new User();
$user->username = $username;
if (!$user->read()) {
register_error(_('error insertando usuario en la base de datos'));
} else {
require_once mnminclude . 'mail.php';
$sent = send_recover_mail($user);
if ($sent) {
$globals['user_ip'] = $user_ip;
//we force to insert de log with the same IP as the form
Log::insert('user_new', $user->id, $user->id);
syslog(LOG_INFO, "new user {$user->id} {$user->username} {$email} {$user_ip}");
} else {
register_error(_("error enviando el correo electrónico, seguramente está bloqueado"));
}
}
echo '</fieldset>' . "\n";
} else {
register_error(_("error insertando usuario en la base de datos"));
}
} else {
register_error(_("el usuario ya existe"));
}
}
示例13: do_login
function do_login()
{
global $current_user, $globals;
// Start posavasos & ashacz code
$previous_login_failed = log_get_date('login_failed', $globals['original_user_ip_int'], 0, 90);
if ($previous_login_failed < 3 && empty($_POST["processlogin"])) {
echo '<div id="mini-faq" style="float:left; width:65%; margin-top: 10px;">' . "\n";
// gallir: Only prints if the user was redirected from submit.php
if (!empty($_REQUEST['return']) && preg_match('/submit\\.php/', $_REQUEST['return'])) {
echo '<p style="border:1px solid #FF9400; font-size:1.3em; background:#FEFBEA; font-weight:bold; padding:0.5em 1em;">Para enviar una historia debes ser un usuario registrado</p>' . "\n";
}
echo '<h3>¿Qué es menéame?</h3>' . "\n";
echo '<p>Es un web que te permite enviar una historia que será revisada por todos y será promovida, o no, a la página principal. Cuando un usuario envía una historia ésta queda en la <a href="shakeit.php" title="Cola de historias pendientes">cola de pendientes</a> hasta que reúne los votos suficientes para ser promovida a la página principal.</p>' . "\n";
echo '<h3>¿Todavía no eres usuario de menéame?</h3>' . "\n";
echo '<p>Como usuario registrado podrás, entre otras cosas:</p>' . "\n";
echo '<ul>' . "\n";
echo '<li>' . "\n";
echo '<strong>Enviar historias</strong><br />' . "\n";
echo 'Una vez registrado puedes enviar las historias que consideres interesantes para la comunidad. Si tienes algún tipo de duda sobre que tipo de historias puedes enviar revisa nuestras <a href="faq-es.php" title="Acerca de meneame">preguntas frecuentes sobre menéame.</a>' . "\n";
echo '</li>' . "\n";
echo '<li>' . "\n";
echo '<strong>Escribir comentarios</strong><br />' . "\n";
echo 'Puedes escribir tu opinión sobre las historias enviadas a menéame mediante comentarios de texto. También puedes votar positivamente aquellos comentarios ingeniosos, divertidos o interesantes y negativamente aquellos que consideres inoportunos.' . "\n";
echo '</li>' . "\n";
echo '<li>' . "\n";
echo '<strong>Perfil de usuario</strong><br />' . "\n";
echo 'Toda tu información como usuario está disponible desde la página de tu perfil. También puedes subir una imagen que representará a tu usuario en menéame. Incluso es posible compartir los ingresos publicitarios de Menéame, solo tienes que introducir el código de tu cuenta Google Adsense desde tu perfil.' . "\n";
echo '</li>' . "\n";
echo '<li>' . "\n";
echo '<strong>Chatear en tiempo real desde la fisgona</strong><br />' . "\n";
echo 'Gracias a la <a href="sneak.php" title="Fisgona">fisgona</a> puedes ver en tiempo real toda la actividad de menéame. Además como usuario registrado podrás chatear con mucha más gente de la comunidad menéame' . "\n";
echo '</li>' . "\n";
echo '</ul>' . "\n";
echo '<h3><a href="register.php" style="color:#FF6400; text-decoration:underline; display:block; width:8em; text-align:center; margin:0 auto; padding:0.5em 1em; border:3px double #FFE2C5; background:#FFF3E8;">Regístrate ahora</a></h3>' . "\n";
echo '</div>' . "\n";
echo '<div id="genericform" style="float:right; width:30%;">' . "\n";
//End posavasos & ashacz code
} else {
echo '<div id="genericform" style="float:auto;">' . "\n";
}
echo '<form action="login.php" id="thisform" method="post">' . "\n";
if ($_POST["processlogin"] == 1) {
$username = clean_input_string(trim($_POST['username']));
$password = trim($_POST['password']);
$persistent = $_POST['persistent'];
if ($previous_login_failed > 2 && !ts_is_human()) {
log_insert('login_failed', $globals['original_user_ip_int'], 0);
recover_error(_('El código de seguridad no es correcto!'));
} elseif ($current_user->Authenticate($username, $password, $persistent) == false) {
log_insert('login_failed', $globals['original_user_ip_int'], 0);
recover_error(_('usuario inexistente, sin validar, o clave incorrecta'));
$previous_login_failed++;
} else {
if (!empty($_REQUEST['return'])) {
header('Location: ' . $_REQUEST['return']);
} else {
header('Location: ./');
}
die;
}
}
echo '<fieldset>' . "\n";
echo '<legend><span class="sign">login</span></legend>' . "\n";
echo '<p class="l-top"><label for="name">' . _('usuario') . ':</label><br />' . "\n";
echo '<input type="text" name="username" size="25" tabindex="1" id="name" value="' . htmlentities($username) . '" /></p>' . "\n";
echo '<p class="l-mid"><label for="password">' . _('clave') . ':</label><br />' . "\n";
echo '<input type="password" name="password" id="password" size="25" tabindex="2"/></p>' . "\n";
echo '<p class="l-mid"><label for="remember">' . _('recuérdame') . ': </label><input type="checkbox" name="persistent" id="remember" tabindex="3"/></p>' . "\n";
if ($previous_login_failed > 2) {
ts_print_form();
}
echo '<p class="l-bot"><input type="submit" value="login" class="genericsubmit" 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 '</fieldset>' . "\n";
echo '</form>' . "\n";
echo '<div class="recoverpass" align="center"><h4><a href="login.php?op=recover">' . _('¿Has olvidado la contraseña?') . '</a></h4></div>' . "\n";
echo '</div>' . "\n";
echo '<br clear="all"/> ';
}
示例14: meta_get_current
function meta_get_current()
{
global $globals, $db, $current_user;
$globals['meta_current'] = 0;
$globals['meta'] = clean_input_string($_REQUEST['meta']);
//Check for personalisation
// Authenticated users
if ($current_user->user_id > 0) {
$categories = $db->get_col("SELECT pref_value FROM prefs WHERE pref_user_id = {$current_user->user_id} and pref_key = 'category' order by pref_value");
if ($categories) {
$current_user->has_personal = true;
$globals['meta_skip'] = '?meta=_all';
if (!$globals['meta']) {
$globals['meta_categories'] = implode(',', $categories);
$globals['meta'] = '_personal';
}
} else {
$globals['meta_categories'] = false;
}
} elseif ($_COOKIE['mnm_user_meta']) {
// anonymous users
$meta = $db->escape(clean_input_string($_COOKIE['mnm_user_meta']));
$globals['meta_skip'] = '?meta=_all';
$globals['meta_user_default'] = $db->get_var("select category_id from categories where category_uri = '{$meta}' and category_parent = 0");
// Anonymous can select metas by cookie
// Select user default only if no category has been selected
if (!$_REQUEST['category'] && !$globals['meta']) {
$globals['meta_current'] = $globals['meta_user_default'];
}
}
if ($_REQUEST['category']) {
$_REQUEST['category'] = $cat = (int) $_REQUEST['category'];
if ($globals['meta'][0] == '_') {
$globals['meta_current'] = $globals['meta'];
} else {
$globals['meta_current'] = (int) $db->get_var("select category_parent from categories where category_id = {$cat} and category_parent > 0");
$globals['meta'] = '';
}
} elseif ($globals['meta']) {
// Special metas begin with _
if ($globals['meta'][0] == '_') {
return 0;
}
$meta = $db->escape($globals['meta']);
$globals['meta_current'] = $db->get_var("select category_id from categories where category_uri = '{$meta}' and category_parent = 0");
if ($globals['meta_current']) {
$globals['meta'] = '';
// Security measure
}
}
if ($globals['meta_current'] > 0) {
$globals['meta_categories'] = meta_get_categories_list($globals['meta_current']);
if (!$globals['meta_categories']) {
$globals['meta_current'] = 0;
}
}
//echo "meta_current: " . $globals['meta_current'] . "<br/>\n";
return $globals['meta_current'];
}
示例15: header
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include '../config.php';
header('Content-Type: text/html; charset=UTF-8');
header('Pragma: no-cache');
header('Cache-Control: max-age=10, must-revalidate');
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$maxlen = 70;
$width = clean_input_string($_GET['width']);
$height = clean_input_string($_GET['height']);
$format = clean_input_string($_GET['format']);
$color_border = clean_input_string($_GET['color_border']);
$color_bg = clean_input_string($_GET['color_bg']);
$color_link = clean_input_string($_GET['color_link']);
$color_text = clean_input_string($_GET['color_text']);
$font_pt = clean_input_string($_GET['font_pt']);
echo '<html><head><title>banner</title></head><body>';
$from = time() - 1800;
$res = $db->get_row("select link_id, link_title, count(*) as votes from links, votes where vote_type='links' and vote_date > FROM_UNIXTIME({$from}) and vote_value > 0 and link_id = vote_link_id group by link_id order by votes desc limit 1");
if ($res) {
$votes_hour = $res->votes * 2;
$title['most'] = cut($res->link_title) . ' <span style="font-size: 90%;">[' . $votes_hour . " " . _('votos/hora') . "]</span>";
$url['most'] = "http://" . get_server_name() . "/story.php?id={$res->link_id}";
}
$res = $db->get_row("select link_id, link_title, link_votes from links where link_status = 'published' order by link_published_date desc limit 1");
if ($res) {
$title['published'] = cut($res->link_title) . ' <span style="font-size: 90%;">[' . $res->link_votes . " " . _('votos') . "]</span>";
$url['published'] = "http://" . get_server_name() . "/story.php?id={$res->link_id}";
}
$res = $db->get_row("select link_id, link_title, link_votes from links where link_status = 'queued' order by link_date desc limit 1");
if ($res) {