本文整理汇总了PHP中getInt函数的典型用法代码示例。如果您正苦于以下问题:PHP getInt函数的具体用法?PHP getInt怎么用?PHP getInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getInt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: charge
function charge($out)
{
global $total_college;
$f = $out['face'][0]['attribute'];
$total = $f['age']['value'] + getInt($f['gender']['confidence']) + getInt($f['glass']['confidence']) + getInt($f['race']['confidence']) + getInt($f['smiling']['value']);
return $total % $total_college;
}
示例2: removeAction
/**
* Удаление товара из корзины
*/
public function removeAction()
{
if (!isset($_POST['id']) || !isset($_POST['type'])) {
$this->errorAction(1001, 'Custom system error', ['postArgument' => 'noPostArgument']);
}
$id = getInt($_POST['id']);
$type = htmlspecialchars(trim($_POST['type']));
if (empty($id)) {
$this->errorAction(1001);
}
$cart = new ModelCart();
$cart->remove($id, $type);
$summ = $cart->getCostItems();
$count = $cart->getCountItems();
$this->addData(['succes' => 'Ok', 'count' => $count, 'summ' => $summ]);
$this->successAction();
}
示例3: trim
if ($showid != '') {
$showid = trim(preg_replace("/[^a-zA-Z0-9_]/", "", $showid));
$max_results = getInt('max-results', 10);
$start_index = getInt('start-index', 1);
$arr = getYoutubeSeasonsByShowID($showid, $max_results, $start_index);
echo json_encode($arr);
} else {
echo 'owner parameter not set';
}
break;
case 'getyoutubeshowownershows':
$link = getCmd('link', '');
if ($link) {
$u = getYoutubeGalleryShowOwner($link);
$max_results = getInt('max-results', 10);
$start_index = getInt('start-index', 1);
$ua = json_decode($u);
if ($ua == false) {
echo $ua;
}
$arr = getYoutubeShowsByUser($ua->username, $max_results, $start_index);
print_r($arr);
} else {
echo 'link parameter not set';
}
break;
case '':
echo '<html><body></body></html>';
break;
default:
echo 'unknown task';
示例4: notification
if ($userinfo['user_group'] > $forum_postgroup) {
require_once ABSOLUTE_BASEPATH . '/header.' . PHPEXT;
notification($_LANG['insufficient_privileges'], $_SERVER['HTTP_REFERER'], 3);
die;
}
$res = $db->query('select topic_disabled from ' . $_CONF['dbprefix'] . 'topics ' . "where topic_id='{$id}'");
$db->freeResult();
$topic_disabled = getInt($res[0]['topic_disabled']);
unset($res);
if ($topic_disabled) {
require_once ABSOLUTE_BASEPATH . '/header.' . PHPEXT;
notification($_LANG['topic_disabled'], $_SERVER['HTTP_REFERER'], 3);
die;
}
$db->query('insert into ' . $_CONF['dbprefix'] . 'posts(topic_id, forum_id, poster_id, ' . 'post_time, post_content, poster_ip, poster_so, poster_browser) ' . "values('{$topic_id}', '{$forum_id}', '{$user_id}', " . time() . ", '{$content}', '{$ip}', '{$so}', '{$browser}')");
$res = $db->query('select count(*) as numposts from ' . $_CONF['dbprefix'] . "posts where topic_id='" . $topic_id . "'");
$numPosts = getInt($res[0]['numposts']);
$res = $db->query('select post_id as maxpost from ' . $_CONF['dbprefix'] . 'posts where ' . "topic_id='{$topic_id}' order by post_id desc limit 1");
$maxPost = getInt($res[0]['maxpost']);
unset($res);
$db->freeResult();
$db->close();
if ($numPosts >= 10) {
$lastPage = (int) (($numPosts - 1) / 10) + 1;
header('Location: ' . BASEDIR . "topic/{$topic_id}/{$lastPage}#{$maxPost}");
} else {
header('Location: ' . BASEDIR . "topic/{$topic_id}/1#{$maxPost}");
}
?>
示例5: img2ascii
if ($ext == 'jpg') {
$ext = 'jpeg';
}
$ascii = img2ascii($_FILES['avatarfile']['tmp_name'], $ext);
if (!empty($ascii)) {
$db->query('update ' . $_CONF['dbprefix'] . "users set user_avatar='" . sanitizeQuery($ascii) . "' " . "where user_id='" . getInt($uid) . "'");
}
}
if (isset($_POST['removeavatar'])) {
$db->query('update ' . $_CONF['dbprefix'] . "users set user_avatar=null where user_id=" . getInt($uid));
}
if (isset($_POST['removeuser'])) {
$db->query('delete from ' . $_CONF['dbprefix'] . 'users where user_id=' . $uid);
}
if ($_POST['userlev'] != $results['user_group']) {
$db->query('update ' . $_CONF['dbprefix'] . "users set user_group=" . getInt($_POST['userlev']) . ' where user_id=' . $uid);
}
if (isset($_POST['ban'])) {
switch ($_POST['ban']) {
case 'ban':
if (!$results['user_disabled']) {
$db->query('update ' . $_CONF['dbprefix'] . 'users set user_disabled=1 where user_id=' . $uid);
}
break;
case 'unban':
if ($results['user_disabled']) {
$db->query('update ' . $_CONF['dbprefix'] . 'users set user_disabled=0 where user_id=' . $uid);
}
break;
}
}
示例6: array
}
}
$smarty->assign('lang', $_LANG);
$smarty->assign('info', $info);
$smarty->assign('ur_here', $view ? $_LANG['ur_view'] : $_LANG['ur_install']);
$smarty->assign('action_link', array('href' => 'website.php?act=list', 'text' => $_LANG['webstte_list']));
$smarty->assign('type', $type);
$smarty->assign('act', $view ? 'update_website' : 'query_install');
assign_query_info();
$smarty->display('website_install.htm');
} elseif ($_REQUEST['act'] == 'query_install' || $_REQUEST['act'] == 'update_website') {
$type = getChar('type');
//$app_key = getChar('app_key');
//$app_secret = getChar('app_secret');
$rank_name = getChar('rank_name');
$rank_id = getInt('rank_id');
$query = $_REQUEST['act'] == 'query_install';
$olb_rank_name = getChar('olb_rank_name');
if ($query || !$rank_id) {
$sql = 'INSERT INTO ' . $ecs->table('user_rank') . '(`rank_name` , `discount` , `special_rank`,`show_price`) VALUES' . "('{$rank_name}' , '100' , '1','0')";
$db->query($sql);
$rank_id = $db->insert_id();
} else {
if ($rank_name != $olb_rank_name && $rank_id) {
$sql = 'UPDATE ' . $ecs->table('user_rank') . ' SET `rank_name` = ' . "'{$rank_name}' WHERE `rank_id`='{$rank_id}'";
$db->query($sql);
}
}
$commnet = '<?php ' . "\r\n // 第三方插件登录信息---------------------\r\n" . "define('RANK_ID' , '{$rank_id}'); \r\n";
foreach ($_POST['jntoo'] as $key => $val) {
$commnet .= "define('{$key}' , '{$val}'); \r\n";
示例7: process_post_data
/**
* process_post_data()
*
* Function to process the form posted
*/
function process_post_data()
{
global $CONFIG;
global $user_albums_list, $lang_errors;
$superCage = Inspekt::makeSuperCage();
$user_album_set = array();
foreach ($user_albums_list as $album) {
$user_album_set[$album['aid']] = 1;
}
$pid = $superCage->post->getInt('pid');
if (!is_array($pid)) {
cpg_die(CRITICAL_ERROR, $lang_errors['param_missing'], __FILE__, __LINE__);
}
$pid_array = $pid;
if ($superCage->post->keyExists('galleryicon')) {
$galleryincon = $superCage->post->getInt('galleyicon');
} else {
$galleryicon = '';
}
foreach ($pid_array as $pid) {
$aid = $superCage->post->getInt("aid{$pid}");
$title = get_post_var('title', $pid);
$caption = get_post_var('caption', $pid);
$keywords = get_post_var('keywords', $pid);
$user1 = get_post_var('user1', $pid);
$user2 = get_post_var('user2', $pid);
$user3 = get_post_var('user3', $pid);
$user4 = get_post_var('user4', $pid);
$delete = false;
$reset_vcount = false;
$reset_votes = false;
$del_comments = false;
$isgalleryicon = $galleryicon === $pid;
if ($superCage->post->keyExists('delete' . $pid)) {
$delete = $superCage->post->getInt('delete' . $pid);
}
if ($superCage->post->keyExists('reset_vcount' . $pid)) {
$reset_vcount = $superCage->post - getInt('reset_vcount' . $pid);
}
if ($superCage->post->keyExists('reset_votes' . $pid)) {
$reset_votes = $superCage->post->getInt('reset_votes' . $pid);
}
if ($superCage->post->keyExists('del_comments' . $pid)) {
$del_comments = $superCage->post->getInt('del_comments' . $pid) || $delete;
}
// OVI
//$query = "SELECT category, filepath, filename, owner_id FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND pid='$pid'";
$query = "SELECT {$CONFIG['TABLE_PICTURES']}.aid, category, filepath, filename, owner_id, total_filesize FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND pid='{$pid}'";
$result = cpg_db_query($query);
if (!mysql_num_rows($result)) {
cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
}
$pic = mysql_fetch_array($result);
mysql_free_result($result);
if (!GALLERY_ADMIN_MODE && !MODERATOR_MODE && !USER_ADMIN_MODE && !user_is_allowed() && !$CONFIG['users_can_edit_pics']) {
if ($pic['category'] != FIRST_USER_CAT + USER_ID) {
cpg_die(ERROR, $lang_errors['perm_denied'] . "<br />(picture category = {$pic['category']}/ {$pid})", __FILE__, __LINE__);
}
if (!isset($user_album_set[$aid])) {
cpg_die(ERROR, $lang_errors['perm_denied'] . "<br />(target album = {$aid})", __FILE__, __LINE__);
}
}
$update = "aid = '{$aid}'";
$update .= ", title = '{$title}'";
$update .= ", caption = '{$caption}'";
$update .= ", keywords = '{$keywords}'";
$update .= ", user1 = '{$user1}'";
$update .= ", user2 = '{$user2}'";
$update .= ", user3 = '{$user3}'";
$update .= ", user4 = '{$user4}'";
if ($isgalleryicon && $pic['category'] > FIRST_USER_CAT) {
$sql = 'UPDATE ' . $CONFIG['TABLE_PICTURES'] . ' SET galleryicon=0 WHERE owner_id=' . $pic['owner_id'] . ';';
cpg_db_query($sql);
$update .= ", galleryicon = " . addslashes($galleryicon);
}
if (is_movie($pic['filename'])) {
$pwidth = $superCage->post->getInt('pwidth' . $pid);
$pheight = $superCage->post->getInt('pheight' . $pid);
$update .= ", pwidth = " . $pwidth;
$update .= ", pheight = " . $pheight;
}
if ($reset_vcount) {
$update .= ", hits = '0'";
resetDetailHits($pid);
}
if ($reset_votes) {
$update .= ", pic_rating = '0', votes = '0'";
resetDetailVotes($pid);
}
if (GALLERY_ADMIN_MODE || UPLOAD_APPROVAL_MODE || MODERATOR_MODE) {
if ($superCage->post->keyExists('approved' . $pid)) {
$approved = $superCage->post->getAlpha('approved' . $pid);
}
if ($approved) {
$update .= ", approved = 'YES'";
//.........这里部分代码省略.........
示例8: getInt
</a>
<?php
$replies = $db->query('select topic_replies from ' . $_CONF['dbprefix'] . 'topics where ' . "topic_id = '" . getInt($row['topic_id']) . "'");
$db->freeResult();
$replies = getInt($replies[0]['topic_replies']) - 1;
if ($replies >= 10) {
print ' [ ';
$pages = (int) ($replies / 10) + 1;
for ($i = 1; $i <= $pages; $i++) {
print '<a href="' . BASEDIR . 'topic/' . getInt($row['topic_id']) . '/' . $i . '">' . $i . '</a> ';
}
print ']';
}
$author = $db->query('select user_id, username from ' . $_CONF['dbprefix'] . 'users u join ' . $_CONF['dbprefix'] . 'topics t on u.user_id=t.topic_poster ' . "where t.topic_id='" . getInt($row['topic_id']) . "'");
$db->freeResult();
$user_id = getInt($author[0]['user_id']);
$user_author = sanitizeHTML($author[0]['username']);
print "<br>\n -> " . $_LANG['posted_by'] . ' <a href="' . BASEDIR . 'user/' . $user_id . '">' . $user_author . '</a>';
?>
</td>
<td class="newposts"><?php
print $_LANG['latest_post'] . ': ';
?>
<a href="<?php
print BASEDIR;
?>
user/<?php
print intval($row['poster_id']);
?>
"><?php
示例9: getInt
$res = $db->query('select forum_postgroup from ' . $_CONF['dbprefix'] . 'forums ' . "where forum_id='" . $forum_id . "'");
$db->freeResult();
$forum_postgroup = getInt($res[0]['forum_postgroup']);
$res = $db->query('select topic_disabled from ' . $_CONF['dbprefix'] . 'topics ' . "where topic_id='{$id}'");
$db->freeResult();
$topic_disabled = getInt($res[0]['topic_disabled']);
$topic_sticked = getInt($res[0]['topic_sticked']);
unset($res);
if ($userinfo['user_group'] <= USERLEV_MOD) {
?>
<center><select name="modActions" style="font-size: 10px" onChange='modActions ("<?php
print BASEDIR;
?>
",
<?php
print getInt($row['topic_id']);
?>
, this.value)'>
<option value="none">-- <?php
print $_LANG['mod_actions'];
?>
</option>
<option value="remove"><?php
print $_LANG['remove'];
?>
</option>
<?php
if (!$topic_disabled) {
?>
<option value="lock"><?php
示例10: die
die(json_encode($_RESULT));
break;
case 'add':
$path_id = isset(MSCore::urls()->vars[2]) ? (int) MSCore::urls()->vars[2] : 0;
$page = isset(MSCore::urls()->vars[3]) ? (int) MSCore::urls()->vars[3] : 0;
$new_item_id = isset(MSCore::urls()->vars[4]) ? (int) MSCore::urls()->vars[4] : 0;
/* ACTION */
$OUT_CONFIG = $CONFIG;
$CONFIG = $Tape->generateConfigValues($new_item_id);
if (isset($_REQUEST['conf'])) {
//защита от дублирования поля code {start}
if (!empty($_REQUEST['conf'][1]['code'])) {
$id = !empty($_REQUEST['id']) ? $_REQUEST['id'] : 0;
$tableName = $CONFIG['tables']['items']['db_name'];
$codeItem = $_REQUEST['conf'][1]['code'];
if (MSCore::db()->getOne('SELECT `id` FROM `' . PRFX . $tableName . '` WHERE' . ($id != 0 ? ' `id`!=' . $id . ' AND' : '') . ' `path_id` = "' . getInt($path_id) . '" AND `code` = "' . MSCore::db()->pre($codeItem) . '"')) {
$_REQUEST['conf'][1]['code'] = $codeItem . '-' . date('dHis');
}
}
//защита от дублирования поля code {end}
if ($inserted_id = $Tape->saveItem(false)) {
$vars = $Tape->generateVars();
$vars['apply'] = isset(MSCore::urls()->vars[5]) && MSCore::urls()->vars[5] > 0 ? 1 : 0;
$inserted_id = '<input id="inserted_id" type="hidden" value="' . $inserted_id . '" name="id"/>';
$_RESULT = array('content' => array(template('moduleTape/fast', $vars), $inserted_id));
die(json_encode($_RESULT));
} else {
echo '<i style="display:none">Fatal error: </i>Введенный "Символьный код" уже занят';
/**
* TODO: Сейчас на все ошибки одна причина, исправить :)
*/
示例11: getInt
<?php
function getInt()
{
return (int) +trim(fgets(STDIN));
}
$l = getInt();
$t = getInt();
while ($t-- > 0) {
$arr = explode(' ', trim(fgets(STDIN)));
if ($arr[0] < $l or $arr[1] < $l) {
echo "UPLOAD ANOTHER\n";
} elseif ($arr[0] == $arr[1]) {
echo "ACCEPTED\n";
} else {
echo "CROP IT\n";
}
}
示例12: notification
if (!$session->logged) {
require_once ABSOLUTE_BASEPATH . '/header.' . PHPEXT;
notification($_LANG['insufficient_privileges'], $_SERVER['HTTP_REFERER'], 3);
die;
}
$db = new nullBB_Database($_CONF, $_LANG);
$post_id = getInt($_GET['post_id']);
$res = $db->query('select poster_id from ' . $_CONF['dbprefix'] . 'posts where post_id=' . $post_id);
$db->freeResult();
$poster_id = getInt($res[0]['poster_id']);
if ($userinfo['user_group'] > USERLEV_MOD && $userinfo['user_id'] != $poster_id) {
require_once ABSOLUTE_BASEPATH . '/header.' . PHPEXT;
notification($_LANG['insufficient_privileges'], $_SERVER['HTTP_REFERER'], 3);
die;
}
$res = $db->query('select poster_ip from ' . $_CONF['dbprefix'] . 'posts where post_id=' . $post_id);
$db->freeResult();
$addr = sanitizeHTML($res[0]['poster_ip']);
print $addr;
unset($res);
exit(0);
}
$db = new nullBB_Database($_CONF, $_LANG);
$res = $db->query('select post_content from ' . $_CONF['dbprefix'] . 'posts ' . "where post_id='" . getInt($_GET['post_id']) . "'");
$db->freeResult();
print htmlspecialchars($res[0]['post_content']);
unset($res);
$db->close();
?>
示例13: getString
$town = getString("town", null);
$order = getString("order", "default");
$zoom = getString("zoom", null);
$layout = getString("layout", "default");
$caption = getString("caption", $words["key"]);
$groupby = getString("groupby", "player");
$colby = getString("colby", $groupby);
$lines = getBool("lines");
$casen = getBool("casen");
$azoom = getBool("azoom");
$nocache = getBool("nocache");
$dotsize = getFloat("dotsize", 1);
$maxdist = getInt("maxdist", null);
$mindist = getInt("mindist", null);
$maxpop = getInt("maxpop", null);
$minpop = getInt("minpop", null);
$table = preg_replace("/[^a-zA-Z0-9]/", "_", $server);
$s_server = sql_escape_string($server);
$server_info = sql_fetch_row(sql_query("SELECT * FROM servers WHERE name='{$s_server}'"));
// }}}
// figure out where we are {{{
if ($layout == "spread") {
$cx = 768 / 2;
$cy = 256;
} else {
$cx = 256;
$cy = 256;
}
// }}}
/* figure out where to focus {{{
*
示例14: getInt
die;
}
$db->query('delete from ' . $_CONF['dbprefix'] . 'privmsgs where privmsg_id=' . getInt($_GET['msg_id']) . ' ' . 'and privmsg_to=' . getInt($userinfo['user_id']));
require_once ABSOLUTE_BASEPATH . '/header.' . PHPEXT;
notification($_LANG['delete_privmsg_ok'], $_SERVER['HTTP_REFERER'], 3);
die;
}
$db = new nullBB_Database($_CONF, $_LANG);
$res = $db->query('select * from ' . $_CONF['dbprefix'] . 'privmsgs ' . "where privmsg_id=" . getInt($_GET['msg_id']) . " and privmsg_to=" . getInt($userinfo['user_id']));
$db->freeResult();
if (empty($res)) {
print $_LANG['privmsg_not_found'];
die;
}
$res = $res[0];
if ($res['privmsg_seen'] == false) {
$db->query('update ' . $_CONF['dbprefix'] . 'privmsgs set privmsg_seen=1 ' . 'where privmsg_id=' . getInt($_GET['msg_id']) . ' and privmsg_to=' . getInt($userinfo['user_id']));
}
$from = $db->query('select username from ' . $_CONF['dbprefix'] . 'users where user_id=' . getInt($res['privmsg_from']));
$db->freeResult();
$from = sanitizeHTML($from[0]['username']);
$to = sanitizeHTML($userinfo['username']);
$content = bb2html($res['privmsg_content']);
print '<li class="privmsgHead">' . $_LANG['from'] . ': ' . '<a href="' . BASEDIR . 'user/' . getInt($res['privmsg_from']) . '">' . $from . "</a></li>\n";
print '<li class="privmsgHead">' . $_LANG['to'] . ': ' . '<a href="' . BASEDIR . 'user/' . getInt($res['privmsg_to']) . '">' . $to . "</a></li><br>\n";
print '<div class="privmsgContent">' . $content . "</div><br>\n";
unset($res);
$db->close();
?>
示例15: foreach
print $_LANG['registered_since'];
?>
</th>
<th><?php
print $_LANG['posts'];
?>
</th>
<th><?php
print $_LANG['reputation'];
?>
</th>
</tr>
<?php
foreach ($res as $row) {
print '<tr class="users">' . '<td class="users"><a href="' . BASEDIR . 'user/' . $row['user_id'] . '">' . sanitizeHTML($row['username']) . '</a></td>' . '<td class="usersCenter">' . @date('d M Y, h:i:s a', $row['user_regtime']) . '</td>' . '<td class="usersRight">' . getInt($row['user_posts']) . '</td>' . '<td class="usersRight">' . getInt($row['user_karma']) . '</td></tr>';
}
?>
</table>
<?php
unset($res);
$db->close();
?>
<?php
require_once ABSOLUTE_BASEPATH . '/footer.' . PHPEXT;
?>