本文整理汇总了PHP中exchange::num方法的典型用法代码示例。如果您正苦于以下问题:PHP exchange::num方法的具体用法?PHP exchange::num怎么用?PHP exchange::num使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exchange
的用法示例。
在下文中一共展示了exchange::num方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
$js_code = "<script type=" . '"' . "text/javascript" . '"';
$js_code .= ' src=' . '"' . $ecs->url() . 'affiche.php?act=js&type=' . $_REQUEST['type'] . '&ad_id=' . intval($_REQUEST['id']) . '"' . '></script>';
$site_url = $ecs->url() . 'affiche.php?act=js&type=' . $_REQUEST['type'] . '&ad_id=' . intval($_REQUEST['id']);
$smarty->assign('ur_here', $_LANG['add_js_code']);
$smarty->assign('action_link', array('href' => 'ads.php?act=list', 'text' => $_LANG['ad_list']));
$smarty->assign('url', $site_url);
$smarty->assign('js_code', $js_code);
$smarty->assign('lang_list', $lang_list);
assign_query_info();
$smarty->display('ads_js.htm');
} elseif ($_REQUEST['act'] == 'edit_ad_name') {
check_authz_json('ad_manage');
$id = intval($_POST['id']);
$ad_name = json_str_iconv(trim($_POST['val']));
/* 检查广告名称是否重复 */
if ($exc->num('ad_name', $ad_name, $id) != 0) {
make_json_error(sprintf($_LANG['ad_name_exist'], $ad_name));
} else {
if ($exc->edit("ad_name = '{$ad_name}'", $id)) {
admin_log($ad_name, 'edit', 'ads');
make_json_result(stripslashes($ad_name));
} else {
make_json_error($db->error());
}
}
} elseif ($_REQUEST['act'] == 'remove') {
check_authz_json('ad_manage');
$id = intval($_GET['id']);
$img = $exc->get_name($id, 'ad_code');
$exc->drop($id);
if (strpos($img, 'http://') === false && strpos($img, 'https://') === false) {
示例2: array
/* 模板赋值 */
$smarty->assign('ur_here', $_LANG['position_add']);
$smarty->assign('form_act', 'insert');
$smarty->assign('action_link', array('href' => 'ad_position.php?act=list', 'text' => $_LANG['ad_position']));
$smarty->assign('posit_arr', array('position_style' => '<table cellpadding="0" cellspacing="0">' . "\n" . '{foreach from=$ads item=ad}' . "\n" . '<tr><td>{$ad}</td></tr>' . "\n" . '{/foreach}' . "\n" . '</table>'));
assign_query_info();
$smarty->display('ad_position_info.htm');
} elseif ($_REQUEST['act'] == 'insert') {
admin_priv('ad_manage');
/* 对POST上来的值进行处理并去除空格 */
$position_name = !empty($_POST['position_name']) ? trim($_POST['position_name']) : '';
$position_desc = !empty($_POST['position_desc']) ? nl2br(htmlspecialchars($_POST['position_desc'])) : '';
$ad_width = !empty($_POST['ad_width']) ? intval($_POST['ad_width']) : 0;
$ad_height = !empty($_POST['ad_height']) ? intval($_POST['ad_height']) : 0;
/* 查看广告位是否有重复 */
if ($exc->num("position_name", $position_name) == 0) {
/* 将广告位置的信息插入数据表 */
$sql = 'INSERT INTO ' . $ecs->table('ad_position') . ' (position_name, ad_width, ad_height, position_desc, position_style) ' . "VALUES ('{$position_name}', '{$ad_width}', '{$ad_height}', '{$position_desc}', '{$_POST['position_style']}')";
$db->query($sql);
/* 记录管理员操作 */
admin_log($position_name, 'add', 'ads_position');
/* 提示信息 */
$link[0]['text'] = $_LANG['ads_add'];
$link[0]['href'] = 'ads.php?act=add';
$link[1]['text'] = $_LANG['continue_add_position'];
$link[1]['href'] = 'ad_position.php?act=add';
$link[2]['text'] = $_LANG['back_position_list'];
$link[2]['href'] = 'ad_position.php?act=list';
sys_msg($_LANG['add'] . " " . stripslashes($position_name) . " " . $_LANG['attradd_succed'], 0, $link);
} else {
$link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
示例3: vsprintf
/* 清除缓存 */
clear_cache_files();
admin_log($_POST['brand_name'], 'edit', 'brand');
$link[0]['text'] = $_LANG['back_list'];
$link[0]['href'] = 'brand.php?act=list&' . list_link_postfix();
$note = vsprintf($_LANG['brandedit_succed'], $_POST['brand_name']);
sys_msg($note, 0, $link);
} else {
die($db->error());
}
} elseif ($_REQUEST['act'] == 'edit_brand_name') {
check_authz_json('brand_manage');
$id = intval($_POST['id']);
$name = json_str_iconv(trim($_POST['val']));
/* 检查名称是否重复 */
if ($exc->num("brand_name", $name, $id) != 0) {
make_json_error(sprintf($_LANG['brandname_exist'], $name));
} else {
if ($exc->edit("brand_name = '{$name}'", $id)) {
admin_log($name, 'edit', 'brand');
make_json_result(stripslashes($name));
} else {
make_json_result(sprintf($_LANG['brandedit_fail'], $name));
}
}
} elseif ($_REQUEST['act'] == 'add_brand') {
$brand = empty($_REQUEST['brand']) ? '' : json_str_iconv(trim($_REQUEST['brand']));
if (brand_exists($brand)) {
make_json_error($_LANG['brand_name_exist']);
} else {
$sql = "INSERT INTO " . $ecs->table('brand') . "(brand_name)" . "VALUES ( '{$brand}')";
示例4: stripslashes
$password = !empty($_POST['new_password']) ? ", password = '" . md5($_POST['new_password']) . "'" : '';
if ($_REQUEST['act'] == 'update') {
/* 查看是否有权限编辑其他管理员的信息 */
if ($_SESSION['admin_id'] != $_REQUEST['id']) {
admin_priv('admin_manage');
}
$g_link = 'privilege.php?act=list';
$nav_list = '';
} else {
$nav_list = !empty($_POST['nav_list']) ? ", nav_list = '" . @join(",", $_POST['nav_list']) . "'" : '';
$admin_id = $_SESSION['admin_id'];
$g_link = 'privilege.php?act=modif';
}
/* 判断管理员是否已经存在 */
if (!empty($admin_name)) {
$is_only = $exc->num('user_name', stripslashes($admin_name), $admin_id);
if ($is_only == 1) {
sys_msg(sprintf($_LANG['user_name_exist'], stripslashes($admin_name)), 1);
}
}
/* Email地址是否有重复 */
if (!empty($admin_email)) {
$is_only = $exc->num('email', stripslashes($admin_email), $admin_id);
if ($is_only == 1) {
sys_msg(sprintf($_LANG['email_exist'], stripslashes($admin_email)), 1);
}
}
//如果要修改密码
$pwd_modified = false;
if (!empty($_POST['new_password'])) {
/* 查询旧密码并与输入的旧密码比较是否相同 */
示例5: elseif
}
/* 更新 */
if ($exc_article->edit("title = '{$_POST['title']}', cat_id = '{$_POST['cat_id']}', article_type = '{$_POST['article_type']}', content = '{$_POST['FCKeditor1']}'", $_POST['id'])) {
/* 清除缓存 */
clear_cache_files();
$link[0]['text'] = $_LANG['back_list'];
$link[0]['href'] = 'shophelp.php?act=list_article&cat_id=' . $_POST['cat_id'];
sys_msg(sprintf($_LANG['articleedit_succeed'], $_POST['title']), 0, $link);
admin_log($_POST['title'], 'edit', 'shophelp');
}
} elseif ($_REQUEST['act'] == 'edit_catname') {
check_authz_json('shophelp_manage');
$id = intval($_POST['id']);
$cat_name = json_str_iconv(trim($_POST['val']));
/* 检查分类名称是否重复 */
if ($exc_cat->num("cat_name", $cat_name, $id) != 0) {
make_json_error(sprintf($_LANG['catname_exist'], $cat_name));
} else {
if ($exc_cat->edit("cat_name = '{$cat_name}'", $id)) {
clear_cache_files();
admin_log($cat_name, 'edit', 'shophelpcat');
make_json_result(stripslashes($cat_name));
} else {
make_json_error($db->error());
}
}
} elseif ($_REQUEST['act'] == 'edit_cat_order') {
check_authz_json('shophelp_manage');
$id = intval($_POST['id']);
$order = json_str_iconv(trim($_POST['val']));
/* 检查输入的值是否合法 */
示例6: array
make_json_result($smarty->fetch('link_list.htm'), '', array('filter' => $links_list['filter'], 'page_count' => $links_list['page_count']));
} elseif ($_REQUEST['act'] == 'add') {
admin_priv('friendlink');
$smarty->assign('ur_here', $_LANG['add_link']);
$smarty->assign('action_link', array('href' => 'friend_link.php?act=list', 'text' => $_LANG['list_link']));
$smarty->assign('action', 'add');
$smarty->assign('form_act', 'insert');
assign_query_info();
$smarty->display('link_info.htm');
} elseif ($_REQUEST['act'] == 'insert') {
/* 变量初始化 */
$link_logo = '';
$show_order = !empty($_POST['show_order']) ? intval($_POST['show_order']) : 0;
$link_name = !empty($_POST['link_name']) ? sub_str(trim($_POST['link_name']), 250, false) : '';
/* 查看链接名称是否有重复 */
if ($exc->num('link_name', $link_name) == 0) {
/* 处理上传的LOGO图片 */
if (isset($_FILES['link_img']['error']) && $_FILES['link_img']['error'] == 0 || !isset($_FILES['link_img']['error']) && isset($_FILES['link_img']['tmp_name']) && $_FILES['link_img']['tmp_name'] != 'none') {
$img_up_info = @basename($image->upload_image($_FILES['link_img'], 'afficheimg'));
$link_logo = DATA_DIR . '/afficheimg/' . $img_up_info;
}
/* 使用远程的LOGO图片 */
if (!empty($_POST['url_logo'])) {
if (strpos($_POST['url_logo'], 'http://') === false && strpos($_POST['url_logo'], 'https://') === false) {
$link_logo = 'http://' . trim($_POST['url_logo']);
} else {
$link_logo = trim($_POST['url_logo']);
}
}
/* 如果链接LOGO为空, LOGO为链接的名称 */
if ((isset($_FILES['upfile_flash']['error']) && $_FILES['upfile_flash']['error'] > 0 || !isset($_FILES['upfile_flash']['error']) && isset($_FILES['upfile_flash']['tmp_name']) && $_FILES['upfile_flash']['tmp_name'] == 'none') && empty($_POST['url_logo'])) {
示例7: stripslashes
}
if ($_REQUEST['act'] == 'update') {
/* 查看是否有权限编辑其他管理员的信息 */
if ($_SESSION['admin_id'] != $_REQUEST['id']) {
admin_priv('admin_manage');
}
$g_link = 'privilege.php?act=list';
$nav_list = '';
} else {
$nav_list = !empty($_POST['nav_list']) ? ", nav_list = '" . @join(",", $_POST['nav_list']) . "'" : '';
$admin_id = $_SESSION['admin_id'];
$g_link = 'privilege.php?act=modif';
}
/* 判断管理员是否已经存在 */
if (!empty($admin_name)) {
$is_only = $exc->num('user_name', $admin_name, $admin_id);
if ($is_only == 1) {
sys_msg(sprintf($_LANG['user_name_exist'], stripslashes($admin_name)), 1);
}
}
/* Email地址是否有重复 */
if (!empty($admin_email)) {
$is_only = $exc->num('email', $admin_email, $admin_id);
if ($is_only == 1) {
sys_msg(sprintf($_LANG['email_exist'], stripslashes($admin_email)), 1);
}
}
//如果要修改密码
$pwd_modified = false;
if (!empty($_POST['new_password'])) {
/* 查询旧密码并与输入的旧密码比较是否相同 */
示例8: elseif
$db->query($sql);
clear_cache_files();
admin_log($option_name, 'add', 'vote');
$url = 'vote.php?act=query_option&vid=' . $vote_id . '&' . str_replace('act=new_option', '', $_SERVER['QUERY_STRING']);
ecs_header("Location: {$url}\n");
exit;
}
} else {
make_json_error($_LANG['js_languages']['option_name_empty']);
}
} elseif ($_REQUEST['act'] == 'edit_vote_name') {
check_authz_json('vote_priv');
$id = intval($_POST['id']);
$vote_name = json_str_iconv(trim($_POST['val']));
/* 检查名称是否重复 */
if ($exc->num("vote_name", $vote_name, $id) != 0) {
make_json_error(sprintf($_LANG['vote_name_exist'], $vote_name));
} else {
if ($exc->edit("vote_name = '{$vote_name}'", $id)) {
admin_log($vote_name, 'edit', 'vote');
make_json_result(stripslashes($vote_name));
}
}
} elseif ($_REQUEST['act'] == 'edit_option_name') {
check_authz_json('vote_priv');
$id = intval($_POST['id']);
$option_name = json_str_iconv(trim($_POST['val']));
/* 检查名称是否重复 */
$vote_id = $db->getOne('SELECT vote_id FROM ' . $ecs->table('vote_option') . " WHERE option_id='{$id}'");
$sql = 'SELECT COUNT(*) FROM ' . $ecs->table('vote_option') . " WHERE option_name = '{$option_name}' AND vote_id = '{$vote_id}' AND option_id <> {$id}";
if ($db->getOne($sql) != 0) {
示例9: stripslashes
$password = !empty($_POST['new_password']) ? ", password = '" . md5(md5($_POST['new_password']) . $ec_salt) . "'" : '';
if ($_REQUEST['act'] == 'update') {
/* 查看是否有权限编辑其他管理员的信息 */
if ($_SESSION['admin_id'] != $_REQUEST['id']) {
admin_priv('admin_manage');
}
$g_link = 'privilege.php?act=list';
$nav_list = '';
} else {
$nav_list = !empty($_POST['nav_list']) ? ", nav_list = '" . @join(",", $_POST['nav_list']) . "'" : '';
$admin_id = $_SESSION['admin_id'];
$g_link = 'privilege.php?act=modif';
}
/* 判断管理员是否已经存在 */
if (!empty($admin_name)) {
$is_only = $exc->num('user_name', $admin_name, $admin_id);
if ($is_only == 1) {
sys_msg(sprintf($_LANG['user_name_exist'], stripslashes($admin_name)), 1);
}
}
/* Email地址是否有重复 */
if (!empty($admin_email)) {
$is_only = $exc->num('email', $admin_email, $admin_id);
if ($is_only == 1) {
sys_msg(sprintf($_LANG['email_exist'], stripslashes($admin_email)), 1);
}
}
/* 手机号是否有重复 */
if (!empty($admin_mobile)) {
$is_only = $exc->num('mobile_phone', $admin_mobile, $admin_id);
if ($is_only == 1) {
示例10: gmtime
/* 更新数据 */
$cur_time = gmtime();
if ($exc->edit("title='{$_POST['title']}', content='{$_POST['FCKeditor1']}',add_time ='{$cur_time}'", $_POST['id'])) {
/* 清除缓存 */
clear_cache_files();
$link[0]['text'] = $_LANG['back_list'];
$link[0]['href'] = 'shopinfo.php?act=list';
sys_msg(sprintf($_LANG['articleedit_succeed'], $_POST['title']), 0, $link);
admin_log($_POST['title'], 'edit', 'shopinfo');
}
} elseif ($_REQUEST['act'] == 'edit_title') {
check_authz_json('shopinfo_manage');
$id = intval($_POST['id']);
$title = json_str_iconv(trim($_POST['val']));
/* 检查文章标题是否有重名 */
if ($exc->num('title', $title, $id) == 0) {
if ($exc->edit("title = '{$title}'", $id)) {
clear_cache_files();
admin_log($title, 'edit', 'shopinfo');
make_json_result(stripslashes($title));
}
} else {
make_json_error(sprintf($_LANG['title_exist'], $title));
}
} elseif ($_REQUEST['act'] == 'remove') {
check_authz_json('shopinfo_manage');
$id = intval($_GET['id']);
/* 获得文章主题 */
$title = $exc->get_name($id);
if ($exc->drop($id)) {
clear_cache_files();
示例11: elseif
/* 记录管理员操作 */
admin_log($_POST['ad_name'] . '(新广告)', 'add', 'ads_position');
clear_cache_files();
// 清除缓存文件
/* 提示信息 */
$link[0]['text'] = '查看广告位列表';
$link[0]['href'] = 'new_position.php?act=list';
$link[1]['text'] = '继续添加广告';
$link[1]['href'] = 'new_position.php?act=add';
sys_msg($_LANG['add'] . " " . $_POST['ad_name'] . " " . $_LANG['attradd_succed'], 0, $link);
} elseif ($_REQUEST['act'] == 'edit_ad_name') {
check_authz_json('ad_manage');
$id = intval($_POST['id']);
$position_name = json_str_iconv(trim($_POST['val']));
/* 检查广告名称是否重复 */
if ($exc->num('position_name', $position_name, $id) != 0) {
make_json_error(sprintf($_LANG['ad_name_exist'], $position_name));
} else {
if ($exc->edit("position_name = '{$position_name}'", $id)) {
admin_log($position_name, 'edit', 'ads_position');
make_json_result(stripslashes($position_name));
} else {
make_json_error($db->error());
}
}
} elseif ($_REQUEST['act'] == 'remove') {
check_authz_json('ad_manage');
$id = intval($_GET['id']);
$exc->drop($id);
admin_log('', 'remove', 'ads_position');
$url = 'new_position.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']);
示例12: elseif
} elseif ($_REQUEST['act'] == 'query') {
$agency_list = get_agencylist();
$smarty->assign('agency_list', $agency_list['agency']);
$smarty->assign('filter', $agency_list['filter']);
$smarty->assign('record_count', $agency_list['record_count']);
$smarty->assign('page_count', $agency_list['page_count']);
/* 排序标记 */
$sort_flag = sort_flag($agency_list['filter']);
$smarty->assign($sort_flag['tag'], $sort_flag['img']);
make_json_result($smarty->fetch('agency_list.htm'), '', array('filter' => $agency_list['filter'], 'page_count' => $agency_list['page_count']));
} elseif ($_REQUEST['act'] == 'edit_agency_name') {
check_authz_json('agency_manage');
$id = intval($_POST['id']);
$name = json_str_iconv(trim($_POST['val']));
/* 检查名称是否重复 */
if ($exc->num('agency_name', $name, $id) != 0) {
make_json_error(sprintf($_LANG['agency_name_exist'], $name));
} else {
if ($exc->edit("agency_name = '{$name}'", $id)) {
admin_log($name, 'edit', 'agency');
clear_cache_files();
make_json_result(stripslashes($name));
} else {
make_json_result(sprintf($_LANG['agency_edit_fail'], $name));
}
}
} elseif ($_REQUEST['act'] == 'remove') {
check_authz_json('agency_manage');
$id = intval($_GET['id']);
$name = $exc->get_name($id);
$exc->drop($id);
示例13: sprintf
if ($exc->edit("title='{$_POST['title']}', cat_id='{$_POST['article_cat']}', article_type='{$_POST['article_type']}', is_open='{$_POST['is_open']}', author='{$_POST['author']}', author_email='{$_POST['author_email']}', keywords ='{$_POST['keywords']}', file_url ='{$file_url}', open_type='{$open_type}', content='{$_POST['FCKeditor1']}', link='{$_POST['link_url']}', description = '{$_POST['description']}'", $_POST['id'])) {
$link[0]['text'] = $_LANG['back_list'];
$link[0]['href'] = 'article.php?act=list&' . list_link_postfix();
$note = sprintf($_LANG['articleedit_succeed'], stripslashes($_POST['title']));
admin_log($_POST['title'], 'edit', 'article');
clear_cache_files();
sys_msg($note, 0, $link);
} else {
die($db->error());
}
} elseif ($_REQUEST['act'] == 'edit_title') {
check_authz_json('article_manage');
$id = intval($_POST['id']);
$title = json_str_iconv(trim($_POST['val']));
/* 检查文章标题是否重复 */
if ($exc->num("title", $title, $id) != 0) {
make_json_error(sprintf($_LANG['title_exist'], $title));
} else {
if ($exc->edit("title = '{$title}'", $id)) {
clear_cache_files();
admin_log($title, 'edit', 'article');
make_json_result(stripslashes($title));
} else {
make_json_error($db->error());
}
}
} elseif ($_REQUEST['act'] == 'toggle_show') {
check_authz_json('article_manage');
$id = intval($_POST['id']);
$val = intval($_POST['val']);
$exc->edit("is_open = '{$val}'", $id);