本文整理汇总了PHP中getInt函数的典型用法代码示例。如果您正苦于以下问题:PHP getInt函数的具体用法?PHP getInt怎么用?PHP getInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getInt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:edire,项目名称:face-fe,代码行数:7,代码来源:index.php
示例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();
}
开发者ID:pers1307,项目名称:cart,代码行数:20,代码来源:ApiCart.php
示例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';
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:31,代码来源:requests.php
示例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}");
}
?>
开发者ID:BlackLight,项目名称:nullBB,代码行数:29,代码来源:insertPost.php
示例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;
}
}
开发者ID:BlackLight,项目名称:nullBB,代码行数:31,代码来源:edituser.php
示例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";
开发者ID:will0306,项目名称:bianli100,代码行数:31,代码来源:website.php
示例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'";
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:editpics.php
示例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
开发者ID:BlackLight,项目名称:nullBB,代码行数:31,代码来源:newposts.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
开发者ID:BlackLight,项目名称:nullBB,代码行数:31,代码来源:viewtopic.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: Сейчас на все ошибки одна причина, исправить :)
*/
开发者ID:pers1307,项目名称:modul-slider,代码行数:31,代码来源:admin.php
示例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";
}
}
开发者ID:yssaifullah,项目名称:algo,代码行数:18,代码来源:RoyAndProfilePicture.php
示例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();
?>
开发者ID:BlackLight,项目名称:nullBB,代码行数:29,代码来源:postbyid.php
示例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 {{{
*
开发者ID:shish,项目名称:travmap,代码行数:31,代码来源:options.php
示例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();
?>
开发者ID:BlackLight,项目名称:nullBB,代码行数:29,代码来源:privmsgbyid.php
示例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;
?>
开发者ID:BlackLight,项目名称:nullBB,代码行数:29,代码来源:users.php
示例16: foreach
</tr>
<?php
foreach ($res as $row) {
?>
<tr class="reputations">
<td class="reputations"><a href="<?php
print BASEDIR . 'user/' . $row['voter_id'];
?>
"><?php
print sanitizeHTML($row['username_voter']);
?>
</a></td>
<td class="reputations" style="text-align: right; width: 10%"><?php
if (getInt($row['vote']) > 0) {
print '+1';
} else {
print '-1';
}
?>
</td>
</tr>
<?php
}
unset($res);
}
?>
</table></center>
开发者ID:BlackLight,项目名称:nullBB,代码行数:31,代码来源:karma.php
示例17: count
}
$db->query('delete from ' . $_CONF['dbprefix'] . 'posts where post_id=' . $post_id);
$res = $db->query('select count(*) as num from ' . $_CONF['dbprefix'] . 'posts where topic_id=' . $topic_id);
$db->freeResult();
$num = getInt($res[0]['num']);
if ($num == 0) {
$db->query('delete from ' . $_CONF['dbprefix'] . 'topics where topic_id=' . $topic_id);
}
$db->close();
header("Location: " . $_SERVER['HTTP_REFERER']);
die;
}
$res = $db->query('select poster_id from ' . $_CONF['dbprefix'] . 'posts ' . "where post_id='" . getInt($_POST['post_id']) . "'");
$db->freeResult();
if ($res[0]['poster_id'] != $userinfo['user_id'] && $userinfo['user_group'] > USERLEV_MOD) {
notification("Invalid user", $_SERVER['HTTP_REFERER'], 3);
die;
}
$db->query('update ' . $_CONF['dbprefix'] . 'posts set post_content=' . "'" . sanitizeQuery($_POST['post_content']) . "' where post_id='" . getInt($_POST['post_id']) . "'");
$res = $db->query('select count(*) as num from ' . $_CONF['dbprefix'] . 'posts where topic_id=' . $topic_id . ' ' . 'and post_time > ' . $post_time);
$db->freeResult();
$num = getInt($res[0]['num']);
if ($num > 0) {
$db->query('update ' . $_CONF['dbprefix'] . 'posts set post_lastedit_date=' . time() . ', ' . 'post_lastedit_user=' . $userinfo['user_id'] . ' where post_id=' . $post_id);
}
$db->close();
header("Location: " . $_SERVER['HTTP_REFERER']);
die;
?>
开发者ID:BlackLight,项目名称:nullBB,代码行数:29,代码来源:updatePost.php
示例18: foreach
</tr>
<?php
foreach ($res as $row) {
$forum_name = sanitizeHTML($row['forum_name']);
$topic_name = sanitizeHTML($row['topic_title']);
$topic_author = sanitizeHTML($row['topic_author']);
$post_author = sanitizeHTML($row['post_author']);
$topic_replies = getInt($row['topic_replies']);
$forum_id = getInt($row['forum_id']);
$topic_id = getInt($row['topic_id']);
$post_id = getInt($row['post_id']);
$topic_user_id = getInt($row['topic_user_id']);
$post_user_id = getInt($row['post_user_id']);
$page = $db->query('select count(*) as numPosts from ' . $_CONF['dbprefix'] . 'posts ' . 'where topic_id=' . $topic_id . ' and post_time < ' . $row['post_time']);
$page = (int) (getInt($page[0]['numPosts']) / 10 + 1);
$db->freeResult();
?>
<tr class="searchresults">
<td class="searchresults"><a href="<?php
print BASEDIR . $forum_id;
?>
"><?php
print $forum_name;
?>
</a></td>
<td class="searchresults"><a href="<?php
print BASEDIR . "topic/{$topic_id}/{$page}#{$post_id}";
?>
"><?php
开发者ID:BlackLight,项目名称:nullBB,代码行数:31,代码来源:search.php
示例19: array
}
$groups = array();
$res = $db->query('select * from ' . $_CONF['dbprefix'] . 'groups');
foreach ($res as $row) {
$groups[$row['group_id']] = $row['group_name'];
}
$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
$res = $db->query('select forum_name, forum_viewgroup, forum_postgroup from ' . $_CONF['dbprefix'] . 'forums where forum_id=' . $fid);
$res = $res[0];
$xml .= '<forum id="' . $fid . '" name="' . $res['forum_name'] . '">' . '<priv id="view" value="' . getInt($res['forum_viewgroup']) . '" name="' . sanitizeHTML($groups[$res['forum_viewgroup']]) . '"></priv>' . '<priv id="post" value="' . getInt($res['forum_postgroup']) . '" name="' . sanitizeHTML($groups[$res['forum_postgroup']]) . '"></priv>';
foreach ($groups as $id => $name) {
$xml .= '<group id="' . getInt($id) . '" name="' . sanitizeHTML($name) . '"></group>';
}
$xml .= '</forum>';
print $xml;
break;
case 'edit_privs':
if (!$fid) {
die;
}
$view_privs = getInt($_REQUEST['view_privs']);
$post_privs = getInt($_REQUEST['post_privs']);
$db->query('update ' . $_CONF['dbprefix'] . 'forums set forum_viewgroup=' . $view_privs . ' where forum_id=' . $fid);
$db->query('update ' . $_CONF['dbprefix'] . 'forums set forum_postgroup=' . $post_privs . ' where forum_id=' . $fid);
header('Location: ' . $_SERVER['HTTP_REFERER']);
break;
}
$db->close();
?>
开发者ID:BlackLight,项目名称:nullBB,代码行数:29,代码来源:editforum.php
示例20: foreach
print '<a href="javascript:newForum()" style="padding-left: 10px">' . $_LANG['new_forum'] . '</a><br>' . '<form action="editforum.' . PHPEXT . '?action=new" method="POST">' . '<div id="newforum" style="padding-left: 10px"></div><br>' . '</form>' . '<table class="forumlist">' . "\n";
foreach ($res as $row) {
print '<tr class="forumlist">' . '<td class="forumlist">' . '<span id="name' . getInt($row['forum_id']) . '">' . '<a href="/forum/' . getInt($row['forum_id']) . '">' . sanitizeHTML($row['forum_name']) . '</a></span><br>' . '<span id="desc' . getInt($row['forum_id']) . '">' . sanitizeHTML($row['forum_desc']) . '</span></td>' . '<td class="forumlist" style="text-align: right">' . '<select id="' . $row['forum_id'] . '" name="forumaction" value="none" onChange="editForum(this)">' . '<option value="none">-- ' . $_LANG['choose_action'] . '</option>' . '<option value="delete">' . $_LANG['remove_forum'] . '</option>' . '<option value="move_up">' . $_LANG['move_up'] . '</option>' . '<option value="move_down">' . $_LANG['move_down'] . '</option>' . '<option value="edit_name">' . $_LANG['edit_name'] . '</option>' . '<option value="edit_desc">' . $_LANG['edit_desc'] . '</option>' . '<option value="edit_priv">' . $_LANG['edit_priv'] . '</option>' . '</select></td>' . '</tr>';
}
print '</table>';
$db->close();
break;
case 'group':
require_once ABSOLUTE_BASEPATH . '/db.' . PHPEXT;
$db = new nullBB_Database($_CONF, $_LANG);
$res = $db->query('select * from ' . $_CONF['dbprefix'] . 'groups ' . 'order by group_id');
$db->freeResult();
$defaultGroups = array(USERLEV_GOD, USERLEV_ADMIN, USERLEV_GLOBALMOD, USERLEV_MOD, USERLEV_USER, USERLEV_ANY, USERLEV_BANNED);
print '<a href="javascript:newGroup()" style="padding-left: 10px">' . $_LANG['new_group'] . '</a><br>' . '<form action="editgroup.' . PHPEXT . '?action=new" method="POST">' . '<div id="newgroup" style="padding-left: 10px"></div><br>' . '</form>' . '<table class="forumlist">' . "\n";
foreach ($res as $row) {
print '<tr class="forumlist">' . '<td class="forumlist">' . '<span id="name' . getInt($row['group_id']) . '"';
if (!in_array($row['group_id'], $defaultGroups)) {
print ' style="color: #990000"';
}
print '>' . sanitizeHTML($row['group_name']) . '</span><br>' . '</td>' . '<td class="forumlist" style="text-align: right">' . '<select id="' . $row['group_id'] . '" name="groupaction" value="none" onChange="editGroup(this)">' . '<option value="none">-- ' . $_LANG['choose_action'] . '</option>';
if (!in_array($row['group_id'], $defaultGroups)) {
print '<option value="delete">' . $_LANG['remove_group'] . '</option>';
}
print '<option value="edit_name">' . $_LANG['edit_name'] . '</option>' . '</select></td>' . '</tr>';
}
print '</table>';
$db->close();
break;
case 'dump':
print $_LANG['generate_dump'];
print '<meta http-equiv="Refresh" content="0;url=' . BASEDIR . 'admin/dump.sql">';
开发者ID:BlackLight,项目名称:nullBB,代码行数:31,代码来源:index.php
注:本文中的getInt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论