hamveeas
Новичок
помощь в настройке скрипта ImgRandom 1.0
нужна небольшая помощь.дело в том что я уже целый день бьюсь над этим скриптом я перечитал все что только можно и теперь в голаве получилась такая каша поэтому и решил обратится за по мощью сам скрипт состоит из одного файла вот код
а это readme
Please open imgrandom.php3 and change the 2 variables needed.
Then you can point your html img src tag to the script like this
<IMG SRC="http://www.yourdomain.com/whatever/imgrandom.php3">
я прописал все
но у меня он выдает вот такую ошибку
Warning: readdir(): supplied argument is not a valid Directory resource in /home/hamveeas/public_html/whatever/imgrandom.php3 on line 20
Warning: Cannot modify header information - headers already sent by (output started at /home/hamveeas/public_html/whatever/imgrandom.php3:20) in /home/hamveeas/public_html/whatever/imgrandom.php3 on line 58
Версия PHP 5.2.6
register_globals on
Версия Apache 1.3.41 (Unix)
прошу мне объяснить что я делаю не так
заранее спасибо
нужна небольшая помощь.дело в том что я уже целый день бьюсь над этим скриптом я перечитал все что только можно и теперь в голаве получилась такая каша поэтому и решил обратится за по мощью сам скрипт состоит из одного файла вот код
PHP:
<?php #This script has been developped by Francesco D'Alesio [[email protected]] #Please feel free to contact me for any reason #All you have to do is to change this two variables. Remember to use the absolute path for the first variable, starting with a slash $absolute = "/home/httpdocs/images/imgrandom"; $url = "http://www.yourdomain.com/images/imgrandom"; #You my now add in the img html tag the url of this script #<IMG SRC="http://yourdomain.com/whatever/imgrandom.php3"> # DO NOT CHANGE ANYTHING BELOW THIS LINE $randir = dir("$absolute"); $num = 0; while($read = readdir($randir)) { $tmp = split("\.", $read, 2); if ($tmp[1] == "jpg" || $tmp[1] == "JPG") { $imgsrc[] = $read; $num++; } if ($tmp[1] == "gif" || $tmp[1] == "GIF") { $imgsrc[] = $read; $num++; } } srand((double)microtime()*1000000); $imgrandom = rand(0,($num-1)); header("location: $url/$imgsrc[$imgrandom]"); ?>
Please open imgrandom.php3 and change the 2 variables needed.
Then you can point your html img src tag to the script like this
<IMG SRC="http://www.yourdomain.com/whatever/imgrandom.php3">
я прописал все
PHP:
<?php #This script has been developped by Francesco D'Alesio [[email protected]] #Please feel free to contact me for any reason #All you have to do is to change this two variables. Remember to use the absolute path for the first variable, starting with a slash $absolute = "/home/hamveeas/public_html/images/imgrandom"; $url = "http://news-inet.ru/whatever/imgrandom.php3"; #You my now add in the img html tag the url of this script #<IMG SRC="http://yourdomain.com/whatever/imgrandom.php3"> # DO NOT CHANGE ANYTHING BELOW THIS LINE $randir = dir("$absolute"); $num = 0; while($read = readdir($randir)) { $tmp = split("\.", $read, 2); if ($tmp[1] == "jpg" || $tmp[1] == "JPG") { $imgsrc[] = $read; $num++; } if ($tmp[1] == "gif" || $tmp[1] == "GIF") { $imgsrc[] = $read; $num++; } } srand((double)microtime()*1000000); $imgrandom = rand(0,($num-1)); header("location: $url/$imgsrc[$imgrandom]"); ?>
Warning: readdir(): supplied argument is not a valid Directory resource in /home/hamveeas/public_html/whatever/imgrandom.php3 on line 20
Warning: Cannot modify header information - headers already sent by (output started at /home/hamveeas/public_html/whatever/imgrandom.php3:20) in /home/hamveeas/public_html/whatever/imgrandom.php3 on line 58
Версия PHP 5.2.6
register_globals on
Версия Apache 1.3.41 (Unix)
прошу мне объяснить что я делаю не так
заранее спасибо