<?php defined('IN_TS') or die('Access Denied.'); // 清空SESSION unset($_SESSION['tsuser']); session_destroy(); setcookie("ts_email", '', time() + 3600, '/'); setcookie("ts_autologin", '', time() + 3600, '/'); //判断目录可写 $f_cache = iswriteable('cache'); $f_data = iswriteable('data'); $f_plugins = iswriteable('plugins'); $f_tslogs = iswriteable('tslogs'); $f_upgrade = iswriteable('upgrade'); $f_uploadfile = iswriteable('uploadfile'); //扫描SQL文件 $arrSqls = tsScanDir('upgrade', 1); foreach ($arrSqls as $key => $item) { if ($item != 'up.php') { $arrSql[] = str_replace('.sql', '', $item); } } $title = '升级程序'; include template('index');
<?php defined('IN_TS') or die('Access Denied.'); //判断目录可写 $f_cache = iswriteable('cache'); $f_data = iswriteable('data'); $f_plugins = iswriteable('plugins'); $f_uploadfile = iswriteable('uploadfile'); $f_tslogs = iswriteable('tslogs'); $f_upgrade = iswriteable('upgrade'); include 'install/html/index.html';
可写<?php } ?> </td></tr> <tr><td>upgrade目录</td><td><?php if (iswriteable('upgrade') == 0) { ?> <font color="red">不可写</font>(请设置为可写777权限)<?php } else { ?> 可写<?php } ?> </td></tr> <tr><td>uploadfile目录</td><td><?php if (iswriteable('uploadfile') == 0) { ?> <font color="red">不可写</font>(请设置为可写777权限)<?php } else { ?> 可写<?php } ?> </td></tr> </table> </div> <div class="fbox"> <h2>软件信息</h2> <table>
function onremove() { $filename = $this->get[2]; $filename = str_replace('*', '.', $filename); $filedir = TIPASK_ROOT . "/data/db_backup/" . $filename; if (!iswriteable($filedir)) { $this->message('文件不可写!', 'admin_db/backup'); } if (file_exists($filedir)) { unlink($filedir); $this->message('删除文件成功!', 'admin_db/backup'); } }
function stepA() { show_step(1, "开始安装", "环境以及文件目录权限检查"); $os = PHP_OS; $pv = PHP_VERSION; $up = getcon("upload_max_filesize"); $cj1 = getcon("allow_url_fopen"); echo <<<EOT <div class="main"><h2 class="title">环境检查</h2> <table class="tb" style="margin:20px 0 20px 55px;"> <tr> \t<th>项目</th> \t<th class="padleft">所需配置</th> \t<th class="padleft">最佳配置</th> \t<th class="padleft">当前服务器</th> </tr> <tr> <td>操作系统</td> <td class="padleft">不限制</td> <td class="padleft">类Unix</td> <td class="w pdleft1">{$os}</td> </tr> <tr> <td>PHP 版本</td> <td class="padleft">4.4</td> <td class="padleft">5.0</td> <td class="w pdleft1">{$pv}</td> </tr> <tr> <td>附件上传</td> <td class="padleft">不限制</td> <td class="padleft">2M</td> <td class="w pdleft1">{$up}</td> </tr> <tr> <td>远程访问</td> <td class="padleft">allow_url_fopen</td> <td class="padleft">开启</td> <td class="w pdleft1">{$cj1}</td> </tr> </table> <h2 class="title">目录、文件权限检查</h2> <table class="tb" style="margin:20px 0 20px 55px;width:90%;"> \t<tr> \t<th>目录文件</th> \t<th class="padleft">所需状态</th> \t<th class="padleft">当前状态</th> </tr> EOT; $arr = array("inc/config/config.php", "inc/config/cache.php", "inc/config/config.collect.bind.php", "inc/config/license.php", "inc/config/timmingset.xml", "inc/config/voddown.xml", "inc/config/vodplay.xml", "inc/config/vodserver.xml", "inc/config/pse_artrnd.txt", "inc/config/pse_artsyn.txt", "inc/config/pse_vodrnd.txt", "inc/config/pse_vodsyn.txt", "cache/", "cache/break/", "cache/export/", "upload/", "upload/art/", "upload/arttopic/", "upload/vod/", "upload/vodthumb/", "upload/vodtopic/", "upload/playdata/", "upload/downdata/", "js/playerconfig.js", "admin/bak/"); foreach ($arr as $f) { $st = "可写"; $cs = "w"; $status = iswriteable($f); if (!$status) { $st = "不可写"; $cs = "nw"; } echo '<tr><td>' . $f . '</td><td class="w pdleft1">可写</td><td class="' . $cs . ' pdleft1">' . $st . '</td></tr>'; } unset($arr); echo <<<EOT </table> <h2 class="title">函数依赖性检查</h2> <table class="tb" style="margin:20px 0 20px 55px;width:90%;"> <tr> \t<th>函数名称</th> \t<th class="padleft">所需状态</th> \t<th class="padleft">当前状态</th> </tr> EOT; $arr = array("mysql_connect", "curl_init", "curl_exec", "mb_convert_encoding", "dom_import_simplexml"); foreach ($arr as $f) { $st = "支持"; $cs = "w"; if (!function_exists($f)) { $st = "不支持"; $cs = "nw"; } echo '<tr><td>' . $f . '</td><td class="w pdleft1">支持</td><td class="' . $cs . ' pdleft1">' . $st . '</td></tr>'; } unset($arr); echo <<<EOT </table> </div> <form method="get" autocomplete="off" action="install.php"> <input type="hidden" name="action" value="b" /><div class="btnbox marginbot"><input type="button" onclick="history.back();" value="上一步"><input type="submit" value="下一步"> </div> </form> EOT; }
//文件类型 $file_type = $_FILES['imgFile']['type']; //服务器上临时文件名 $tmp_name = $_FILES['imgFile']['tmp_name']; //文件大小 $file_size = $_FILES['imgFile']['size']; //检查文件名 if (!$file_name) { alert("请选择文件。"); } //检查目录 if (@is_dir($save_path) === false) { alert("上传目录不存在。"); } //检查目录写权限 if (iswriteable($save_path) === false) { alert("上传目录没有写权限。"); } //检查是否已上传 if (@is_uploaded_file($tmp_name) === false) { alert("临时文件可能不是上传文件。"); } //检查文件大小 if ($file_size > $max_size) { alert("上传文件大小超过限制。"); } //获得文件扩展名 $temp_arr = explode(".", $file_name); $file_ext = array_pop($temp_arr); $file_ext = trim($file_ext); $file_ext = strtolower($file_ext);