Hi, i am working on a website and it is basically will revolve around pictures. So far i am still working on the site and at the moment i have about 400 pictures and counting i wish to put them all up in different parts of the site. Ok so i search online and here and found that many people use javascript codes like this
myimages[1]="image1.png"
myimages[2]="image2.png"
myimages[3]="image3.png"
and so on

But since i have many pictures i am not sure if doing it this way will make my home page very crowded so i decided to look for javascript that display random images everytime the page is refreshed. I found some now i found one and it works great the problem is that when i try and display three images using t he command <img src="http://mysite.com/RandIm/randim.php"/> all three display the same and i want the three to not repeat the same image. For example. lets say i put image 1, 2 , 3, 4 , and 5 and put the code three times when i preview my page this is how it looks.

1 1 1 * refresh* 3 3 3 instead of being for example 1 5 3 *refresh* 2 1 4.

I looked at the read me text cant figured it out i worked on it for a 2 weeks am a bit frustrated. If anyone can help me with this i would really appreciate it or if anyone can suggest anything that would be easy for me that would be even better. Here is the code i have at the moment.

PHP Code:
<?php
/*******************************************************************************
*  Title: Random image script (RandIm)
*  Version: 1.0 @ January 3, 2009
*  Author: Klemen Stirn
*  Website: http://www.phpjunkyard.com
********************************************************************************
*  COPYRIGHT NOTICE
*  Copyright 2009 Klemen Stirn. All Rights Reserved.
*
*  This script may be used and modified free of charge by anyone
*  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
*  By using this code you agree to indemnify Klemen Stirn from any
*  liability that might arise from it's use.
*
*  If you are using this script you are required to place a link
*  to PHPJunkyard on your website. You will find some link suggestions here:
*  http://www.phpjunkyard.com/link2us.php
*
*  Selling the code for this program, in part or full, without prior
*  written consent is expressly forbidden.
*
*  Obtain permission before redistributing this software over the Internet
*  or in any other medium. In all cases copyright and header must remain
*  intact. This Copyright is in full effect in any country that has
*  International Trade Agreements with the United States of America or
*  with the European Union.
*******************************************************************************/

/*******************************************************************************
*  SETTINGS
*
*  See readme.htm file for further instructions!
*******************************************************************************/

/* The default folder with images */
$settings['img_folder'] = 'images/';

/* File types (extensions) to display */
$settings['img_ext'] = array('.jpg','.gif','.png');

/*
   How to display the images?
   0 = print just the image path (for includes), like: images/test.jpg
   1 = redirect to the image, when using: <img src="randim.php" />
*/
$settings['display_type'] = 1;

/* Allow on-the-fly settings override? 0 = NO, 1 = YES */
$settings['allow_otf'] = 1;

/*******************************************************************************
*  DO NOT EDIT BELOW...
*
*  ...or at least make a backup before you do!
*******************************************************************************/

/* Override type? */
if ($settings['allow_otf'] && isset($_GET['type']))
{
    
$type intval($_GET['type']);
}
else
{
    
$type $settings['display_type'];
}

/* Override images folder? */
if ($settings['allow_otf'] && isset($_GET['folder']))
{
    
$folder htmlspecialchars(trim($_GET['folder']));
    if (!
is_dir($folder))
    {
        
$folder $settings['img_folder'];
    }
}
else
{
    
$folder $settings['img_folder'];
}

/* Make sure images fodler ends with an '/' */
if (substr($folder,-1) != '/')
{
    
$folder.='/';
}

/* Get a list of all the image files */
$flist = array();
foreach(
$settings['img_ext'] as $ext)
{
    
$tmp glob($folder.'*'.$ext);
    if (
is_array($tmp))
    {
        
$flist array_merge($flist,$tmp);
    }
}

/* If we have any images choose a random one, otherwise select the "noimg.gif" image */
if (count($flist))
{
    
$src $flist[array_rand($flist)];
}
else
{
    
$src 'noimg.gif';
}

/* Output the image according to the selected type */
if ($type)
{
    
header('Location:'.$src);
    exit();
}
else
{
    echo 
$src;
}
?>
this is the code i use to call the image

PHP Code:
<img src="http://cometprint.com/RandIm/randim.php"/> 
thank you in advance.