Ejemplo n.º 1
0
function saveall()
{
    safePost();
    $database =& JFactory::getDBO();
    $database->setQuery("select * from `#__" . RSWEBSOLS_TABLE_PREFIX . "_param` where 1");
    $rows = $database->loadObjectList();
    foreach ($rows as $row) {
        $database->setQuery("update `#__" . RSWEBSOLS_TABLE_PREFIX . "_param` set `param_value`='" . $_POST['' . $row->param_name . ''] . "' where `id`='" . $row->id . "'");
        $database->query();
    }
    header("location:index.php?option=" . $_REQUEST['option'] . "&task=" . $_REQUEST['task'] . "&page=" . $_REQUEST['page'] . "&limit=" . $_REQUEST['limit'] . "&result=" . base64_encode('Setting Successfully Saved') . "");
    exit;
}
Ejemplo n.º 2
0
        echo '<tr>
                    <td style="text-align:center;width:60px;">' . $index . '</td>
                    <td><a target="_blank" title="点击下载" href=' . $longPath . '>' . $element['key'] . "</a></td>\n                    <td>" . $size . "MB</td>\n                    <td>" . $downtime_fomat . "</td>\n                    <td>";
        secondToDate($effecttime, $index);
        echo "</td>\n                    <td><input class='btn btn-danger' type='submit' value='delete' onclick='info()' style='padding:0 0 ;' /></td>\n                    </tr>\n                    ";
    }
    echo "</table>";
    echo "<p id='xnumber'>" . $index . "</p>";
}
function safePost($str)
{
    $val = !empty($_POST["{$str}"]) ? $_POST[$str] : null;
    return $val;
}
$url = safePost("url");
$name = safePost("filename");
$allow_type = array("wmv", "apk", "deb", "iso", "xls", "xlsx", "exe", "cpp", "pdf", "gif", "mp3", "mp4", "zip", "rar", "doc", "docx", "mov", "ppt", "pptx", "txt", "7z", "jpeg", "jpg", "JPEG", "png");
//允许的文件类型
$torrent = explode(".", $url);
$file_end = end($torrent);
$file_end = strtolower($file_end);
if (in_array($file_end, $allow_type)) {
    shell_exec("wget -b -nc --restrict-file-names=nocontrol -P ./download " . escapeshellarg($url));
    // -b 后台下载
    // -nc 文件已经存在时不覆盖
    // --restrict-file-names 解决中文地址导致文件名乱码的问题
    // -P 保存路径
    echo "<script type='text/javascript'>\n            reloadPage();\n    </script>";
} else {
    if ($file_end != null) {
        echo '<div class="alert alert-danger"> 类型: ' . $file_end . '<br />';