<?


function make_seed() {


    list($usec, $sec) = explode(' ', microtime());


    return  ((float) $usec * 12345);


}








srand(make_seed());


$seed = rand(1000000,9999999);





srand((double)microtime()*$seed);





$file_name = 'example.txt';


$break_txt = "--BREAK--";


$max_items = 3;


$style = "<style> P.txt { color: black; font-family: verdana; font-weight: normal; font-size: 10pt; } a:link.txt { color: blue; font-family: verdana; font-weight: bold; font-size: 12pt; } a:visited.txt { color: blue; font-family: verdana; font-weight: bold; font-size: 12pt; } </style>";


$cont = "";


$f = fopen($file_name, "r");


while (!feof($f))


{


  $cont .=  fread($f, 4096);


}


fclose($f);


$fitems = split($break_txt, $cont);


$items = array();


for ($j=0;$j<count($fitems);$j++)


{


  ;


  if (strstr($fitems[$j], "href"))


    $items[] = $fitems[$j];


}


$rit = array_rand($items, count($items));


print $style;


for ($i=0;$i<$max_items && $i < count($rit);$i++)


{


  print str_replace("href", " class=\"txt\" href", $items[$rit[$i]]);


}


?>
