0

i am running a site where users can come and download files (These files are stored in external servers).

The users requests for those files through form like this

<form action="https://www.worldofpcgames.com/dedicated-download" method="post" target="_blank">
    <input name="filename" type="hidden" value="The_Pirates_Fate.zip" />
    <input name="fileserver" type="hidden" value="sv6" />
    <input name="filesize" type="hidden" value="64.7KB" />
    <input name="id" type="hidden" value="120" />
    <div align="center">
        <input alt="Download" height="39" src="https://www.worldofpcgames.com/wp-content/uploads/2016/09/Download.png" type="image" width="150" />
    </div>
</form>

And this is the PHP file through which the files are requested from the servers

<?php

$fileservername = $_POST['fileserver'];

function download($serverip){ 
    $file = $_POST['filename'];; 
    $salt = 'enigma'; 
    $path = '/protected/'.$file; 
    $timestamp = time() + 604800; // 7 days valid 
    $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; 
    $ok= $timestamp.$path.$ip." ".$salt; 
    $mdhash = md5($ok, TRUE); 
    // order isn't important at all.$ 
    $b64hash = base64_encode($mdhash); 
    $b64hashslash = str_replace("/","_",$b64hash); 
    $b64hashequal = str_replace("=", "",$b64hashslash); 
    $b64hashplus = str_replace("+", "-",$b64hashequal); 
    $b64hashfinal = $b64hashplus; 
    $url = "http://{$serverip}{$path}?md5={$b64hashfinal}&expires={$timestamp}"; 
    echo $url; 
    echo "\n"; echo $ip;

    header("Location: $url"); 
}

if($fileservername == "zwitterion"){
    $serverip="HERE_MY_IP_IS_USED";
    download($serverip); 
} elseif($fileservername == "neutron"){
    $serverip="HERE_MY_IP_IS_USED";
    download($serverip); 
} elseif($fileservername == "proton"){
    $serverip="HERE_MY_IP_IS_USED";
    download($serverip); 
} elseif($fileservername == "ion"){
    $serverip="HERE_MY_IP_IS_USED";
    download($serverip); 
} elseif($fileservername == "halide"){
    $serverip="HERE_MY_IP_IS_USED";
    download($serverip);     
} elseif($fileservername == "sv6"){
    $serverip="HERE_MY_IP_IS_USED";
    download($serverip); 
} else{ 
    header("Location: https://worldofpcgames.com/404-not-found/"); 
    /* Redirect browser */ 
}

?>

The problem that i have is getting large amount of errors in my apache2 error log in the main site / server.

Its around 21 GB, and this is the only error i am getting the error log

Undefined index: fileserver in /home/admin/web/worldofpcgames.com/public_html/fetch.php on line 37, referer: https://worldofpcgames.com/fetch.php

I am worried as it might be a serious error, i do not understand PHP at all, so if anyone could help please i would appreciate it.

0 Answers0