Esempio n. 1
0
function DoResponse()
{
    global $Config;
    if (!isset($_GET)) {
        global $_GET;
    }
    if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
        return;
    }
    // Get the main request informaiton.
    $sCommand = $_GET['Command'];
    $sResourceType = $_GET['Type'];
    $sCurrentFolder = GetCurrentFolder();
    // Check if it is an allowed command
    if (!IsAllowedCommand($sCommand)) {
        SendError(1, 'Команда "' . $sCommand . '" недоступна');
    }
    // Check if it is an allowed type.
    if (!IsAllowedType($sResourceType)) {
        SendError(1, 'Неверный тип');
    }
    // File Upload doesn't have to Return XML, so it must be intercepted before anything.
    if ($sCommand == 'FileUpload') {
        FileUpload($sResourceType, $sCurrentFolder, $sCommand);
        return;
    }
    CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
    // Execute the required command.
    switch ($sCommand) {
        case 'GetFolders':
            GetFolders($sResourceType, $sCurrentFolder);
            break;
        case 'GetFoldersAndFiles':
            GetFoldersAndFiles($sResourceType, $sCurrentFolder);
            break;
        case 'CreateFolder':
            CreateFolder($sResourceType, $sCurrentFolder);
            break;
        case 'FileDelete':
            if ($Config['Delete']) {
                FileDelete($sResourceType, $sCurrentFolder, $sCommand);
            }
            break;
        case 'FolderDelete':
            if ($Config['Delete']) {
                FolderDelete($sResourceType, $sCurrentFolder, $sCommand);
            }
            break;
    }
    CreateXmlFooter();
    exit;
}
Esempio n. 2
0
function DoResponse()
{
    if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
        return;
    }
    // Get the main request informaiton.
    $sCommand = $_GET['Command'];
    $sResourceType = $_GET['Type'];
    $sCurrentFolder = $_GET['CurrentFolder'];
    // Check the current folder syntax (must begin and start with a slash).
    if (!ereg('/$', $sCurrentFolder)) {
        $sCurrentFolder .= '/';
    }
    if (strpos($sCurrentFolder, '/') !== 0) {
        $sCurrentFolder = '/' . $sCurrentFolder;
    }
    // File Upload doesn't have to Return XML, so it must be intercepted before anything.
    if ($sCommand == 'FileUpload') {
        FileUpload($sResourceType, $sCurrentFolder);
        return;
    }
    // Prevent the browser from caching the result.
    // Date in the past
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
    // always modified
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    // HTTP/1.1
    header('Cache-Control: no-store, no-cache, must-revalidate');
    header('Cache-Control: post-check=0, pre-check=0', false);
    // HTTP/1.0
    header('Pragma: no-cache');
    // Set the response format.
    header('Content-Type:text/xml; charset=utf-8');
    CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
    // Execute the required command.
    switch ($sCommand) {
        case 'GetFolders':
            GetFolders($sResourceType, $sCurrentFolder);
            break;
        case 'GetFoldersAndFiles':
            GetFoldersAndFiles($sResourceType, $sCurrentFolder);
            break;
        case 'CreateFolder':
            CreateFolder($sResourceType, $sCurrentFolder);
            break;
    }
    CreateXmlFooter();
    exit;
}
Esempio n. 3
0
function DoResponse()
{
    if (!isset($_GET)) {
        global $_GET;
    }
    if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
        return;
    }
    // Get the main request informaiton.
    $sCommand = urlencode($_GET['Command']);
    $sResourceType = urlencode($_GET['Type']);
    $sCurrentFolder = GetCurrentFolder();
    // Check if it is an allowed command
    if (!IsAllowedCommand($sCommand)) {
        SendError(1, 'FileBrowserError_Command' . ';;' . $sCommand);
    }
    // Check if it is an allowed type.
    if (!IsAllowedType($sResourceType)) {
        SendError(1, 'FileBrowserError_Type' . ';;' . $sResourceType);
    }
    // File Upload doesn't have to Return XML, so it must be intercepted before anything.
    if ($sCommand == 'FileUpload') {
        FileUpload($sResourceType, $sCurrentFolder, $sCommand);
        return;
    }
    if ($sCommand == 'GetDwfckNs') {
        GetDwfckNs();
        return;
    }
    CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
    // Execute the required command.
    switch ($sCommand) {
        case 'GetFolders':
            GetFolders($sResourceType, $sCurrentFolder);
            break;
        case 'GetFoldersAndFiles':
            GetFoldersAndFiles($sResourceType, $sCurrentFolder);
            break;
        case 'CreateFolder':
            CreateFolder($sResourceType, $sCurrentFolder);
            break;
        case 'UnlinkFile':
            UnlinkFile($sResourceType, $sCurrentFolder, $sCommand, $_GET['file']);
            break;
    }
    CreateXmlFooter();
    exit;
}
Esempio n. 4
0
function DoResponse()
{
    if (!isset($_GET)) {
        global $_GET;
    }
    if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
        return ;

    // Get the main request informaiton.
    $sCommand        = $_GET['Command'] ;
    $sResourceType    = $_GET['Type'] ;
    $sCurrentFolder    = GetCurrentFolder() ;

    // Check if it is an allowed command
    if ( ! IsAllowedCommand( $sCommand ) )
        SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ) ;

    // Check if it is an allowed type.
    if ( !IsAllowedType( $sResourceType ) )
        SendError( 1, 'Invalid type specified' ) ;

    // File Upload doesn't have to Return XML, so it must be intercepted before anything.
    if ( $sCommand == 'FileUpload' )
    {
        FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ;
        return ;
    }

    CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;

    // Execute the required command.
    switch ( $sCommand )
    {
        case 'GetFolders' :
            GetFolders( $sResourceType, $sCurrentFolder ) ;
            break ;
        case 'GetFoldersAndFiles' :
            GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
            break ;
        case 'CreateFolder' :
            CreateFolder( $sResourceType, $sCurrentFolder ) ;
            break ;
    }

    CreateXmlFooter() ;

    exit ;
}
Esempio n. 5
0
function DoResponse()
{
    if (!isset($_GET)) {
        global $_GET;
    }
    if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
        return;
    }
    //require_once(GetRootPath() . '\\conlive_8_12\\site\\config\\project.php');
    //$con = new Project();
    $f = fopen("cok2.txt", "w");
    fprintf($f, $_SESSION['em']);
    // Get the main request informaiton.
    $sCommand = $_GET['Command'];
    $sResourceType = $_GET['Type'];
    $sCurrentFolder = GetCurrentFolder();
    // Check if it is an allowed command
    if (!IsAllowedCommand($sCommand)) {
        SendError(1, 'The "' . $sCommand . '" command isn\'t allowed');
    }
    // Check if it is an allowed type.
    if (!IsAllowedType($sResourceType)) {
        SendError(1, 'Invalid type specified');
    }
    // File Upload doesn't have to Return XML, so it must be intercepted before anything.
    if ($sCommand == 'FileUpload') {
        FileUpload($sResourceType, $sCurrentFolder, $sCommand);
        return;
    }
    CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
    // Execute the required command.
    switch ($sCommand) {
        case 'GetFolders':
            GetFolders($sResourceType, $sCurrentFolder);
            break;
        case 'GetFoldersAndFiles':
            GetFoldersAndFiles($sResourceType, $sCurrentFolder);
            break;
        case 'CreateFolder':
            CreateFolder($sResourceType, $sCurrentFolder);
            break;
    }
    CreateXmlFooter();
    exit;
}
Esempio n. 6
0
function DoResponse()
{
    if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
        return;
    }
    // Get the main request informaiton.
    $sCommand = $_GET['Command'];
    $sResourceType = $_GET['Type'];
    $sCurrentFolder = $_GET['CurrentFolder'];
    // Check if it is an allowed type.
    if (!in_array($sResourceType, array('File', 'Image', 'Flash', 'Media'))) {
        return;
    }
    // Check the current folder syntax (must begin and start with a slash).
    if (!ereg('/$', $sCurrentFolder)) {
        $sCurrentFolder .= '/';
    }
    if (strpos($sCurrentFolder, '/') !== 0) {
        $sCurrentFolder = '/' . $sCurrentFolder;
    }
    // Check for invalid folder paths (..)
    if (strpos($sCurrentFolder, '..')) {
        SendError(102, "");
    }
    // File Upload doesn't have to Return XML, so it must be intercepted before anything.
    if ($sCommand == 'FileUpload') {
        FileUpload($sResourceType, $sCurrentFolder);
        return;
    }
    CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
    // Execute the required command.
    switch ($sCommand) {
        case 'GetFolders':
            GetFolders($sResourceType, $sCurrentFolder);
            break;
        case 'GetFoldersAndFiles':
            GetFoldersAndFiles($sResourceType, $sCurrentFolder);
            break;
        case 'CreateFolder':
            CreateFolder($sResourceType, $sCurrentFolder);
            break;
    }
    CreateXmlFooter();
    exit;
}
Esempio n. 7
0
function DoResponse()
{
    if (!isset($_GET)) {
        global $_GET;
    }
    if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
        return;
    }
    $sCommand = $_GET['Command'];
    $sResourceType = $_GET['Type'];
    $sCurrentFolder = GetCurrentFolder();
    if (!IsAllowedCommand($sCommand)) {
        SendError(1, 'The "' . $sCommand . '" command isn\'t allowed');
    }
    if (!IsAllowedType($sResourceType)) {
        SendError(1, 'Invalid type specified');
    }
    if ($sCommand == 'FileUpload') {
        FileUpload($sResourceType, $sCurrentFolder, $sCommand);
        return;
    }
    CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
    switch ($sCommand) {
        case 'GetFolders':
            GetFolders($sResourceType, $sCurrentFolder);
            break;
        case 'GetFoldersAndFiles':
            GetFoldersAndFiles($sResourceType, $sCurrentFolder);
            break;
        case 'CreateFolder':
            CreateFolder($sResourceType, $sCurrentFolder);
            break;
    }
    CreateXmlFooter();
    exit;
}
Esempio n. 8
0
function clearCache()
{
    DeleteFile($GLOBALS['WEB_CACHEFile']);
    deleteFolder('./../cache/html');
    CreateFolder('./../cache/html');
    Rw(getMsg1(setL('清除缓冲完成,正在进入后台界面...'), '?act=displayAdminLogin'));
}
Esempio n. 9
0
function copyHtmlToWeb()
{
    $webDir = '';
    $toWebDir = '';
    $toFilePath = '';
    $filePath = '';
    $fileName = '';
    $fileList = '';
    $splStr = '';
    $content = '';
    $s = '';
    $s1 = '';
    $c = '';
    $webImages = '';
    $webCss = '';
    $webJs = '';
    $splJs = '';
    $webFolderName = '';
    $jsFileList = '';
    $setFileCode = '';
    $nErrLevel = '';
    $jsFilePath = '';
    $url = '';
    $setFileCode = @$_REQUEST['setcode'];
    //设置文件保存编码
    handlePower('复制生成HTML页面');
    //管理权限处理
    writeSystemLog('', '复制生成HTML页面');
    //系统日志
    $webFolderName = $GLOBALS['cfg_webTemplate'];
    if (left($webFolderName, 1) == '/') {
        $webFolderName = mid($webFolderName, 2, -1);
    }
    if (right($webFolderName, 1) == '/') {
        $webFolderName = mid($webFolderName, 1, len($webFolderName) - 1);
    }
    if (inStr($webFolderName, '/') > 0) {
        $webFolderName = mid($webFolderName, inStr($webFolderName, '/') + 1, -1);
    }
    $webDir = '/htmladmin/' . $webFolderName . '/';
    $toWebDir = '/htmlw' . 'eb/viewweb/';
    CreateDirFolder($toWebDir);
    $toWebDir = $toWebDir . pinYin2($webFolderName) . '/';
    deleteFolder($toWebDir);
    //删除
    CreateFolder('/htmlweb/web');
    //创建文件夹 防止web文件夹不存在20160504
    deleteFolder($webDir);
    CreateDirFolder($webDir);
    $webImages = $webDir . 'Images/';
    $webCss = $webDir . 'Css/';
    $webJs = $webDir . 'Js/';
    copyFolder($GLOBALS['cfg_webImages'], $webImages);
    copyFolder($GLOBALS['cfg_webCss'], $webCss);
    CreateFolder($webJs);
    //创建Js文件夹
    //处理Js文件夹
    $splJs = aspSplit(getDirJsList($webJs), vbCrlf());
    foreach ($splJs as $key => $filePath) {
        if ($filePath != '') {
            $toFilePath = $webJs . getFileName($filePath);
            aspEcho('js', $filePath);
            moveFile($filePath, $toFilePath);
        }
    }
    //处理Css文件夹
    $splStr = aspSplit(getDirCssList($webCss), vbCrlf());
    foreach ($splStr as $key => $filePath) {
        if ($filePath != '') {
            $content = getFText($filePath);
            $content = replace($content, $GLOBALS['cfg_webImages'], '../images/');
            $content = deleteCssNote($content);
            $content = PHPTrim($content);
            //设置为utf-8编码 20160527
            if (lCase($setFileCode) == 'utf-8') {
                $content = replace($content, 'gb2312', 'utf-8');
            }
            WriteToFile($filePath, $content, $setFileCode);
            aspEcho('css', $GLOBALS['cfg_webImages']);
        }
    }
    //复制栏目HTML
    $GLOBALS['isMakeHtml'] = true;
    $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn where isonhtml=true');
    while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) {
        $GLOBALS['glb_filePath'] = replace(getColumnUrl($rss['columnname'], 'name'), $GLOBALS['cfg_webSiteUrl'] . '/', '');
        if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') {
            $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html';
        }
        if (right($GLOBALS['glb_filePath'], 5) == '.html') {
            if (right($GLOBALS['glb_filePath'], 11) == '/index.html') {
                $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf();
            } else {
                $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList;
            }
            $fileName = replace($GLOBALS['glb_filePath'], '/', '_');
            $toFilePath = $webDir . $fileName;
            copyFile($GLOBALS['glb_filePath'], $toFilePath);
            aspEcho('导航', $GLOBALS['glb_filePath']);
        }
    }
    //复制文章HTML
    $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail where isonhtml=true');
    while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) {
        $GLOBALS['glb_url'] = getHandleRsUrl($rss['filename'], $rss['customaurl'], '/detail/detail' . $rss['id']);
        $GLOBALS['glb_filePath'] = replace($GLOBALS['glb_url'], $GLOBALS['cfg_webSiteUrl'] . '/', '');
        if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') {
            $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html';
        }
        if (right($GLOBALS['glb_filePath'], 5) == '.html') {
            if (right($GLOBALS['glb_filePath'], 11) == '/index.html') {
                $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf();
            } else {
                $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList;
            }
            $fileName = replace($GLOBALS['glb_filePath'], '/', '_');
            $toFilePath = $webDir . $fileName;
            copyFile($GLOBALS['glb_filePath'], $toFilePath);
            aspEcho('文章' . $rss['title'], $GLOBALS['glb_filePath']);
        }
    }
    //复制单面HTML
    $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'onepage where isonhtml=true');
    while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) {
        $GLOBALS['glb_url'] = getHandleRsUrl($rss['filename'], $rss['customaurl'], '/page/page' . $rss['id']);
        $GLOBALS['glb_filePath'] = replace($GLOBALS['glb_url'], $GLOBALS['cfg_webSiteUrl'] . '/', '');
        if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') {
            $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html';
        }
        if (right($GLOBALS['glb_filePath'], 5) == '.html') {
            if (right($GLOBALS['glb_filePath'], 11) == '/index.html') {
                $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf();
            } else {
                $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList;
            }
            $fileName = replace($GLOBALS['glb_filePath'], '/', '_');
            $toFilePath = $webDir . $fileName;
            copyFile($GLOBALS['glb_filePath'], $toFilePath);
            aspEcho('单页' . $rss['title'], $GLOBALS['glb_filePath']);
        }
    }
    //批量处理html文件列表
    //call echo(cfg_webSiteUrl,cfg_webTemplate)
    //call rwend(fileList)
    $sourceUrl = '';
    $replaceUrl = '';
    $splStr = aspSplit($fileList, vbCrlf());
    foreach ($splStr as $key => $filePath) {
        if ($filePath != '') {
            $filePath = $webDir . replace($filePath, '/', '_');
            aspEcho('filePath', $filePath);
            $content = getFText($filePath);
            foreach ($splStr as $key => $s) {
                $s1 = $s;
                if (right($s1, 11) == '/index.html') {
                    $s1 = left($s1, len($s1) - 11) . '/';
                }
                $sourceUrl = $GLOBALS['cfg_webSiteUrl'] . $s1;
                $replaceUrl = $GLOBALS['cfg_webSiteUrl'] . replace($s, '/', '_');
                //Call echo(sourceUrl, replaceUrl) 							'屏蔽  否则大量显示20160613
                $content = replace($content, $sourceUrl, $replaceUrl);
            }
            $content = replace($content, $GLOBALS['cfg_webSiteUrl'], '');
            //删除网址
            $content = replace($content, $GLOBALS['cfg_webTemplate'] . '/', '');
            //删除模板路径 记
            //content=nullLinkAddDefaultName(content)
            foreach ($splJs as $key => $s) {
                if ($s != '') {
                    $fileName = getFileName($s);
                    $content = replace($content, 'Images/' . $fileName, 'js/' . $fileName);
                }
            }
            if (inStr($content, '/Jquery/Jquery.Min.js') > 0) {
                $content = replace($content, '/Jquery/Jquery.Min.js', 'js/Jquery.Min.js');
                copyFile('/Jquery/Jquery.Min.js', $webJs . '/Jquery.Min.js');
            }
            $content = replace($content, '<a href="" ', '<a href="index.html" ');
            //让首页加index.html
            createFileGBK($filePath, $content);
        }
    }
    //把复制网站夹下的images/文件夹下的js移到js/文件夹下  20160315
    $htmlFileList = '';
    $splHtmlFile = '';
    $splJsFile = '';
    $htmlFilePath = '';
    $jsFileName = '';
    $jsFileList = getDirJsNameList($webImages);
    $htmlFileList = getDirHtmlList($webDir);
    $splHtmlFile = aspSplit($htmlFileList, vbCrlf());
    $splJsFile = aspSplit($jsFileList, vbCrlf());
    foreach ($splHtmlFile as $key => $htmlFilePath) {
        $content = getFText($htmlFilePath);
        foreach ($splJsFile as $key => $jsFileName) {
            $content = regExp_Replace($content, 'Images/' . $jsFileName, 'js/' . $jsFileName);
        }
        $nErrLevel = 0;
        $content = handleHtmlFormatting($content, false, $nErrLevel, '|删除空行|');
        //|删除空行|
        $content = handleCloseHtml($content, true, '');
        //闭合标签
        $nErrLevel = checkHtmlFormatting($content);
        if (checkHtmlFormatting($content) == false) {
            echoRed($htmlFilePath . '(格式化错误)', $nErrLevel);
            //注意
        }
        //设置为utf-8编码
        if (lCase($setFileCode) == 'utf-8') {
            $content = replace($content, '<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />', '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
        }
        $content = PHPTrim($content);
        WriteToFile($htmlFilePath, $content, $setFileCode);
    }
    //images下js移动到js下
    foreach ($splJsFile as $key => $jsFileName) {
        $jsFilePath = $webImages . $jsFileName;
        $content = getFText($jsFilePath);
        $content = PHPTrim($content);
        WriteToFile($webJs . $jsFileName, $content, $setFileCode);
        DeleteFile($jsFilePath);
    }
    copyFolder($webDir, $toWebDir);
    //使htmlWeb文件夹用php压缩
    if (@$_REQUEST['isMakeZip'] == '1') {
        makeHtmlWebToZip($webDir);
    }
    //使网站用xml打包20160612
    if (@$_REQUEST['isMakeXml'] == '1') {
        makeHtmlWebToXmlZip('/htmladmin/', $webFolderName);
    }
    //浏览地址
    $url = 'http://10.10.10.57/' . $toWebDir;
    aspEcho('浏览', '<a href=\'' . $url . '\' target=\'_blank\'>' . $url . '</a>');
}
Esempio n. 10
0
        mkdir($GLOBALS['IMG_PATH'] . $programID, 0755, true);
    }
    if (!empty($url)) {
        downloadFile($url, $GLOBALS['IMG_PATH'] . $programID . "\\" . basename($url));
    }
}
//lay du lieu tu url
$sFile = file_get_contents($CJ_MEDIA_URL, False, $cxContext);
//lay ra du lieu dang array tu du lieu lay ve
$datas = json_decode($sFile);
$count = 0;
foreach ($datas as $data) {
    $sql = "insert into films(title, short_summary, slug, user_id, sub_cat_id, running_time) values('" . $data->title . "', '" . $data->contenttitle . "', '" . $data->programid . "', '1', '3', '" . $data->playtime . "')";
    //"http://image.watchon.cjem.skcdn.com/VOD/GA/B120169270/B120169270_EPI0005_01_B.jpg";
    //tao moi folder image theo Program ID
    CreateFolder($data->programid, $data->contentimg);
    $data->mediaurl = str_replace("_t35", "_t33", $data->mediaurl);
    //download film
    try {
        //downloadFile($media_url, $store_path. basename($media_url));
        downloadFile($download_host . $data->mediaurl, $store_path . basename($data->mediaurl));
        echo "finish downloading " . basename($data->mediaurl);
    } catch (Exception $e) {
        echo 'Caught exception: ', $e->getMessage(), "\n";
    }
    echo $sql;
    $conn->query("SET NAMES 'UTF8'");
    if ($conn->query($sql) === TRUE) {
        echo "New record created successfully";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
Esempio n. 11
0
}
if (substr($sCurrentFolder, 0, 1) !== '/') {
    $sCurrentFolder = '/' . $sCurrentFolder;
}
// Execute the required command.
switch ($sCommand) {
    case 'FileUpload':
        FileUpload($sCurrentFolder);
        break;
    case 'DeleteFile':
        CreateXmlHeader('DeleteFile', $sCurrentFolder);
        DeleteFile($sCurrentFolder, $sType);
        CreateXmlFooter();
        break;
    case 'GetFoldersAndFiles':
        CreateXmlHeader('GetFoldersAndFiles', $sCurrentFolder);
        GetFoldersAndFiles($sCurrentFolder, $sType);
        CreateXmlFooter();
        break;
    case 'CreateFolder':
        CreateXmlHeader('CreateFolder', $sCurrentFolder);
        CreateFolder($sCurrentFolder, $sType);
        CreateXmlFooter();
        break;
    default:
    case 'GetFolders':
        CreateXmlHeader('GetFolders', $sCurrentFolder);
        GetFolders($sCurrentFolder, $sType);
        CreateXmlFooter();
        break;
}
Esempio n. 12
0
function scanUrl($httpUrl, $toTitle, $codeset)
{
    $splStr = '';
    $i = '';
    $s = '';
    $content = '';
    $PubAHrefList = '';
    $PubATitleList = '';
    $splUrl = '';
    $spltitle = '';
    $title = '';
    $url = '';
    $htmlDir = '';
    $htmlFilePath = '';
    $nOK = '';
    $dataArray = '';
    $webState = '';
    $u = '';
    $iniDir = '';
    $iniFilePath = '';
    $websize = '';
    $nSetTime = '';
    $startTime = '';
    $openSpeed = '';
    $isLocal = '';
    $isThrough = '';
    $htmlDir = '/../网站UrlScan/' . setFileName(getWebSite($httpUrl));
    CreateDirFolder($htmlDir);
    $htmlFilePath = $htmlDir . '/' . setFileName($httpUrl) . '.html';
    $iniDir = $htmlDir . '/conifg';
    CreateFolder($iniDir);
    $iniFilePath = $iniDir . '/' . setFileName($httpUrl) . '.txt';
    //httpurl="http://maiside.net/"
    $webState = 0;
    $nSetTime = 1;
    $openSpeed = 0;
    if (CheckFile($htmlFilePath) == false) {
        $startTime = now();
        aspEcho('codeset', $codeset);
        $dataArray = handleXmlGet($httpUrl, $codeset);
        $content = $dataArray[0];
        $content = toGB2312Char($content);
        //给PHP用,转成gb2312字符
        $webState = $dataArray[1];
        $openSpeed = dateDiff('s', $startTime, now());
        //content=gethttpurl(httpurl,codeset)
        //call createfile(htmlFilePath,content)
        WriteToFile($htmlFilePath, $content, $codeset);
        createFile($iniFilePath, $webState . vbCrlf() . $openSpeed);
        $nSetTime = 3;
        $isLocal = 0;
    } else {
        //content=getftext(htmlFilePath)
        $content = reaFile($htmlFilePath, $codeset);
        $content = toGB2312Char($content);
        //给PHP用,转成gb2312字符
        $splStr = aspSplit(getFText($iniFilePath), vbCrlf());
        $webState = CInt($splStr[0]);
        $openSpeed = CInt($splStr[0]);
        $isLocal = 1;
    }
    $websize = getFSize($htmlFilePath);
    if ($websize == '') {
        $websize = 0;
    }
    aspEcho('isLocal', $isLocal);
    $rsObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'weburlscan where httpurl=\'' . $httpUrl . '\'');
    if (@mysql_num_rows($rsObj) == 0) {
        $rs = mysql_fetch_array($rsObj);
        connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'weburlscan(httpurl,title,charset) values(\'' . $httpUrl . '\',\'' . $toTitle . '\',\'' . $codeset . '\')');
    }
    connexecute('update ' . $GLOBALS['db_PREFIX'] . 'weburlscan  set webstate=' . $webState . ',websize=' . $websize . ',openspeed=' . $openSpeed . ',charset=\'' . $codeset . '\'  where httpurl=\'' . $httpUrl . '\'');
    //strLen(content)  不用这个,不精准
    $s = getContentAHref('', $content, $PubAHrefList, $PubATitleList);
    $s = handleScanUrlList($httpUrl, $s);
    //call echo("httpurl",httpurl)
    //call echo("s",s)
    //call echo("PubATitleList",PubATitleList)
    $nOK = 0;
    $splUrl = aspSplit($PubAHrefList, vbCrlf());
    $spltitle = aspSplit($PubATitleList, vbCrlf());
    for ($i = 1; $i <= uBound($splUrl); $i++) {
        $title = $spltitle[$i];
        $url = $splUrl[$i];
        //去掉#号后台的字符20160506
        if (inStr($url, '#') > 0) {
            $url = mid($url, 1, inStr($url, '#') - 1);
        }
        if ($url == '') {
            if ($title != '') {
                aspEcho('网址为空', $title);
            }
        } else {
            $url = handleScanUrlList($httpUrl, $url);
            $url = handleWithWebSiteList($httpUrl, $url);
            if ($url != '') {
                $rsObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'weburlscan where httpurl=\'' . $url . '\'');
                if (@mysql_num_rows($rsObj) == 0) {
                    $rs = mysql_fetch_array($rsObj);
                    $u = lCase($url);
                    if (inStr($u, 'tools/downfile.asp') > 0 || inStr($u, '/url.asp?') > 0 || inStr($u, '/aspweb.asp?') > 0 || inStr($u, '/phpweb.php?') > 0 || $u == 'http://www.maiside.net/qq/' || inStr($u, 'mailto:') > 0 || inStr($u, 'tel:') > 0 || inStr($u, '.html?replytocom') > 0) {
                        //.html?replytocom  王通网站
                        $isThrough = 0;
                    } else {
                        $isThrough = 1;
                        //不用true 因为写入数据会有问题
                    }
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'weburlscan(tohttpurl,totitle,httpurl,title,isthrough,charset) values(\'' . $httpUrl . '\',\'' . $toTitle . '\',\'' . $url . '\',\'' . left($title, 255) . '\',' . $isThrough . ',\'' . $codeset . '\')');
                    $nOK = $nOK + 1;
                    aspEcho($i, $url);
                } else {
                    aspEcho($title, $url);
                }
            }
        }
    }
    $scanUrl = $nSetTime;
    return @$scanUrl;
}
Esempio n. 13
0
function DoCreateNewTypeDir()
{
    if ($GLOBALS["sAutoTypeDir"] == "") {
        return;
    }
    $a = explode("/", $GLOBALS["sAutoTypeDir"]);
    for ($i = 0; $i < count($a); $i++) {
        if ($a[$i] != "") {
            CreateFolder($a[$i]);
        }
    }
}
Esempio n. 14
0
function DoCreateNewDir()
{
    if ($GLOBALS["nCusDirFlag"] == 1) {
        $a = explode("/", $GLOBALS["sCusDir"]);
        for ($i = 0; $i < count($a); $i++) {
            if ($a[$i] != "") {
                CreateFolder($a[$i]);
            }
        }
    }
    switch ($GLOBALS["nAutoDir"]) {
        case 1:
            $s_DateDir = date("Y");
            break;
        case 2:
            $s_DateDir = date("Ym");
            break;
        case 3:
            $s_DateDir = date("Ymd");
            break;
        default:
            $s_DateDir = "";
            break;
    }
    if ($s_DateDir != "") {
        CreateFolder($s_DateDir);
    }
}