function del_file($dir, $time, $limit = true) { if (file_exists($dir)) { $open = opendir($dir); while (($file = readdir($open)) !== false) { if ($file != '.' && $file != '..') { $pdir = $dir . $file; if (is_dir($pdir)) { del_file($pdir . '/', $time, $limit); } else { //if(filemtime($pdir) < $time && !strpos($pdir, '.id') && !strpos($pdir, '.list')) if (filemtime($pdir) < $time) { if ($limit) { if (strpos($pdir, '.mp4')) { flushMsg($pdir); unlink($pdir); //file_put_contents(UPLOAD_DIR . 'clear.list', $pdir, FILE_APPEND); } } else { flushMsg($pdir); unlink($pdir); } } } } } closedir($open); } else { echo "no exists!"; } }
public function delattach() { $id = I('get.id'); if (empty($id)) { return false; } $result = del_file($id); if ($result) { $this->success('删除成功', U('attach')); } else { $this->error(L('_DELETE_FAIL_')); } }
function unzip_file($zipfile, $dest, $entries = array()) { // delete files if exists; $dels = array(); foreach ($entries as $entry) { array_push($dels, $dest . $entry); } if (!del_file($dels)) { return FALSE; } // create object $zip = new ZipArchive(); // open archive if ($zip->open($zipfile)) { // extract contents to destination directory $res = $zip->extractTo($dest, $entries); // close archive $zip->close(); if ($res === TRUE) { return TRUE; } } return FALSE; }
} closedir($dir); } //图片目录转移 $imgpath = str_replace(".htm", "", ROOT_PATH . $postdb[filepath]); makepath($imgpath); $dir = opendir($truedir); while ($file = readdir($dir)) { if ($file == '.' || $file == '..') { continue; } rename("{$truedir}/{$file}", "{$imgpath}/{$file}"); } closedir($dir); //删除临时创建的目录 del_file(dirname(ROOT_PATH . $postdb[filepath]) . "/tmp"); //处理图片路径 $file = read_file(ROOT_PATH . $postdb[filepath]); $file = preg_replace("/^([^>]+)>(.*)/is", "\\1>\r\n\r\n<!--这一行是系统自动添加的代码,目的是为了处理图片的路径--><base href='{$webdb['www_url']}/" . str_replace(".htm", "/", $postdb[filepath]) . "'>\r\n\r\n\\2", $file); write_file(ROOT_PATH . $postdb[filepath], $file); } else { if (!$postdb[code]) { showerr("内容不能为空", 1); } $postdb[code] = stripslashes($postdb[code]); if (eregi("(\\.htm|\\.html)\$", $postdb[filepath])) { write_file(ROOT_PATH . $postdb[filepath], $postdb[code]); } if (!is_writable(ROOT_PATH . $postdb[filepath])) { echo "文件写入失败,请确认目录可写:" . ROOT_PATH . $postdb[filepath]; die;
$err_msg = "对不起,删除失败,该文件可能不存在,请检查文件名,或者稍后再试!"; } } else { $sql = "update files set status = 2, del_time = {$del_time} where fid = '{$fid}'"; } /*print_r($sql); exit;*/ $result = mysql_query($sql); if (!$result) { $err_msg = "对不起,删除失败,数据库繁忙,请稍后再试!"; } else { if (mysql_affected_rows() == 0) { $err_msg = "对不起,删除失败,该文件可能不存在,请检查文件名,或者稍后再试!"; } } if (isset($err_msg)) { //echo $err_msg; return $err_msg; } return true; } // 根据用户身份,控制删除 默认值0 普通用户, 1管理员 if (is_string($err_msg = del_file($fid, 1))) { include "../error/error.php"; exit; } else { echo "<script> alert('文件删除成功!'); window.location.href=\"filesys.php\"; </script>"; //echo "<script> alert('文件删除成功!'); history.go(-1); </script>"; // history.go(-1) 不能刷新页面! exit; }
public function serverDownload() { $uuid = 'download_' . $this->in['uuid']; if ($this->in['type'] == 'percent') { //获取下载进度 //show_json($_SESSION[$uuid]); if (isset($_SESSION[$uuid])) { $info = $_SESSION[$uuid]; $result = array('uuid' => $this->in['uuid'], 'length' => (int) $info['length'], 'size' => (int) filesize($info['path']), 'time' => mtime()); show_json($result); } else { show_json('', false); } } else { if ($this->in['type'] == 'remove') { //取消下载;文件被删掉则自动停止 del_file($_SESSION[$uuid]['path']); unset($_SESSION[$uuid]); show_json('', false); } } //下载 $save_path = _DIR($this->in['save_path']); if (!is_writeable($save_path)) { show_json($this->L['no_permission_write'], false); } $url = rawurldecode($this->in['url']); $header = url_header($url); if (!$header) { show_json($this->L['download_error_exists'], false); } $save_path = $save_path . urldecode($header['name']); if (!checkExt($save_path)) { //不允许的扩展名 $save_path = _DIR($this->in['save_path']) . date() . '.txt'; } $save_path = get_filename_auto(iconv_system($save_path)); $save_path_temp = $save_path . '.downloading'; session_start(); $_SESSION[$uuid] = array('length' => $header['length'], 'path' => $save_path_temp); session_write_close(); if (file_download_this($url, $save_path_temp)) { if (@rename($save_path_temp, $save_path)) { //下载完后重命名 $name = get_path_this(iconv_app($save_path)); show_json($this->L['download_success'], true, $name); } else { show_json($this->L['download_error_create'], false); } } else { show_json($this->L['download_error_create'], false); } }
function _remove() { $file_list = array($this->path_to . '/controller/debug.class.php', $this->path_to . '/lib/class/lessc.inc.class.php', $this->path_to . '/static/style/base.less', $this->path_to . '/static/js/lib/less-1.4.2.min.js', $this->path_to . '/static/js/lib/webuploader/webuploader.js', $this->path_to . '/static/style/skin/common.less', $this->path_to . '/static/js/Gruntfile.js', $this->path_to . '/static/js/package.json', $this->path_to . '/static/js/readme.txt', $this->path_to . '/todo.txt'); $path_list = array($this->path_to . '/data/log', $this->path_to . '/data/thumb', $this->path_to . '/static/js/_dev', $this->path_to . '/static/js/app/update', $this->path_to . '/static/js/node_modules'); foreach ($file_list as $val) { del_file($val); } echo '<br/>1.文件删除完成:'; flush(); mkdir($this->path_to . '/data/User'); foreach ($path_list as $val) { del_dir($val); } echo '<br/>2.文件夹删除完成:'; flush(); $path = $this->path_to . '/static/style/skin/'; $app_theme = array('default', 'metro', 'simple'); $app_less = array('app_code_edit', 'app_desktop', 'app_editor', 'app_explorer', 'app_setting', 'button', 'config', 'dialog', 'filelist', 'right_menu', 'tree'); foreach ($app_theme as $theme) { foreach ($app_less as $app) { $temp = $path . $theme . '/' . $app . '.less'; del_file($temp); } } echo '<br/>3.less文件删除完成<hr/>'; flush(); }
/** * 删除静态 do_delete_html * @param null $path * @param null $file */ function do_delete_html($path = NULL, $file = NULL) { if ($path && $file) { $file = explode(',', $file); foreach ($file as $v) { $fileName = HTML_PATH . $path . '/' . $v . '.html'; del_file($fileName); //删除静态 } } }
exit; } mysql_query("DELETE FROM " . TABLE_CLIENT . " WHERE client_id='{$del_client}'") or Error(1, __FILE__, __LINE__); renew_clients($root_dir); Header("Location: ?p={$part}&client"); exit; } if (@$_FILES["pricefile"]) { $url = "?p={$part}&card_id={$card_id}"; load_file($file_owner, $card_id, $url); Header("Location: " . $url); exit; } if (@$delfile) { $file_id = (int) @$delfile; del_file($file_id); Header("Location: " . ADMIN_URL . "?p={$part}&card_id={$card_id}"); exit; } if (isset($client)) { $replace = array(); $data = @unserialize($_SESSION['client_data']); foreach ($client_arr as $v) { ${$v} = @$data[$v]; } $sort = isset($sort_arr1[$sort]) ? $sort : 'c.name'; $sortdirect = isset($sort_direct_arr[$sortdirect]) ? $sortdirect : ''; $ord = $sort == 'birthday' ? "YEAR(birthday)=0, {$sort} {$sortdirect}" : "{$sort} {$sortdirect}"; if ($sort == 'birthday_city') { $ord = "{$sort}='', {$sort} {$sortdirect}"; }
global $output_dir; global $output_thumbs; if (file_exists($output_dir . $file)) { if (file_exists($output_thumbs . $file)) { unlink($output_thumbs . $file); } unlink($output_dir . $file); return "Photo \"" . $file . "\" was deleted."; } else { return "Photo \"" . $file . "\" was not found. Perhaps it was already deleted?"; } } if (!empty($_POST['files'])) { $i = 0; foreach ($_POST['files'] as $file) { $success = del_file($file); $i++; if ($i > 1) { $success = $i . " photos were deleted."; } } } else { $error = "No photos selected."; } } if (isset($_POST['submit'])) { if (strpbrk($_POST['galname'], "\\/?%*:|\"<>") === FALSE) { $galname = mysql_prep($_POST['galname']); if (isset($_POST['subgalleries']) && $_POST['subgalleries'] != "") { $subgalleries = serialize($_POST['subgalleries']); } else {
function delete_cache_file($fid, $id) { del_file(ROOT_PATH . "cache/jsarticle_cache"); del_file(ROOT_PATH . "cache/label_cache"); del_file(ROOT_PATH . "cache/list_cache"); del_file(ROOT_PATH . "cache/bencandy_cache"); del_file(ROOT_PATH . "cache/showsp_cache"); }
$styledb[$key] = $value; } $show = "<?php\tunset(\$styledb);"; foreach ($styledb as $key => $value) { $show .= "\n\t\t\$styledb['{$key}']='{$value}';"; } write_file(ROOT_PATH . "data/style/{$postdb['keywords']}.php", $show . "?>"); write_file(ROOT_PATH . "images/{$postdb['keywords']}/style.css", stripslashes("{$CssCode}")); jump("修改成功", "index.php?lfj=style&job=editstyle&keywords={$postdb['keywords']}"); } elseif ($action == "deletestyle" && $Apower[style_editstyle]) { if ($keywords == 'default') { showmsg("默认的风格不能删除"); } if ($keywords && unlink(ROOT_PATH . "data/style/{$keywords}.php")) { del_file(ROOT_PATH . "images/{$keywords}/"); del_file(ROOT_PATH . "template/{$keywords}/"); jump("删除成功", "index.php?lfj=style&job=deletestyle"); } else { showmsg("删除失败,请确认文件属性可写" . ROOT_PATH . "data/style/{$keywords}.php"); } } elseif ($job == "deletestyle" && $Apower[style_editstyle]) { $style_select = select_style('keywords'); hack_admin_tpl('deletestyle'); } elseif ($job == 'edittpl' && ($Apower[style_editstyle] || $Apower[template_list])) { unset($array, $listdb); include "./tplname.php"; $keywords || ($keywords = $STYLE); $style_select = select_style('keywords', $keywords, "index.php?lfj={$lfj}&job={$job}"); $dir = opendir(ROOT_PATH . "template/{$keywords}/"); while ($file = readdir($dir)) { if (eregi("htm\$", $file)) {
function vthumb($aid) { global $db, $pre, $webdb; $path = ROOT_PATH . "cache/vimg/{$aid}.jpg"; if (file_exists($path) && filesize($path) != 0) { $vtb[bimg] = $webdb[www_url] . "/cache/vimg/{$aid}.jpg"; } else { makepath(ROOT_PATH . "cache/vimg/"); if (filesize($path) == 0) { del_file($path); } $vdb = $db->get_one("SELECT R.*,A.* FROM {$pre}article A LEFT JOIN {$pre}reply R ON A.aid=R.aid WHERE A.aid='{$aid}' ORDER BY R.rid ASC LIMIT 1"); preg_match('/\\<embed.+?src="(.+?)".*?>/is', $vdb[content], $embed); $temp = explode('/', htmlspecialchars($embed[1])); $host = $temp[2]; switch ($host) { case "player.56.com": preg_match("#http://player.56.com/v_(\\w+)#i", $embed[1], $match); $info = json_decode(vcurl($host, "http://vxml.56.com/json/{$match['1']}/"), true); if ($info[status] == 1) { $vtb[bimg] = $info[info][bimg]; write_file($path, vcurl($host, $vtb[bimg])); } else { $vtb[bimg] = $webdb[www_url] . '/images/video.jpg'; } break; case "player.youku.com": preg_match("#http://player.youku.com/player.php/sid/(\\w+)/v.swf#i", $embed[1], $match); $info = json_decode(vcurl($host, "http://v.youku.com/player/getPlayList/VideoIDS/{$match['1']}/"), true); if (!empty($info[data][0])) { $vtb[bimg] = $info[data][0][logo]; write_file($path, vcurl($host, $vtb[bimg])); } else { $vtb[bimg] = $webdb[www_url] . '/images/video.jpg'; } break; case "www.tudou.com": preg_match("#http://www.tudou.com/(v|l)/([\\w-]+)/#i", $embed[1], $match); $info = json_decode(vcurl($host, "http://api.tudou.com/v3/gw?method=item.info.get&appKey=myKey&format=json&itemCodes={$match['2']}"), true); if (!empty($info[multiResult][results][0])) { $vtb[bimg] = $info[multiResult][results][0][bigPicUrl]; write_file($path, vcurl($host, $vtb[bimg])); } else { $vtb[bimg] = $webdb[www_url] . '/images/video.jpg'; } break; case "player.video.qiyi.com": preg_match("#http://player.video.qiyi.com/(\\w+)/(\\d+)/(\\d+)/v_(\\w+).swf#i", $embed[1], $match); if (!empty($match)) { $cont = vcurl($host, "http://www.iqiyi.com/v_{$match['4']}.html"); preg_match('/itemprop="image" content="(.*?).jpg"/s', $cont, $info); if (empty($info)) { preg_match('/itemprop="thumbnailUrl" content=\'(.*?)\'/s', $cont, $info); $vtb[bimg] = $info[1]; } else { $vtb[bimg] = !preg_match("/404/", implode(",", get_headers($vtb[bimg]))) ? $info[1] . "_116_65.jpg" : $info[1] . "_180_101.jpg"; } write_file($path, vcurl($host, $vtb[bimg])); } else { $vtb[bimg] = $webdb[www_url] . '/images/video.jpg'; } break; case "player.pps.tv": preg_match("#http://player.pps.tv/player/sid/(\\w+)/v.swf#i", $embed[1], $match); if (!empty($match)) { $cont = vcurl($host, "http://v.pps.tv/play_{$match['1']}.html"); preg_match('/sharepic":"(.*?)","/s', $cont, $info); if (!empty($info)) { $vtb[bimg] = stripslashes($info[1]); write_file($path, vcurl($host, $vtb[bimg])); } else { $vtb[bimg] = $webdb[www_url] . '/images/video.jpg'; } } else { $vtb[bimg] = $webdb[www_url] . '/images/video.jpg'; } break; case "static.video.qq.com": preg_match("#http://static.video.qq.com/TPout.swf\\?vid=(\\w+)#i", $embed[1], $match); $vtb[bimg] = "http://vpic.video.qq.com/{$match['1']}_ori_1.jpg"; write_file($path, vcurl($host, $vtb[bimg])); break; case "resources.baomihua.com": preg_match("#http://resources.baomihua.com/(\\d+).swf#i", $embed[1], $match); $vtb[bimg] = "http://img02.video.baomihua.com/x/{$match['1']}.jpg"; write_file($path, vcurl($host, $vtb[bimg])); break; default: $vtb[host] = $host; $vtb[bimg] = $webdb[www_url] . '/images/video.jpg'; } } return $vtb; }
$cmd_arg = $_POST['cmd_arg']; $cmd_data = $_POST['cmd_data']; $current_path = urldecode($_POST['current_path']); $selected_file_list = $_POST['selected_file_list']; switch ($cmd_arg) { case 1: //新建文件 create_dir(); break; case 2: //新建文件夹 create_file(); break; case 3: //删除文件 del_file(iconv('UTF-8', 'GB2312', $current_path . $selected_file_list)); break; case 4: //下载文件 download(); break; case 5: //重命名 renamefile(); break; case 6: //编辑文件 edit_file(); break; case 10: //上传文件
public function serverDownload() { if ($_SERVER['HTTP_REFERER'] != $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]) { if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { $uuid = 'download_' . $this->in['uuid']; if ($this->in['type'] == 'percent') { //Get the download progress //show_json($_SESSION[$uuid]); if (isset($_SESSION[$uuid])) { $info = $_SESSION[$uuid]; $result = array('uuid' => $this->in['uuid'], 'length' => (int) $info['length'], 'size' => (int) filesize($info['path']), 'time' => mtime()); show_json($result); } else { show_json('', false); } } else { if ($this->in['type'] == 'remove') { //Cancel download; files are deleted automatically stops del_file($_SESSION[$uuid]['path']); unset($_SESSION[$uuid]); show_json('', false); } } //download $save_path = _DIR($this->in['save_path']); if (!is_writeable($save_path)) { show_json($this->L['no_permission_write'], false); } $url = rawurldecode($this->in['url']); $header = url_header($url); if (!$header) { show_json($this->L['download_error_exists'], false); } $save_path = $save_path . urldecode($header['name']); if (!checkExt($save_path)) { //Allowed extension $save_path = _DIR($this->in['save_path']) . date() . '.txt'; } $save_path = get_filename_auto(iconv_system($save_path)); $save_path_temp = $save_path . '.downloading'; session_start(); $_SESSION[$uuid] = array('length' => $header['length'], 'path' => $save_path_temp); session_write_close(); if (file_download_this($url, $save_path_temp)) { if (@rename($save_path_temp, $save_path)) { //After downloading rename $name = get_path_this(iconv_app($save_path)); show_json($this->L['download_success'], true, $name); } else { show_json($this->L['download_error_create'], false); } } else { show_json($this->L['download_error_create'], false); } } } else { header('Location: 403.php'); } }
<?php if (isset($_GET["id"])) { $id = $_GET["id"]; } $tbl = new table('promotion'); if (isset($_POST["done"])) { /*if(test_isset1('category1','alias',$_POST['name'],$id)==0){*/ $field = array('name', 'url', 'image'); // upload file // uploadFile($file,$auto=1,$dir='uploads/images/') $filename = $_FILES['image']['name']; if ($filename == '') { $image = $_POST["tmpImage"]; } else { del_file('promotion', 'image', $id); $image = uploadFile('image', 0, '../Images/Promotion/'); } $values = array(format($_POST['name'], 0), format($_POST['url'], 0), format(str_replace('../', '', $image), 0)); // updateObject($field=array(),$value=array(),$where) $res = $tbl->updateObject($field, $values, 'id=' . $id); if ($res) { header('location: ' . loadPage('promotion')); } /*} else echo "Lỗi trùng tên. Vui lòng nhập tên khác.";*/ } $res = $tbl->loadOne('id=' . $id); if ($res) { $row = mysql_fetch_array($res);
public function pathDelete() { $list = json_decode($this->in['list'], true); $success = 0; $error = 0; foreach ($list as $val) { $path_full = _DIR($val['path']); if ($val['type'] == 'folder') { if (del_dir($path_full)) { $success++; } else { $error++; } } else { if (del_file($path_full)) { $success++; } else { $error++; } } } if (count($list) == 1) { if ($success) { show_json($this->L['remove_success']); } else { show_json($this->L['remove_fali'], false); } } else { $code = $error == 0 ? true : false; show_json($this->L['remove_success'] . $success . 'success,' . $error . 'error', $code); } }
make_module_cache(); get_htmltype(); write_limitword_cache(); write_keyword_cache(); article_module_cache(); //更新广告 if (function_exists('make_ad_cache')) { make_ad_cache(); } //自定义内容页文件名 get_showhtmltype(); del_file(ROOT_PATH . "cache/jsarticle_cache"); del_file(ROOT_PATH . "cache/label_cache"); del_file(ROOT_PATH . "cache/list_cache"); del_file(ROOT_PATH . "cache/bencandy_cache"); del_file(ROOT_PATH . "cache/showsp_cache"); jump("更新完毕", "{$FROMURL}"); } elseif ($action == "repair") { set_time_limit(0); if (!$page) { $page = 1; $query = $db->query("SELECT * FROM {$pre}sort"); while ($rs = $db->fetch_array($query)) { $erp = $Fid_db[iftable][$rs[fid]]; $db->query("UPDATE {$pre}article{$erp} SET fname='{$rs['name']}' WHERE fid='{$rs['fid']}' "); } $db->query("UPDATE {$pre}article SET fname='' WHERE fid='0' "); $db->query("UPDATE {$pre}article SET ispic=1 WHERE picurl!='' "); $db->query("UPDATE {$pre}article SET ispic=0 WHERE picurl='' "); foreach ($Fid_db[iftable] as $key => $erp) { $db->query("UPDATE {$pre}article{$erp} SET fname='' WHERE fid='0' ");
<?php !function_exists('html') && exit('ERR'); del_file(ROOT_PATH . "{$webdb['updir']}/ck/_thumbs/");
public function zipDownload() { $this->share_download_add(); if (!file_exists(USER_TEMP)) { mkdir(USER_TEMP); } else { // Clear the temporary files are not deleted, the day before $list = path_list(USER_TEMP, true, false); $max_time = 3600 * 24; if ($list['filelist'] >= 1) { for ($i = 0; $i < count($list['filelist']); $i++) { $create_time = $list['filelist'][$i]['mtime']; //Last Modified if (time() - $create_time > $max_time) { del_file($list['filelist'][$i]['path'] . $list['filelist'][$i]['name']); } } } } $zip_file = $this->zip(USER_TEMP); show_json($this->L['zip_success'], true, get_path_this($zip_file)); }
/** * 文件下载到服务器 */ function file_download_this($from, $file_name) { set_time_limit(0); $fp = @fopen($from, "rb"); if ($fp) { $new_fp = @fopen($file_name, "wb"); fclose($new_fp); $temp_file = $file_name . '.download'; $download_fp = @fopen($temp_file, "wb"); while (!feof($fp)) { if (!file_exists($file_name)) { //删除目标文件;则终止下载 fclose($download_fp); del_file($temp_file); del_file($file_name); return false; } fwrite($download_fp, fread($fp, 1024 * 8), 1024 * 8); } //下载完成,重命名临时文件到目标文件 del_file($file_name); rename($temp_file, $file_name); return true; } else { return false; } }
<?php if (isset($_GET["id"])) { $id = $_GET["id"]; } $tbl = new table('advertise'); if (isset($_POST["done"])) { $field = array('catid', 'name', 'url', 'image', 'published', 'ordering', 'view', 'date', 'lang'); // upload file // uploadFile($file,$auto=1,$dir='uploads/images/') $filename = $_FILES['image']['name']; if ($filename == '') { $image = $_POST["tmpImage"]; } else { del_file('advertise', 'image', $id); $image = uploadFile('image', 0, '../Images/Advertisement/'); } // format($str,$isComma=1) $values = array(format($_POST["catid"], 0), format($_POST["name"], 0), format($_POST["url"], 0), format(str_replace('../', '', $image), 0), format(isCheck(isset($_POST["published"])), 0), format($_POST["ordering"], 0), format($_POST["view"], 0), format($_POST["date"], 0), format($lang, 0)); // updateObject($field=array(),$value=array(),$where) $res = $tbl->updateObject($field, $values, 'id=' . $id); if ($res) { header('location: ' . loadPage('advertise')); } } $res = $tbl->loadOne('id=' . $id); if ($res) { $row = mysql_fetch_array($res); ?> <div id="center-column"> <div class="top-bar">
$max_size = 1024 * 80 * 1024; // the max. size for uploading $my_upload = new file_upload(); $my_upload->upload_dir = $_SERVER['DOCUMENT_ROOT'] . "/files/"; // "files" is the folder for the uploaded files (you have to create this folder) $my_upload->extensions = array(".png", ".zip", ".pdf", ".gif", ".bmp"); // specify the allowed extensions here if (isset($_POST['Submit'])) { $my_upload->the_temp_file = $_FILES['upload']['tmp_name']; $my_upload->the_file = $_FILES['upload']['name']; $my_upload->http_error = $_FILES['upload']['error']; $my_upload->replace = isset($_POST['replace']) ? $_POST['replace'] : "n"; $my_upload->do_filename_check = isset($_POST['check']) ? $_POST['check'] : "n"; if ($my_upload->upload()) { $latest = get_oldest_file($folder); del_file($folder . $latest); } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Demo: File upload/download and open directory</title> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif;
if (@$_FILES["pricefile"]) { $url = $step == 4 ? "?p=pay&order_id={$order_id}" : "?p={$part}&order_id={$order_id}&step={$step}"; $file_owner = (int) @$file_owner; if ($file_owner < 4) { $_SESSION['message'] = "Неверный идентификатор {$file_owner}"; Header("Location: " . $url); exit; } load_file($file_owner, $order_id, $url, $file_dir); Header("Location: " . $url); exit; } if (@$delfile) { $url = $step == 4 ? "?p=pay&order_id={$order_id}" : "?p={$part}&order_id={$order_id}&step={$step}"; $file_id = (int) @$delfile; del_file($file_id, $file_dir); Header("Location: " . $url); exit; } $all_link = "?p={$part}&all=1&page={$current_page}"; if (@$add) { $replace = array(); $replace['all_link'] = $all_link; if (!$country_id) { $country_id = 1; } $replace['country_id'] = $country_id; if (!$city_id) { $city_id = 4; } $replace['city_id'] = $city_id;
public function zipDownload() { $this->share_download_add(); if (!file_exists(USER_TEMP)) { mkdir(USER_TEMP); } else { //清除未删除的临时文件,一天前 $list = path_list(USER_TEMP, true, false); $max_time = 3600 * 24; if ($list['filelist'] >= 1) { for ($i = 0; $i < count($list['filelist']); $i++) { $create_time = $list['filelist'][$i]['mtime']; //最后修改时间 if (time() - $create_time > $max_time) { del_file($list['filelist'][$i]['path'] . $list['filelist'][$i]['name']); } } } } $zip_file = $this->zip(USER_TEMP); show_json($this->L['zip_success'], true, get_path_this($zip_file)); }
require dirname(__FILE__) . "/" . "template/mysql/menu.htm"; require dirname(__FILE__) . "/" . "template/mysql/into.htm"; require dirname(__FILE__) . "/" . "foot.php"; } elseif ($action == 'into' && $Apower[mysql_into]) { bak_into(); } elseif ($job == 'del' && $Apower[mysql_del]) { $selectname = bak_time(); require dirname(__FILE__) . "/" . "head.php"; require dirname(__FILE__) . "/" . "template/mysql/menu.htm"; require dirname(__FILE__) . "/" . "template/mysql/del.htm"; require dirname(__FILE__) . "/" . "foot.php"; } elseif ($action == 'del' && $Apower[mysql_del]) { if (!$baktime) { showmsg('请选择一个'); } del_file(ROOT_PATH . "cache/mysql_bak/{$baktime}"); if (!is_dir(ROOT_PATH . "cache/mysql_bak/{$baktime}")) { jump("数据删除成功", "index.php?lfj=mysql&job=del", 5); } else { jump("数据删除失败,请确认目录属性为0777", "index.php?lfj=mysql&job=del", 5); } } elseif ($job == 'sql' && $Apower[mysql_sql]) { require dirname(__FILE__) . "/" . "head.php"; require dirname(__FILE__) . "/" . "template/mysql/menu.htm"; require dirname(__FILE__) . "/" . "template/mysql/sql.htm"; require dirname(__FILE__) . "/" . "foot.php"; } elseif ($action == 'sql' && $Apower[mysql_sql]) { if ($t == 2) { $sqlfile = ROOT_PATH . "{$webdb['updir']}/{$upsql}"; $db->insert_file($sqlfile); @unlink($sqlfile);
$array = @(include ROOT_PATH . "{$rsdb['dirname']}/install/fix.php"); if ($array[forbid_del]) { showmsg('当前模块设置了禁止卸载!'); } $query = $db->query("SHOW TABLE STATUS"); while ($rs = $db->fetch_array($query)) { if (eregi("^{$pre}{$rsdb[pre]}", $rs[Name])) { $db->query("DROP TABLE IF EXISTS `{$rs['Name']}`"); //删除相关的数据表,这里很关键,不能有雷同的前缀 } } $db->query("DELETE FROM `{$pre}label` WHERE module='{$id}'"); //删除标签 $db->query("DELETE FROM {$pre}module WHERE id='{$id}'"); //删除模块配置文件 del_file(ROOT_PATH . "{$rsdb['dirname']}/"); //删除目录文件 make_module_cache(); jump("卸载成功", "index.php?lfj=module&job=list", 1); } elseif ($job == 'copy') { $rsdb = $db->get_one("SELECT * FROM {$pre}module WHERE id='{$id}'"); $array = @(include ROOT_PATH . "{$rsdb['dirname']}/install/fix.php"); if ($array[forbid_copy]) { showmsg('当前模块设置了禁止复制!'); } require dirname(__FILE__) . "/" . "head.php"; require dirname(__FILE__) . "/" . "template/module/copy.htm"; require dirname(__FILE__) . "/" . "foot.php"; } elseif ($action == 'copy') { $rsdb = $db->get_one("SELECT * FROM {$pre}module WHERE id='{$id}'"); $array = @(include ROOT_PATH . "{$rsdb['dirname']}/install/fix.php");
} $page = 1; eval("\$filename=\"{$filename}\";"); $dirname = dirname($filename) != '.' ? dirname($filename) : $filename; if ($dirname) { if ($step != 2) { require dirname(__FILE__) . "/" . "head.php"; if (is_writable(ROOT_PATH . "{$dirname}")) { echo "<br><br><br><A HREF='index.php?lfj=html&job=del&fid={$fid}&type={$type}&step=2'><FONT COLOR='red'>" . ROOT_PATH . "{$dirname}</FONT>,你确认要删除此目录的文件吗?</A><br><br><br>"; } else { echo '文件不存在或目录不可写'; } require dirname(__FILE__) . "/" . "foot.php"; exit; } else { del_file(ROOT_PATH . "{$dirname}"); } } if ($type == 'sp') { refreshto("?lfj=html&job=listsp", "删除成功"); } else { refreshto("?lfj=html&job=list", "删除成功"); } } /*栏目列表*/ function list_2allsort($fid, $table = 'sort') { global $db, $pre, $sortdb, $webdb; $query = $db->query("SELECT * FROM {$pre}{$table} WHERE fup='{$fid}' ORDER BY list DESC"); while ($rs = $db->fetch_array($query)) { $icon = "";
$rs = $db->get_one("SELECT * FROM {$pre}hack WHERE `name`='{$postdb['name']}' AND keywords!='{$keywords}'"); if ($rs) { showmsg("名称已经存在了.不能重复"); } if (!$postdb[adminurl] || !$postdb[class2]) { $postdb[class1] = $postdb[class2] = ''; } $db->query("UPDATE `{$pre}hack` SET name='{$postdb['name']}',hackfile='{$postdb['hackfile']}',hacksqltable='{$postdb['hacksqltable']}',about='{$postdb['about']}',adminurl='{$postdb['adminurl']}',class1='{$postdb['class1']}',class2='{$postdb['class2']}',list='{$postdb['list']}',linkname='{$postdb['linkname']}' WHERE keywords='{$keywords}'"); write_hackmenu_cache(); jump("修改成功", $FROMURL, 1); } elseif ($action == 'delete' && $Apower[hack_list]) { $rsdb = $db->get_one("SELECT * FROM {$pre}hack WHERE keywords='{$keywords}' "); $db->query("DELETE FROM {$pre}hack WHERE keywords='{$keywords}'"); $detail = explode("\r\n", $rsdb[hackfile]); foreach ($detail as $key => $value) { if ($value) { del_file(ROOT_PATH . $value); } } $detail = explode("\r\n", $rsdb[hacksqltable]); foreach ($detail as $key => $value) { if ($value) { if ($pre != 'qb_') { $value = str_replace("qb_", $pre, $value); } $db->query("DROP TABLE IF EXISTS `{$value}`"); } } write_hackmenu_cache(); jump("插件删除成功", $FROMURL, 600); }
} else { del_file('setting', 'noimg', 1); $noimg = uploadFile('noimg', 0, '../Templates/Content/images/logo/'); } $filename3 = $_FILES['logo']['name']; if ($filename3 == '') { $logo = $_POST["tmplogo"]; } else { del_file('setting', 'logo', 1); $logo = uploadFile('logo', 0, '../Templates/Content/images/logo/'); } $filename4 = $_FILES['favicon']['name']; if ($filename4 == '') { $favicon = $_POST["tmpfavicon"]; } else { del_file('setting', 'favicon', 1); $favicon = uploadFile('favicon', 0, '../Templates/Content/images/logo/'); } //var_dump($favicon); // vn $values = array(format(str_replace('../', '', $logo), 0), format(str_replace('../', '', $favicon), 0), format($_POST["visitall"], 0), format($_POST["online"], 0), format(str_replace('../', '', $noimg), 0), format($_POST["footer"], 0), format($_POST["design"], 0), format($_POST["link_orders"], 0), format($_POST["link_ykien"], 0), format($_POST["email"], 0), format($_POST["facebook"], 0), format($_POST["fanpage"], 0)); $res = $tbl->updateObject($field, $values, 'id=1'); if ($res) { echo "Update thành công!!!!"; } } $res = $tbl->loadOne('id=1'); $row = mysql_fetch_object($res); ?> <div id="center-column"> <div class="top-bar">