Diferències

Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.

Enllaç a la visualització de la comparació

Següent revisió
Revisió prèvia
Següent revisióAmbdós costats nova versio
forum [d/m/Y H:i] – creat perecomellasforum [d/m/Y H:i] perecomellas
Línia 1: Línia 1:
 <php> <php>
 function get_num() { function get_num() {
-$num = file_get_contents('forum/not.txt');+$num = 0; 
 +$file = "forum/$num/not.txt"; 
 +while (file_exists($file)) { 
 +++$num; 
 +$file = "forum/$num/not.txt"; 
 +}
 return $num; return $num;
 } }
-echo '<table width="500" border="0" align="center">';+function get_seed() { 
 +$f = "forum/seed.txt"; 
 +$seed = file_get_contents($f); 
 +++$seed; 
 +unlink($f); 
 +$fp = fopen($f, 'w'); 
 +fwrite($fp, $seed); 
 +fclose($fp); 
 +return $seed; 
 +
 +echo '<div align="center"><table width="90%" border="0" align="center">';
 $not=get_num(); $not=get_num();
 $bool = array(); $bool = array();
-$max=0; +for ($i=0; $i<$not; ++$i) { 
-for ($i=0; $i<=$not; ++$i) { + $bool[$i]=true;
- $dir="forum/$i/not.txt"; +
- $bool[$i]=file_exists($dir); +
- if ($bool[$i]==true) ++$max;+
 } }
 $bg[0]="#FF0000"; $bg[0]="#FF0000";
Línia 22: Línia 34:
 $aut[1]="#FF0000"; $aut[1]="#FF0000";
 $aut[2]="#000000"; $aut[2]="#000000";
-for ($i=0; $i<$max; ++$i) { +for ($i=0; $i<$not; ++$i) { 
- $r = rand(0,$not); +        srand(get_seed()); 
- while (!$bool[$r]) $r = rand(0,$not);+ $r = rand(0,$not-1); 
 + while (!$bool[$r]) $r = mt_rand(0,$not-1);
  $bool[$r]=false;  $bool[$r]=false;
  $file = "forum/$r/not.txt";  $file = "forum/$r/not.txt";
  $text = file_get_contents($file);  $text = file_get_contents($file);
  $dades = explode("$",$text);  $dades = explode("$",$text);
- echo '<tr><td bgcolor="'.$bg[$i%3].'"><a href="doku.php?id=post'.$r.'"><p style="color:'.$tit[$i%3].'">'.$dades[0].'</p><p align="right" style="color:'.$aut[$i%3].'>'.$dades[1].'</p></a></td></tr>';+ echo '<tr><td bgcolor="'.$bg[$i%3].'"><a href="doku.php?id=post'.$r.'"><p style="color:'.$tit[$i%3].';margin-left:10px; margin-top:10px;font-size:14px">'.$dades[1].'</p><p align="right" style="color:'.$aut[$i%3].'; margin-right:10px;font-size:14px">'.$dades[0].'</p></a></td></tr>';
 } }
-echo '<tr><td style="font-size:16px"><a href="doku.php?id=nou_genere">Envia el teu post</a></td></tr></table><br><br>';+echo '<tr><td bgcolor="#FFFFFF" style="font-size:16px"><br><a href="doku.php?id=nou_genere">Envia el teu post</a></td></tr></table></div>';
 </php> </php>
forum.txt · Darrera modificació: d/m/Y H:i per 127.0.0.1
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0