Log in

View Full Version : Help to pull apart a script please?



munkynpunky
08-05-2007, 03:48 PM
Hey,

Someone made me a script but i cannot work out how to pull out the variables.

i need to just be able to get the image name... however i get the folder locations too

this is the script


<?php
$dir = $_GET['login'];
$NBFile=0;
$dir ="../clients/$dir";
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
//if (substr($file, strlen($file)-3, 3)=="jpg" ) {
$FileArray[] = $dir."/".$file;
$NBFile=$NBFile+1;
//}

}
}
}
closedir($handle);
?>




<?php
$NBPicswidth=1;
$NBPics=0;
for ($i=0; $i<$NBFile; $i++) {
$Pic_Name1=$FileArray[$i];
?><td>
<a href="showimage.php?image=<?php echo $Pic_Name1; ?>" target="order"><img src="<?php echo $Pic_Name1; ?>" width="105" border="1" align="middle"></a>
<hr width="90%" /></td><?php
$NBPics=$NBPics+1;

if ( $NBPics==$NBPicswidth ) { $NBPics=0; ?>

thetestingsite
08-05-2007, 03:54 PM
If you just want the name of the file, simply get rid of this part in the first code you posted:



$FileArray[] = $dir."/".$file;


Hope this helps.

munkynpunky
08-05-2007, 04:54 PM
If you just want the name of the file, simply get rid of this part in the first code you posted:



$FileArray[] = $dir."/".$file;


Hope this helps.

Hi,

thanks for you responce :)

I'm trying to do two things with this script, this is a gallery script, and so i need the original code to function but then I also need get just the image name out of this as a new variable, but it needs to be for each image, as this script reads how many images are in the folder, then displays them, i want to be able to click on them and that image display in an IFRAME, but it doesnt seem to work just passing the variables, is there anyway to pass variables between two iframes?