<?php function speed($s, $t, $a) { define("M_S", 3.6); define("KP_H", 1); if ($a == "ms") { $v = $s / $t / M_S; echo "The speed of the car is {$v}ms<br>"; } elseif ($a == "kph") { $v = $s / $t / KP_H; echo "The speed of the car is {$v}kph<br>"; } } speed(200, 4, "kph");
$ssdb->close(); speed('set speed: ', count($data)); speed(); try { $ssdb = new SSDB\Client($host, $port); } catch (Exception $e) { die(__LINE__ . ' ' . $e->getMessage()); } foreach ($data as $k => $v) { $ret = $ssdb->get($k); if ($ret === false) { echo "error\n"; break; } } $ssdb->close(); speed('get speed: ', count($data)); function speed($msg = null, $count = 0) { static $stime; if (!$msg && !$count) { $stime = microtime(1); } else { $etime = microtime(1); $ts = $etime - $stime == 0 ? 1 : $etime - $stime; $speed = $count / floatval($ts); $speed = sprintf('%.2f', $speed); echo "{$msg}: " . $speed . "\n"; $stime = $etime; } }
<p>Distance, km:<br /><input type="text" name="S"/></p> <p>Time, hour:<br /><input type="text" name="t" value=""/></p> <p><input type="submit" value="Send"></p> </form> </body> </html> <?php $distance = abs($_POST["S"]); $time = abs($_POST["t"]); if ($distance == Null) { $distance = 0; } if ($time == Null or $time == 0) { $time = 1; $distance = 0; } function speed($S, $t) { $speed = $S / $t; return $speed; } echo 'Speed : <br>'; echo speed($distance, $time), ' km/h', '<br> or <br>'; echo round(speed($distance, $time) * 1000 / 3600, 2, PHP_ROUND_HALF_UP), ' m/s', '<br>'; ?> <a href ="form.html">Back</a>
function formatItemDescription($torrent) { global $theUILang; $desc = '<font size=2><fieldset><legend>' . $theUILang["Transfer"] . '</legend>' . '<strong>' . $theUILang["Size"] . ": </strong>" . bytes($torrent["size"]) . "<br>"; if ($torrent["downloaded"] != $torrent["size"]) { $desc .= '<strong>' . $theUILang["Downloaded"] . ": </strong>" . bytes($torrent["downloaded"]) . "<br>"; } if ($torrent["eta"] > 0) { $desc .= '<strong>' . $theUILang["Remaining"] . ": </strong>" . eta($torrent["eta"]) . "<br>"; } if ($torrent["dl"] >= 1024) { $desc .= '<strong>' . $theUILang["Down_speed"] . ": </strong>" . speed($torrent["dl"]) . "<br>"; } if ($torrent["uploaded"] > 0) { $desc .= '<strong>' . $theUILang["Uploaded"] . ": </strong>" . bytes($torrent["uploaded"]) . "<br>"; } if ($torrent["ul"] >= 1024) { $desc .= '<strong>' . $theUILang["Ul_speed"] . ": </strong>" . speed($torrent["ul"]) . "<br>"; } $desc .= '<strong>' . $theUILang["Share_ratio"] . ": </strong>" . $torrent["ratio"] . "<br>"; if ($torrent["seeds"] != "0 (0)") { $desc .= '<strong>' . $theUILang["Seeds"] . ": </strong>" . $torrent["seeds"] . "<br>"; } if ($torrent["peers"] != "0 (0)") { $desc .= '<strong>' . $theUILang["Peers"] . ": </strong>" . $torrent["peers"] . "<br>"; } $desc .= "</fieldset>"; if (!empty($torrent["mesage"])) { $desc .= '<fieldset><legend>' . $theUILang["Track_status"] . '</legend>' . htmlspecialchars($torrent["mesage"], ENT_COMPAT, "UTF-8") . '</fieldset>'; } if (!empty($torrent["comment"])) { $desc .= '<fieldset><legend>' . $theUILang["Comment"] . '</legend>' . htmlspecialchars($torrent["comment"], ENT_COMPAT, "UTF-8") . '</fieldset>'; } return $desc; }
$DATA = unserialize(@file_get_contents("/usr/share/squid3/CurrentSizesUsers.db")); if ($argv[2] != null) { $DATA = $DATA[$argv[2]]; } if ($argv[3] != null) { $DATA = $DATA[$argv[2]][$argv[3]]; } print_r($DATA); die; } if ($argv[1] == "--schedules") { set_schedules(); exit; } if ($argv[1] == "--speed") { speed(); exit; } mQuotaWebFilter(); function set_schedules() { $sock = new sockets(); $cronfile = "/etc/cron.d/artica-quota-speed"; $EnableQuotasStatistics = intval($sock->GET_INFO("EnableQuotasStatistics")); $QuotasStatisticsInterval = intval($sock->GET_INFO("QuotasStatisticsInterval")); if ($EnableQuotasStatistics == 0) { if (is_file($cronfile)) { @unlink($cronfile); system("/etc/init.d/cron reload"); } return;