Results 1 to 3 of 3

Thread: Help to pull apart a script please?

  1. #1
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help to pull apart a script please?

    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 Code:
    <?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 Code:
    <?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?>

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    If you just want the name of the file, simply get rid of this part in the first code you posted:

    Code:
     $FileArray[] = $dir."/".$file;
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by thetestingsite View Post
    If you just want the name of the file, simply get rid of this part in the first code you posted:

    Code:
     $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?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •