|
4 | 4 | # @Date: 2020/11/15 02:49:02
|
5 | 5 | # @Email: its@hpv.im
|
6 | 6 | # @Last modified by: Amirhosseinhpv
|
7 |
| -# @Last modified time: 2021/05/19 12:30:19 |
| 7 | +# @Last modified time: 2021/05/19 12:40:35 |
8 | 8 | # @License: GPLv2
|
9 | 9 | # @Copyright: Copyright © 2020 Amirhosseinhpv, All rights reserved.
|
10 | 10 | ?>
|
|
25 | 25 | ob_implicit_flush(true);
|
26 | 26 | ob_start();
|
27 | 27 | echo "<script>document.title = 'Uploading ...'; document.querySelector('h1').innerHTML += '<div style=\"font-size: 0;margin-top: 3rem;\"><small style=\"font-size: 1rem;font-family: initial;font-weight: initial;\">Transferring <u>{$url}</u> as <strong>{$name}</strong><br><span style=\"margin-top: 1rem;display: block;\">Please wait until process complete or Press ESC key to cancel</span></small></div><div id=\"progress\"></div>';</script>";
|
28 |
| - $time = strtotime('now'); |
| 28 | + $time = microtime(true); |
29 | 29 | $remote = fopen($url, 'r');
|
30 | 30 | $local = fopen($name, 'w');
|
31 | 31 | $headers = get_headers($url, true);
|
@@ -79,22 +79,12 @@ function human_filesize($bytes, $decimals = 2)
|
79 | 79 | }
|
80 | 80 | function human_timing($time)
|
81 | 81 | {
|
82 |
| - $time = time() - $time; // to get the time since that moment |
83 |
| - $time = ($time<1)? 1 : $time; |
84 |
| - $tokens = array ( |
85 |
| - 31536000 => 'year', |
86 |
| - 2592000 => 'month', |
87 |
| - 604800 => 'week', |
88 |
| - 86400 => 'day', |
89 |
| - 3600 => 'hour', |
90 |
| - 60 => 'minute', |
91 |
| - 1 => 'second' |
92 |
| - ); |
93 |
| - foreach ($tokens as $unit => $text) { |
94 |
| - if ($time < $unit) continue; |
95 |
| - $numberOfUnits = floor($time / $unit); |
96 |
| - return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':''); |
97 |
| - } |
| 82 | + $s = microtime(true) - $time; |
| 83 | + $h = floor($s / 3600); |
| 84 | + $s -= $h * 3600; |
| 85 | + $m = floor($s / 60); |
| 86 | + $s -= $m * 60; |
| 87 | + return ($h > 0 ? "$h:" : "") .sprintf('%02d', $m).':'.sprintf('%02d', $s); |
98 | 88 | }
|
99 | 89 | ?>
|
100 | 90 | <form style="margin-top: 1rem;" name='upload' method='post' action="<?php echo strtok($_SERVER['REQUEST_URI'], '?');?>">
|
|
0 commit comments