Example #1
0
                 $package_level = (int) $m_row['Level'];
                 if ($udid_level <= $package_level) {
                     httpinfo(4033);
                 }
             }
             DB::update(DCRM_CON_PREFIX . 'UDID', array('Downloads' => (int) $udid_status['Downloads'] + 1), array('UDID' => $_SERVER['HTTP_X_UNIQUE_ID']));
         } else {
             httpinfo(4033);
         }
     } else {
         httpinfo(4030);
     }
 }
 DB::update(DCRM_CON_PREFIX . 'Packages', array('DownloadTimes' => (int) $m_row['DownloadTimes'] + 1), array('ID' => (string) $request_id));
 if ($php_forward == 2 || $php_forward == "") {
     downFile($download_path, $fake_name);
 } else {
     function xsendfile_header($self_header, $relative = true)
     {
         global $download_path, $fake_name;
         header('Accept-Ranges: bytes');
         header('Content-type: application/octet-stream');
         header('Content-Disposition: attachment; filename="' . rawurlencode($fake_name) . '"');
         header($self_header . ': ' . ($relative ? SITE_PATH . substr($download_path, 2) : $download_path));
         exit;
     }
     $module_enabled = get_option('module_enabled');
     switch ($webserver[0]) {
         case 'nginx':
             xsendfile_header('X-Accel-Redirect');
             break;
Example #2
0
\t<input type='hidden' name='filename' value='{$filename}' />
\t<input type="submit" value="重命名"/>
\t</form>
EOF;
    echo $str;
} elseif ($act == "doRename") {
    //实现重命名的操做
    $newname = $_REQUEST['newname'];
    $mes = renameFile($filename, $newname);
    alertMes($mes, $redirect);
} elseif ($act == "delFile") {
    $mes = delFile($filename);
    alertMes($mes, $redirect);
} elseif ($act == "downFile") {
    //完成下载的操作
    $mes = downFile($filename);
} elseif ($act == "创建文件夹") {
    $mes = createFolder($path . "/" . $dirname);
    alertMes($mes, $redirect);
} elseif ($act == "renameFolder") {
    $str = <<<EOF
\t\t\t<form action="index.php?act=doRenameFolder" method="post"> 
\t请填写新文件夹名称:<input type="text" name="newname" placeholder="重命名"/>
\t<input type="hidden" name="path" value="{$path}" />
\t<input type='hidden' name='dirname' value='{$dirname}' />
\t<input type="submit" value="重命名"/>
\t</form>
EOF;
    echo $str;
} elseif ($act == "doRenameFolder") {
    $newname = $_REQUEST['newname'];
Example #3
0
 *
 * WEIPDCRM is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with WEIPDCRM.  If not, see <http://www.gnu.org/licenses/>.
 */
$_customct = true;
require_once 'system/common.inc.php';
if (!empty($_GET['request']) and (!empty($_SERVER['HTTP_X_UNIQUE_ID']) or DCRM_DIRECT_DOWN == 1)) {
    $lastip = DB::fetch_first("SELECT `IP` FROM `" . DCRM_CON_PREFIX . "UDID` WHERE `UDID` = '" . $_SERVER['HTTP_X_UNIQUE_ID'] . "'");
    $nowip = _ip2long(getIp());
    if (!empty($lastip) && $lastip['IP'] != $nowip) {
        DB::update(DCRM_CON_PREFIX . 'UDID', array('IP' => $nowip), array('UDID' => $_SERVER['HTTP_X_UNIQUE_ID']));
    }
    $r_path = $_GET['request'];
    $list_text = array('Release', 'Release.gpg', 'Packages', 'Packages.gz', 'Packages.bz2');
    if (in_array($r_path, $list_text)) {
        if (file_exists($r_path)) {
            downFile($r_path, $r_path);
        } else {
            httpinfo(404);
        }
    } else {
        httpinfo(405);
    }
} else {
    httpinfo(400);
}
Example #4
0
    $newname = $_REQUEST['newname'];
    $message = renameFile($filename, $newname);
    alertMessage($message, $redirect);
} elseif ($action == "delFile") {
    /*
     * 删除文件
     * 2014-12-03 11:28:46
     */
    $message = delFile($filename);
    alertMessage($message, $redirect);
} elseif ($action == "downFile") {
    /**
     * 下载文件
     * 2014-12-03 13:34:28
     */
    $message = downFile($filename);
} elseif ($action == "copyFile") {
    /**
     * 复制文件
     * 2014-12-03 18:49:36
     */
    $str = <<<EOF
    <form action="index.php?action=doCopyFile" method = "post">
        将文件复制到:<input type="text"  name="dstname" placeholder="将文件复制到"/>
        <input type="hidden" name="path" value="{$path}" />
        <input type="hidden" name="filename" value="{$filename}" />
        <input type="submit" value="复制文件" />
    </form>
EOF;
    echo $str;
} else {
Example #5
0
 public function act_gotoDown()
 {
     F("dp");
     $getData = M("Developer");
     $where = "id='" . $this->act_getUserInfor('id') . "'";
     $data = $getData->getDeveloper("ftp_url,erp_account,ftp_pwd", $where);
     //var_dump(WEB_PATH.$data[0]['ftp_url']);exit;
     downFile(WEB_PATH . $data[0]['ftp_url'], "资料下载.zip");
 }
Example #6
0
    $res = rename($dir, $dest);
    //返回当前目录
    chdir($oldWD);
    if ($res) {
        $oMsg = new message($res);
        echo $oMsg;
    } else {
        // 失败
        $oMsg = new message(false, "{$dir}目录或文件名错误");
        echo $oMsg;
    }
} elseif ('download' === $act) {
    $dir = HOME_PRO . $dir;
    //验证输入目录
    chk_dir($dir);
    downFile($dir);
} elseif ('info' === $act) {
    $dir = HOME_PRO . $dir;
    //验证输入目录
    chk_dir($dir);
    $homeUrl = rtrim($_SERVER["HTTP_REFERER"], DS);
    //url
    //若果是图片,则返回图片标签
    if (@getimagesize($dir)) {
        $dir = ltrim($dir, HOME_PRO);
        echo "{\"success\":\"true\",\"msg\":\"" . $homeUrl . DS . $dir . "\"}";
        exit;
    } else {
        $oMsg = new message(false, "暂时只支持图片格式预览!");
        echo $oMsg;
    }
<?php

require_once "../admin_conn.php";
require_once "collect_fun.php";
chkLogin();
$file = be("get", "file");
if (isN($file)) {
    errMsg("文件不能为空");
}
downFile($file);
function downFile($fileName)
{
    //$fileName = iconv("UTF-8", "GBK", $fileName);
    $filePath = "../../upload/export/" . iconv("UTF-8", "GBK", $fileName) . ".txt";
    $file = fopen($filePath, "r");
    Header("Content-type: application/octet-stream");
    Header("Accept-Ranges: bytes");
    Header("Accept-Length: " . filesize($filePath));
    if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
        Header("Content-Disposition: attachment; filename=" . urlencode($fileName) . ".txt;");
    } else {
        Header("Content-Disposition: attachment; filename=" . $fileName . ".txt;");
    }
    echo fread($file, filesize($filePath));
    fclose($file);
    exit;
}
Example #8
0
// echo 'html123';
/*$file_path='/var/www/html/InLamp/public/LearningPartner0.1.1.apk';
$size=filesize($file_path);
if (file_exists($file_path)&&$size) {
	header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
	header("Accept-Ranges: bytes");
	header("Content-Length: {$size}");
	header("Accept-Length: {$size}");
	header("Content-Disposition: attachment;filename=LearningPartner0.1.1.apk");
	echo include $file_path;
	ob_flush();
}else{
	echo '文件不存在';exit;
}*/
$file_path = '试客小兵和懒猫助手躲开越狱检测教程.doc';
downFile($file_path, '试客小兵和懒猫助手躲开越狱检测教程.doc');
/**
 * downFile 下载文件
 * @param string $file_path 绝对路径
 * @param string $saveName 浏览器上下载完的附件名
 */
function downFile($file_path, $saveName = '')
{
    //判断文件是否存在
    // $file_path = iconv('utf-8', 'gb2312', $file_path); //对可能出现的中文名称进行转码
    if (!file_exists($file_path)) {
        exit('文件不存在!');
    }
    if ($saveName == '') {
        $saveName = urldecode(basename($file_path));
        //获取文件名称