Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit(3600);
- error_reporting(E_ALL);
- ini_set('display_errors', TRUE);
- ini_set('display_startup_errors', TRUE);
- function generateRandomString($length = 10) {
- $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $charactersLength = strlen($characters);
- $randomString = '';
- for ($i = 0; $i < $length; $i++) {
- $randomString .= $characters[mt_rand(0, $charactersLength - 1)];
- }
- return $randomString;
- }
- isset($_REQUEST["limit"]) ? $limit = $_REQUEST["limit"] : $limit = 10;
- echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">';
- echo "<title>Test Script</title></head><body>";
- //ob_start ();
- echo "<br><br>A random delay between 20 and 60 seconds will be generated, then a randomly generated string will be displayed<br>The default limit on iterations is ten<br>When the script terminates normally, the phrase \"test complete\" will be output at the bottom<br><br>";
- flush();
- for ($i = 0; $i < $limit; $i++) {
- $delay = mt_rand (20, 60);
- echo "<br><br><br>iteration ".($i+1)." - script will now sleep for $delay seconds";
- flush();
- sleep ($delay);
- echo "<br><br>Here is a random string:<br>";
- $length = mt_rand (50, 100);
- echo generateRandomString($length);
- flush();
- }
- echo '<br><br>...test complete</body></html>';
- ob_end_flush();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment