(.*)

|Us", $data, $out, PREG_PATTERN_ORDER); $f = fopen("quote_cache.txt", "w"); foreach ($out[0] as $quote) { $quote = str_replace("\n", "", $quote); $quote = str_replace("\r", "", $quote); fwrite($f, $quote."\n"); } fclose($f); } if (file_exists("quote_cache.txt")) { $f = fopen("quote_cache.txt", "r"); $data = fread($f, filesize("quote_cache.txt")); fclose($f); $quotes = explode("\n", $data); list($usec, $sec) = explode(' ', microtime()); srand((float) $sec + ((float) $usec * 100000)); $id = rand(0, sizeof($quotes) - 1); while ($quotes[$id] == "") { $id = rand(0, sizeof($quotes) - 1); } $output = $quotes[$id]; $quotes[$id] = ""; if (sizeof($quotes) == 2) { @unlink("quote_cache.txt"); } else { $f = fopen("quote_cache.txt", "w"); foreach ($quotes as $quote) { if ($quote != "") { fwrite($f, $quote."\n"); } } fclose($f); } if (@filesize("quote_cache.txt") == 0) { @unlink("quote_cache.txt"); } }