本文整理汇总了PHP中get_file_suffix函数的典型用法代码示例。如果您正苦于以下问题:PHP get_file_suffix函数的具体用法?PHP get_file_suffix怎么用?PHP get_file_suffix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_file_suffix函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sys_msg
sys_msg($_LANG['web_url_no']);
}
}
unset($name, $target);
$topic_img = empty($topic_img) ? $_POST['img_url'] : $topic_img;
$htmls = '';
break;
case '2':
$htmls = $_POST['htmls'];
$topic_img = '';
break;
}
// 标题图上传
if ($_FILES['title_pic']['name'] && $_FILES['title_pic']['size'] > 0) {
/* 检查文件合法性 */
if (!get_file_suffix($_FILES['title_pic']['name'], $allow_suffix)) {
sys_msg($_LANG['invalid_type']);
}
/* 处理 */
$name = date('Ymd');
for ($i = 0; $i < 6; ++$i) {
$name .= chr(mt_rand(97, 122));
}
$name .= '.' . end(explode('.', $_FILES['title_pic']['name']));
$target = ROOT_PATH . DATA_DIR . '/afficheimg/' . $name;
if (move_upload_file($_FILES['title_pic']['tmp_name'], $target)) {
$title_pic = DATA_DIR . '/afficheimg/' . $name;
}
} elseif (!empty($_REQUEST['title_url'])) {
/* 来自互联网图片 不可以是服务器地址 */
if (strstr($_REQUEST['title_url'], 'http') && !strstr($_REQUEST['title_url'], $_SERVER['SERVER_NAME'])) {
示例2: array
$rt['act'] = 'edit';
$rt['img_url'] = $rt['url'];
$rt['img_src'] = $rt['src'];
$rt['img_txt'] = $rt['text'];
$rt['id'] = $id;
$smarty->assign('action_link', array('text' => $_LANG['go_url'], 'href' => 'flashplay.php?act=list'));
$smarty->assign('rt', $rt);
$smarty->display('flashplay_add.htm');
} elseif ($_POST['step'] == 2) {
if (empty($_POST['img_url'])) {
//若链接地址为空
$links[] = array('text' => $_LANG['return_edit'], 'href' => 'flashplay.php?act=edit&id=' . $id);
sys_msg($_LANG['link_empty'], 0, $links);
}
if (!empty($_FILES['img_file_src']['name'])) {
if (!get_file_suffix($_FILES['img_file_src']['name'], $allow_suffix)) {
sys_msg($_LANG['invalid_type']);
}
//有上传
$name = date('Ymd');
for ($i = 0; $i < 6; $i++) {
$name .= chr(mt_rand(97, 122));
}
$name .= '.' . end(explode('.', $_FILES['img_file_src']['name']));
$target = ROOT_PATH . DATA_DIR . '/afficheimg/' . $name;
if (move_upload_file($_FILES['img_file_src']['tmp_name'], $target)) {
$src = DATA_DIR . '/afficheimg/' . $name;
}
} else {
if (!empty($_POST['img_src'])) {
$src = $_POST['img_src'];
示例3: switch
$ad_img = $_FILES;
/* 查询自定义广告信息 */
$sql = "SELECT ad_id, ad_type, content, url, ad_status, ad_name FROM " . $GLOBALS['ecs']->table("ad_custom") . " WHERE ad_id = " . $filter['ad']['id'] . " LIMIT 0, 1";
$ad_info = $GLOBALS['db']->getRow($sql);
/* 配置接收文件类型 */
switch ($filter['ad']['ad_type']) {
case '0':
break;
case '1':
$allow_suffix[] = 'swf';
break;
}
/* 接收文件 */
if ($ad_img['ad_img']['name'] && $ad_img['ad_img']['size'] > 0) {
/* 检查文件合法性 */
if (!get_file_suffix($ad_img['ad_img']['name'], $allow_suffix)) {
sys_msg($_LANG['invalid_type']);
}
/* 处理 */
$name = date('Ymd');
for ($i = 0; $i < 6; $i++) {
$name .= chr(mt_rand(97, 122));
}
$name .= '.' . end(explode('.', $ad_img['ad_img']['name']));
$target = ROOT_PATH . DATA_DIR . '/afficheimg/' . $name;
if (move_upload_file($ad_img['ad_img']['tmp_name'], $target)) {
$src = DATA_DIR . '/afficheimg/' . $name;
}
} else {
if (!empty($filter['content']['url'])) {
/* 来自互联网图片 不可以是服务器地址 */
示例4: addslashes
$code = $db->GetOne($sql);
$set_modules = true;
include_once ROOT_PATH . 'includes/modules/shipping/' . $code . '.php';
/* 恢复默认 */
$db->query('UPDATE ' . $ecs->table('shipping') . " SET print_bg = '" . addslashes($modules[0]['print_bg']) . "', config_lable = '" . addslashes($modules[0]['config_lable']) . "' WHERE shipping_code = '{$code}' LIMIT 1");
$url = "shipping.php?act=edit_print_template&shipping={$shipping_id}";
ecs_header("Location: {$url}\n");
} elseif ($_REQUEST['act'] == 'print_upload') {
//检查登录权限
admin_priv('ship_manage');
//设置上传文件类型
$allow_suffix = array('jpg', 'png', 'jpeg');
$shipping_id = !empty($_POST['shipping']) ? intval($_POST['shipping']) : 0;
//接收上传文件
if (!empty($_FILES['bg']['name'])) {
if (!get_file_suffix($_FILES['bg']['name'], $allow_suffix)) {
echo '<script language="javascript">';
echo 'parent.alert("' . sprintf($_LANG['js_languages']['upload_falid'], implode(',', $allow_suffix)) . '");';
echo '</script>';
exit;
}
$name = date('Ymd');
for ($i = 0; $i < 6; ++$i) {
$name .= chr(mt_rand(97, 122));
}
$name .= '.' . end(explode('.', $_FILES['bg']['name']));
$target = ROOT_PATH . '/images/receipt/' . $name;
if (move_upload_file($_FILES['bg']['tmp_name'], $target)) {
$src = '/images/receipt/' . $name;
}
}
示例5: make_json_error
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 && get_file_suffix($img, $allow_suffix)) {
$img_name = basename($img);
@unlink(ROOT_PATH . DATA_DIR . '/afficheimg/' . $img_name);
}
admin_log('', 'remove', 'ads');
$url = 'ads.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']);
ecs_header("Location: {$url}\n");
exit;
}
/* 获取广告数据列表 */
function get_adslist()
{
/* 过滤查询 */
$pid = !empty($_REQUEST['pid']) ? intval($_REQUEST['pid']) : 0;
$filter = array();
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'ad.ad_name' : trim($_REQUEST['sort_by']);