AllenYuan

draw.php save invoker

May 1st, 2020
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. <?php
  2.  
  3. $x = intval($_REQUEST['x']);
  4. $y = intval($_REQUEST['y']);
  5.  
  6. if ($_REQUEST['submit']) {
  7.   // extract data from post and save it to a file
  8.   $data = $_POST['data'];
  9.   $key = "$x,$y";
  10.   $filename = "tmp/" . $key . '-' . rand()%100;
  11.   file_put_contents($filename, json_encode($data));
  12.  
  13.   // run save.py
  14.   $result = trim(shell_exec("python save.py '$x' '$y' '$filename' 2>&1"));
  15.   if ($result != 1) {
  16.     die("Error saving. $result<HR>");
  17.   }
  18.  
  19.   print "<script>window.location = 'index.php';</script>";
  20.   return;
  21. }
  22.  
  23. $time = time();
  24. print <<<EOF
  25.  
  26. //...
Advertisement
Add Comment
Please, Sign In to add comment