0

i have problem to run my script on a different PHP Server, on my old server the following code appears to work fine - even when p parameter is declared.

<?php
$ACCESSKEY="demo";
header('Cache-Control: no-cache, must-revalidate');

if($_GET['p']==$ACCESSKEY){
  // this is the workaround for file_get_contents(...)
  require_once (dirname(__FILE__).'/PHP_Compat-1.6.0a3/Compat/Function/file_get_contents.php');
  $data = php_compat_file_get_contents('php://input');

  $filename = $_GET['filename'];
  if (file_put_contents($filename,$data)) {
    if (filesize($filename) != 0) {
      echo "Upload success";
    } else {
      header("HTTP/1.0 400 Bad Request");
      echo "bad request";
    }
  } else {
    header("HTTP/1.0 400 Bad Request");
    echo "failed.";
  }
} else {
  header("HTTP/1.0 400 Bad Request");
  echo "Access denied";    
}

?>

and the error like this :

Notice: Undefined index: p in C:\xampp\htdocs\upload\index.php on line 5

How do I fix this? thanks

0 Answers0