Diferències
Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.
Següent revisió | Revisió prèviaSegüent revisióAmbdós costats nova versio | ||
forum [d/m/Y H:i] – creat perecomellas | forum [d/m/Y H:i] – perecomellas | ||
---|---|---|---|
Línia 1: | Línia 1: | ||
<php> | <php> | ||
function get_num() { | function get_num() { | ||
- | $num = file_get_contents(' | + | $num = 0; |
+ | $file = "forum/$num/not.txt"; | ||
+ | while (file_exists($file)) { | ||
+ | ++$num; | ||
+ | $file = " | ||
+ | } | ||
return $num; | return $num; | ||
} | } | ||
- | echo '< | + | function get_seed() { |
+ | $f = " | ||
+ | $seed = file_get_contents($f); | ||
+ | ++$seed; | ||
+ | unlink($f); | ||
+ | $fp = fopen($f, ' | ||
+ | fwrite($fp, $seed); | ||
+ | fclose($fp); | ||
+ | return $seed; | ||
+ | } | ||
+ | echo '<div align=" | ||
$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=" | + | |
- | $bool[$i]=file_exists($dir); | + | |
- | if ($bool[$i]==true) ++$max; | + | |
} | } | ||
$bg[0]="# | $bg[0]="# | ||
Línia 22: | Línia 34: | ||
$aut[1]="# | $aut[1]="# | ||
$aut[2]="# | $aut[2]="# | ||
- | for ($i=0; $i<$max; ++$i) { | + | for ($i=0; $i<$not; ++$i) { |
- | $r = rand(0, | + | 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 = " | $file = " | ||
$text = file_get_contents($file); | $text = file_get_contents($file); | ||
$dades = explode(" | $dades = explode(" | ||
- | echo '< | + | echo '< |
} | } | ||
- | echo '< | + | echo '< |
</ | </ |