|
$numberOfImages = 7;
if(isset($_SESSION['imageChange'])) // Has this variable been set?
{
$imageChange1 = rand(1,$numberOfImages); // Select and image at random
while($_SESSION['imageChange'] == $imageChange1) // Whilst the old image is the same as the new image
{
$imageChange1 = rand(1,$numberOfImages); // select a new image at random
}
}
else
{
$imageChange1 = rand(1,$numberOfImages); // Set the image for the first time
}
$_SESSION['imageChange'] = $imageChange1; // Set the session variable to remember the image number
?>
|