fork(1) download
  1. <?php
  2.  
  3. $all = file_get_contents('./textfile.txt', true);
  4. $success = file_get_contents('./textfile2.txt', true);
  5.  
  6. $result = ("$success"*100/"$all");
  7. if ($result>100){
  8. $result = 100;
  9. }
  10. $result = round($result);
  11.  
  12. $myfile = 'textfile.txt';
  13. if (file_exists($myfile)) {
  14. echo "Файл $myfile существует";
  15. }
  16.  
  17. $myContent = $_POST['all'];
  18. file_get_contents($myfile, utf8_encode($myContent));
  19.  
  20. $myfile2 = 'textfile2.txt';
  21. $myContent2 = $_POST['success'];
  22. file_get_contents($myfile2, utf8_encode($myContent2));
  23.  
  24. echo file_get_contents($myfile2);
  25. ?>
  26.  
  27. <form action='http://content-available-to-author-only.do/index.php' method='post' >
  28. <fieldset>
  29. <input type="text" name='all' value="<?=$all;?>"><br>
  30. <input type="text" name='success' value="<?=$success;?>">
  31. <br>
  32. <button type="submit" class="btn">Результат</button>
  33. </fieldset>
  34. </form>
  35.  
  36. Проект
  37. <div class="progress progress-info">
  38. <div class="bar" style="width: <?=$result;?>%"> <?=$success;?></div>
  39. </div>
Success #stdin #stdout #stderr 0.01s 20520KB
stdin
Standard input is empty
stdout
    <form action='http://content-available-to-author-only.do/index.php' method='post' >
    <fieldset>
     <input type="text" name='all' value=""><br>
    <input type="text" name='success' value="">
	<br>
	<button type="submit" class="btn">Результат</button>
    </fieldset>
    </form>

Проект
<div class="progress progress-info">
    <div class="bar" style="width: 0%"> </div>
</div>
stderr
PHP Warning:  file_get_contents(./textfile.txt): failed to open stream: No such file or directory in /home/VgFy3H/prog.php on line 3
PHP Warning:  file_get_contents(./textfile2.txt): failed to open stream: No such file or directory in /home/VgFy3H/prog.php on line 4
PHP Warning:  Division by zero in /home/VgFy3H/prog.php on line 6
PHP Notice:  Undefined index: all in /home/VgFy3H/prog.php on line 17
PHP Warning:  file_get_contents(textfile.txt): failed to open stream: No such file or directory in /home/VgFy3H/prog.php on line 18
PHP Notice:  Undefined index: success in /home/VgFy3H/prog.php on line 21
PHP Warning:  file_get_contents(textfile2.txt): failed to open stream: No such file or directory in /home/VgFy3H/prog.php on line 22
PHP Warning:  file_get_contents(textfile2.txt): failed to open stream: No such file or directory in /home/VgFy3H/prog.php on line 24