本文整理汇总了PHP中check_integer函数的典型用法代码示例。如果您正苦于以下问题:PHP check_integer函数的具体用法?PHP check_integer怎么用?PHP check_integer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_integer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_sidebar_top
function do_sidebar_top()
{
global $db, $dblang, $range_values, $range_names;
echo '<div id="sidebar">' . "\n";
echo '<ul class="main-menu">' . "\n";
echo '<li>' . "\n";
echo '<div class="column-select-us">' . "\n";
echo '<ul>' . "\n";
if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) {
$current_range = 0;
}
for ($i = 0; $i < count($range_values); $i++) {
if ($i == $current_range) {
echo '<li class="thiscat">' . $range_names[$i] . '</li>' . "\n";
} else {
echo '<li><a href="cloud.php?range=' . $i . '">' . $range_names[$i] . '</a></li>' . "\n";
}
}
echo '</ul>' . "\n";
echo '</div>' . "\n";
echo '</li>' . "\n";
do_standard_links();
echo '</ul>';
echo '</div>';
}
示例2: check_integer
/**
* Validates int
* @param mixed $data
* @param int $param
*/
public static function check_integer($data, $param)
{
if (check_integer($data, $param) == 0) {
echo 'Error validate integer';
exit;
}
}
示例3: get_current_page
function get_current_page()
{
if ($var = check_integer('page')) {
//return value of 'page', in support to above method
return $var;
} else {
//return 1, if it wasnt set before, page=1
return 1;
}
}
示例4: print_period_tabs
function print_period_tabs()
{
global $globals, $current_user, $range_values, $range_names;
if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) {
$current_range = 0;
}
echo '<ul class="tabsub-shakeit">' . "\n";
for ($i = 0; $i < count($range_values) - 1; $i++) {
if ($i == $current_range) {
$active = ' class="tabsub-this"';
} else {
$active = "";
}
echo '<li><a ' . $active . 'href="sitescloud.php?range=' . $i . '">' . $range_names[$i] . '</a></li>' . "\n";
}
echo '</ul>' . "\n";
}
示例5: print_period_tabs
function print_period_tabs()
{
global $globals, $current_user, $range_values, $range_names;
if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) {
$current_range = 0;
}
echo '<ul class="subheader">' . "\n";
for ($i = 0; $i < count($range_values); $i++) {
if ($i == $current_range) {
$active = ' class="selected"';
} else {
$active = "";
}
echo '<li' . $active . '><a href="topcommented.php?range=' . $i . '">' . $range_names[$i] . '</a></li>' . "\n";
}
echo '</ul>' . "\n";
}
示例6: print_period_tabs
function print_period_tabs()
{
global $globals, $current_user, $range_values, $range_names, $month, $year;
if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) {
$current_range = 0;
}
echo '<ul class="tabsub-shakeit">' . "\n";
if ($month > 0 && $year > 0) {
echo '<li><a class="tabsub-this" href="topstories.php?month=' . $month . '&year=' . $year . '">' . "{$month}-{$year}" . '</a></li>' . "\n";
$current_range = -1;
} elseif (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) {
$current_range = 0;
}
for ($i = 0; $i < count($range_values); $i++) {
if ($i == $current_range) {
$active = ' class="tabsub-this"';
} else {
$active = "";
}
echo '<li><a ' . $active . 'href="topstories.php?range=' . $i . '">' . $range_names[$i] . '</a></li>' . "\n";
}
echo '</ul>' . "\n";
}
示例7: get_cached_category_data
}
if ($_REQUEST['category']) {
if (!($cat = check_integer('category'))) {
$thecat = get_cached_category_data('category_safe_name', sanitize($_REQUEST['category'], 1));
$cat = $thecat->category_id;
if (!$cat) {
header("Location: {$my_pligg_base}/storyrss.php?title=" . urlencode($_REQUEST['category']));
die;
}
}
$where .= " AND link_category IN (SELECT category_ID from " . table_categories . " where category_id={$cat} OR category_parent={$cat} )";
$category_name = $db->get_var("SELECT category_name FROM " . table_categories . " WHERE category_id = {$cat} AND category_lang='{$dblang}'");
$title .= " | " . htmlspecialchars($category_name);
}
if (isset($_REQUEST['group'])) {
if (!($group = check_integer('group'))) {
$group = $db->get_var("SELECT group_id FROM " . table_groups . " WHERE group_safename = '" . $db->escape(strip_tags($_REQUEST['group'])) . "';");
}
$group_name = $db->get_var("SELECT group_name FROM " . table_groups . " WHERE group_id = '{$group}'");
if ($group_name) {
$title .= " | " . $group_name;
$where .= " AND link_group_id = '{$group}' ";
}
}
// This doesn't seem to work -kb
if ($search) {
$where .= $search;
$title = htmlspecialchars(sanitize($_GET['search'], 3));
}
$order_by = " ORDER BY {$order_field} DESC ";
$last_modified = $db->get_var($sql = "SELECT UNIX_TIMESTAMP(max({$order_field})) {$from} {$where}");
示例8: isset
global $db;
if ($current_user->user_id != 0) {
$action = isset($_GET['action']) ? sanitize($_GET['action'], 3) : '';
if ($action == 'add') {
if (!($linkid = check_integer('link'))) {
die("Invalid Link ID");
}
$link = new Link();
$link->id = $linkid;
$link->read();
$title = $db->get_var("SELECT link_title_url FROM " . table_links . " WHERE link_id = {$linkid}");
$count = $db->get_var("SELECT count(*) FROM " . table_saved_links . " WHERE saved_link_id = {$linkid} AND saved_user_id = {$current_user->user_id}");
if ($count == 0) {
$sql = "INSERT INTO " . table_saved_links . " (saved_user_id, saved_link_id) VALUES ({$current_user->user_id}, {$linkid})";
$db->query($sql);
}
} elseif ($action == 'remove') {
if (!($linkid = check_integer('link'))) {
die("Invalid Link ID");
}
$link = new Link();
$link->id = $linkid;
$link->read();
$title = $db->get_var("SELECT link_title_url FROM " . table_links . " WHERE link_id = {$linkid}");
$count = $db->get_var("SELECT count(*) FROM " . table_saved_links . " WHERE saved_link_id = {$linkid} AND saved_user_id = {$current_user->user_id}");
if ($count != 0) {
$sql = "DELETE FROM " . table_saved_links . " WHERE saved_user_id={$current_user->user_id} AND saved_link_id={$linkid}";
$db->query($sql);
}
}
}
示例9: print_period_tabs
function print_period_tabs()
{
global $globals, $current_user, $range_values, $range_names, $month, $year;
if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) {
$current_range = 0;
}
echo '<ul class="subheader">' . "\n";
if ($month > 0 && $year > 0) {
echo '<li class="selected"><a href="popular?month=' . $month . '&year=' . $year . '">' . "{$month}-{$year}" . '</a></li>' . "\n";
$current_range = -1;
} elseif (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) {
$current_range = 0;
}
for ($i = 0; $i < count($range_values); $i++) {
if ($i == $current_range) {
$active = ' class="selected"';
} else {
$active = "";
}
echo '<li' . $active . '><a href="popular?range=' . $i . '">' . $range_names[$i] . '</a></li>' . "\n";
}
echo '</ul>' . "\n";
}
示例10: _
}
$title = _('Menéame') . ": " . htmlspecialchars(strip_tags($_REQUEST['q']));
}
if ($meta = check_integer('meta')) {
$cat_list = meta_get_categories_list($meta);
if (!$cat_list) {
not_found();
}
$from_where .= " AND link_category in ({$cat_list})";
$meta_name = $db->get_var("SELECT category_name FROM categories WHERE category_id = {$meta} AND category_parent=0");
$title .= " -{$meta_name}-";
} elseif ($cat = check_integer('category')) {
$from_where .= " AND link_category={$cat} ";
$category_name = $db->get_var("SELECT category_name FROM categories WHERE category_id = {$cat} AND category_lang='{$dblang}'");
$title .= " -{$category_name}-";
} elseif ($uid = check_integer('personal')) {
$categories = $db->get_col("SELECT pref_value FROM prefs WHERE pref_user_id = {$uid} and pref_key = 'category' ");
$user_login = $db->get_var("select user_login from users where user_id={$uid}");
$title .= " -{$user_login}-";
if ($categories) {
$cats = implode(',', $categories);
$from_where .= " AND link_category in ({$cats}) ";
}
}
$order_by = " ORDER BY {$order_field} DESC ";
$last_modified = $db->get_var("SELECT UNIX_TIMESTAMP({$order_field}) {$from_where} {$order_by} LIMIT 1");
if ($if_modified > 0) {
$from_where .= " AND {$order_field} > FROM_UNIXTIME({$if_modified})";
}
$sql = "SELECT link_id {$from_where} {$order_by} LIMIT {$rows}";
}
示例11: show
function show()
{
global $db, $dblang, $URLMethod, $tags_words_limit, $tags_min_pts, $tags_max_pts;
// if we didnt set a word limit, use the default set in the config.php
if ($this->word_limit == NULL) {
$this->word_limit = $tags_words_limit;
}
// if we didnt set the minimum font points, use the default set in the config.php
if ($this->min_points == NULL) {
$this->min_points = $tags_min_pts;
}
// if we didnt set the maximum font points, use the default set in the config.php
if ($this->max_points == NULL) {
$this->max_points = $tags_max_pts;
}
// see if we clicked on a link to filter to a specific time range
if (($from = check_integer('range')) >= 0 && $from < count($this->range_values) && $this->range_values[$from] > 0) {
$from_time = time() - $this->range_values[$from];
$from_where = "FROM " . table_tags . ", " . table_links . " WHERE tag_lang='{$dblang}' and tag_date > FROM_UNIXTIME({$from_time}) and link_id = tag_link_id and ";
$time_query = "&from={$from_time}";
$this->smarty_variable->assign('time_query', $time_query);
} else {
$from_where = "FROM " . table_tags . ", " . table_links . " WHERE tag_lang='{$dblang}' and link_id = tag_link_id and ";
}
if ($this->filterTo == 'all') {
$from_where .= " link_status!='discard' ";
}
if ($this->filterTo == 'queued') {
$from_where .= " link_status='queued' ";
}
if ($this->filterTo == 'published') {
$from_where .= " link_status='published' ";
}
if ($this->filterCategory > 0) {
$from_where .= " and link_category='" . $this->filterCategory . "' ";
}
$from_where .= " GROUP BY tag_words";
$max = max($db->get_var("select count(*) as words {$from_where} order by words desc limit 1"), 2);
$coef = ($this->max_points - $this->min_points) / ($max - 1);
$sql = "select tag_words, count(*) as count {$from_where} order by count desc limit {$this->word_limit}";
//echo $sql;
$res = $db->get_results($sql);
if ($res) {
foreach ($res as $item) {
//echo $item->tag_words;
$words[$item->tag_words] = $item->count;
}
ksort($words);
$tag_number = array();
$tag_name = array();
$tag_count = array();
$tag_size = array();
$tag_url = array();
$tagnumber = 0;
foreach (array_keys($words) as $theword) {
$tag_number[$tagnumber] = tagnumber;
$tag_name[$tagnumber] = $theword;
$tag_count[$tagnumber] = $words[$theword];
$tag_size[$tagnumber] = $tags_min_pts + ($tag_count[$tagnumber] - 1) * $coef;
if (isset($time_query)) {
$tag_url[$tagnumber] = getmyurl('tag2', $tag_name[$tagnumber], $from_time);
} else {
$tag_url[$tagnumber] = getmyurl('tag', urlencode($tag_name[$tagnumber]));
}
$tagnumber = $tagnumber + 1;
}
}
// Set the smarty variables
if (isset($words)) {
$this->smarty_variable->assign('words', $words);
}
if (isset($tag_number)) {
$this->smarty_variable->assign('tag_number', $tag_number);
} else {
$this->smarty_variable->assign('tag_number', 0);
}
if (isset($tag_name)) {
$this->smarty_variable->assign('tag_name', $tag_name);
}
if (isset($tag_count)) {
$this->smarty_variable->assign('tag_count', $tag_count);
}
if (isset($tag_size)) {
$this->smarty_variable->assign('tag_size', $tag_size);
}
if (isset($tag_url)) {
$this->smarty_variable->assign('tag_url', $tag_url);
}
$this->smarty_variable->assign('tags_words_limit', $this->word_limit);
$this->smarty_variable->assign('tags_min_pts', $this->min_points);
$this->smarty_variable->assign('tags_max_pts', $this->max_points);
$this->smarty_variable->assign('tags_largest_tag', $max);
$this->smarty_variable->assign('tags_coef', $coef);
}
示例12: do_sidebar_shake
function do_sidebar_shake() {
global $db, $dblang, $globals;
echo '<div id="sidebar">';
echo '<ul class="main-menu">';
echo '<li>' . "\n";
echo '<div class="note-temp">' . "\n";
echo '<strong>'._('¡Tu voto es importante!').'</strong><br/><br/>';
//echo _('Menea las noticias que te parecen más interesantes. Cuando reciba suficientes votos será promovida a la página principal. ') . '<br/><br/>';
echo '<strong>'._('Usa las categorías para conseguir que la lista sea más corta. ').'</strong>'._(' Así no te perderás entradas interesantes de tus temas preferidos.')."\n";
echo '</div>' . "\n";
echo '</li>' . "\n";
// echo '<li><div class="boxed"><div>';
// Categories box
do_categories ('shakeit', check_integer('category'));
echo '<li>'. "\n";
echo '<div class="shakeit-form">'. "\n";
echo '<label for="search">'._('búsqueda en pendientes').'</label>'; "\n";
echo '<form class="shakeit-form" action="">'; "\n";
echo '<input class="shakeit-form-input" type="text" id="search2" name="search" value="'; "\n";
if (!empty($_REQUEST['search'])) echo htmlspecialchars(strip_tags($_REQUEST['search']));
echo '"/>'; "\n";
echo '<input class="shakeit-form-submit" type="submit" id="search-button" value="'._('buscar').'" />'; "\n";
echo '</form>'. "\n";
echo '</div>'. "\n";
echo '</li>'. "\n";
//do_banner_right_a(); // right side banner
echo '<li><div class="mnu-bugs"><a href="http://meneame.wikispaces.com/Bugs">'._("reportar un bug").'</a></div></li>' . "\n";
do_rss_box();
echo '</ul>'. "\n";
echo '</div>'. "\n";
}
示例13: header
// 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_once mnminclude . 'ban.php';
header('Content-Type: application/json; charset=UTF-8');
array_push($globals['cache-control'], 'no-cache');
http_cache();
if (check_ban_proxy()) {
error(_('IP no permitida'));
}
if (!($id = check_integer('id'))) {
error(_('falta el ID del partido'));
}
$vote = check_integer('vote');
if (!in_array($vote, array(0, 1, 2))) {
error(_('falta el valor del voto'));
}
if (empty($_REQUEST['user']) && $_REQUEST['user'] !== '0') {
error(_('falta el código de usuario'));
}
if (!check_security_key($_REQUEST['key'])) {
error(_('clave de control incorrecta'));
}
$match = new Match($id);
if (!$match->read_basic()) {
error(_('partido inexistente'));
}
if (!$match->is_votable()) {
error(_('votos cerrados'));
示例14: htmlspecialchars
$order_field = 'link_date';
$link_date = "date";
$home = "/upcoming.php";
break;
case 'all':
$title = "";
$order_field = 'link_date';
$link_date = "date";
break;
}
if ($status == 'all') {
$from_where = "FROM " . table_links . " WHERE link_status!='discard' ";
} else {
$from_where = "FROM " . table_links . " WHERE link_status='{$status}' ";
}
if ($cat = check_integer('category')) {
$from_where .= " AND link_category={$cat} ";
$category_name = $db->get_var("SELECT category_name FROM " . table_categories . " WHERE category_id = {$cat} AND category_lang='{$dblang}'");
$title .= " / " . htmlspecialchars($category_name);
}
if ($search) {
$from_where .= $search;
$title = _(PLIGG_Visual_RSS_RSSFeed) . ": " . htmlspecialchars($_REQUEST['search']);
}
$order_by = " ORDER BY {$order_field} DESC ";
$last_modified = $db->get_var("SELECT UNIX_TIMESTAMP(max({$order_field})) links {$from_where}");
$sql = "SELECT link_id {$from_where} {$order_by} LIMIT {$rows}";
}
do_rss_header($title);
$link = new Link();
$links = $db->get_col($sql);
示例15: sql_connect
}
if ($nb_erreur == 0) {
# we check if it does not already exist
$sgbd = sql_connect();
$sql_verif = sql_replace($sql['member']['verif_presence_member'], $_POST);
$res_verif = sql_query($sql_verif);
$nb_res = sql_num_rows($res_verif);
sql_free_result($res_verif);
sql_close($sgbd);
if ($nb_res != "0") {
$page['erreur'][$nb_erreur]['message'] = $lang['member']['E_exist_member'];
$nb_erreur++;
}
}
# size et weight
if (isset($_POST['size']) and !empty($_POST['size']) and !check_integer($_POST['size'])) {
$page['erreur'][$nb_erreur]['message'] = $lang['member']['E_invalid_size'];
$nb_erreur++;
}
# email
if (isset($_POST['email']) and !empty($_POST['email']) and !check_email($_POST['email'])) {
$page['erreur'][$nb_erreur]['message'] = $lang['member']['E_invalid_email'];
$nb_erreur++;
} elseif (isset($_POST['email']) and !empty($_POST['email'])) {
$sgbd = sql_connect();
$sql_verif_email = sql_replace($sql['member']['verif_member_email'], $_POST);
$res = sql_query($sql_verif_email);
$nb_res = sql_num_rows($res);
sql_free_result($res);
sql_close($sgbd);
if ($nb_res != "0") {