I need to assign a variable based on its value.
ie:
$variable = 'value' (if value != "Session"
My brain is not really working atm I know there has to be a simple way to do this.
I am selecting a random file from a directory and do not want to repeat the selection:
eg:
<?php
$path = "/home/folder/";
$narray=array();
$dir_handle = @opendir($path) or die("Unable to open $path please notify the administrator. Thank you.");
$i=0;
while($file = readdir($dir_handle))
{
if($file != '.' && $file != '..' && $file !=' ' && $file !="SESSION['incl1']")
{
$narray[$i]=$file;
$i++;
}
}
//I want to make sure when I assign the value below it is not repeated from another //instance of this script embedded in the php page
$j = rand(0, $i-1);
include ("$path$narray[$j]");
//closing the directory
closedir($dir_handle);
?>