Guest User

Untitled

a guest
Apr 16th, 2017
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.94 KB | None | 0 0
  1. <?php
  2. //this is a working script and creates the list of what i want however i want this to be an easy to use form that outputs to a .bat file named rungpuplotgenerator.bat that then autodownloads for the user, or directs them to the download. I would also like to have it add the pause command to the end of the .bat file but that isnt absolutely needed. the comments with quotation marks are what i would like the labels for the form to be.(prefilled to show what it is supposed to look like if you were to run it.)
  3.  
  4.  
  5. $username = $_POST["Username"];
  6. $bat = ".bat";
  7. $files = "C:/Apache/htdocs/files/";
  8. $userbat = "$files$username$bat";
  9. $myfile = fopen($userbat, "w");
  10.  
  11.  
  12. //"Numeric Account ID"
  13. $ID = $_POST["ID"]; //user should be able to change this
  14. //"Nonce to start on"
  15. $StartNonce = $_POST["StartNonce"]; //user should be able to change this
  16. $PlotSize = "409600"; //user should NOT be able to change this
  17. $US = "_"; //user should NOT be able to change this
  18. //"Drive to plot on"
  19. $Drive = $_POST["Drive"]; //user should be able to change this, needs to have a ":" after the drive
  20. $Semi = ":";
  21. $Ram = $_POST["Stagger"]; //user should be able to change this
  22. //"Plot Generation Format"
  23. $Style = $_POST["Style"]; //should have a dropdown with the options "buffer" and "direct"
  24.  
  25.  
  26. $x=1;
  27. //"How many plots of 100GB would you like to make?"
  28. $plots = $_POST["plots"]; //user should be able to change this
  29.     while($x <= $plots){
  30.     $txt = "\necho starting plot $x/$plots on drive $Drive\n";
  31.     fwrite($myfile, $txt);
  32.     $txt =  "gpuplotgenerator generate $Style $Drive$Semi/Burst/plots/$ID$US$StartNonce$US$PlotSize$US$Ram\n";
  33.     fwrite($myfile, $txt);
  34.         $x++;
  35.     $StartNonce=$StartNonce+$PlotSize+1;
  36.  
  37. }
  38. fclose($myfile);
  39.  
  40. $file = $userbat;
  41.  
  42. header("Content-Description: File Transfer");
  43. header("Content-Type: application/octet-stream");
  44. header("Content-Disposition: attachment; filename='" . basename($file) . "'");
  45.  
  46. readfile ($file);
  47. exit();
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment