random-block standalone problem

zapzap

Joined: 2002-10-01
Posts: 3
Posted: Tue, 2002-10-01 02:05

i put the file in the gallery dir and
go to my browser with : http://www.mysite.com/gallery/block-random.php

and i see a picture ... good
i refresh the page and i got that :
Warning: rand() expects parameter 2 to be long, string given in /Html/gallery/block-random.php on line 138
ERROR: requested index [] out of bounds [12]
Fatal error: Call to a member function on a non-object in /Html/gallery/classes/Album.php on line 570

what is wrong ?

thx
ZapZap

 
zapzap

Joined: 2002-10-01
Posts: 3
Posted: Tue, 2002-10-01 15:28

found the answer myself :smile:

chnage
the readCache() function

to this code

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
function readCache()
{
global $cache;
if ($fd = fs_fopen(CACHE_FILE, "r"))
{
while ($line = fgets($fd, 4096))
{
list($key, $val) = explode("/", trim($line));
$cache[$key] = $val;
}
fclose($fd);
}
}</TD></TR></TABLE><!-- BBCode End -->

 
josephp

Joined: 2002-10-03
Posts: 172
Posted: Tue, 2002-10-15 05:53

I tried the code you provided, it solved but I keep getting errors:

Fatal error: Cannot redeclare readcache() (previously declared in /home/transit/public_html/photos/block-random.php:109) in /home/transit/public_html/photos/block-random.php on line 122

How I can fix it?