+ Reply to Thread
Results 1 to 2 of 2

Thread: a little help with php directory function

  1. #1
    nahsorhseda's Avatar
    nahsorhseda is offline x10 Sophmore nahsorhseda is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    mumbai
    Posts
    116

    a little help with php directory function

    i have a script which lists all files in the directory
    but i want it to list only the image files to be more specific ......list only files ending with jpeg,jpg,png,gif

    OR

    i want the script to list all other files except the php files ill pay you 50 c -100c if you help me out

    below is the script(its a modifeid wapbuddy script)



    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <?
     extract
    ($_REQUEST);
    ?>
    <? 
    include("../css.php"); ?>




    <title>my personal pics</title><body>
    <?php
    include("../wapbuddy_settings.php");
    if (!isset(
    $_GET['page'])) $page =$_GET['page'];
    $total 0;

    if(!(
    $dp opendir("./"))) die ("Cannot open ./");
    $file_array = array(); 
    while (
    $file readdir ($dp))
    {
    if(
    substr($file,0,1) != '.' and $file != "index.php" and $file != "search.php")
    {
    $file_array[] = $file;
    }
    }
    $file_count count ($file_array);
    sort ($file_array);
    ?>
    </head>
    <body bgcolor="#000000" text="#00FF00" link="#FFFFFF" vlink="#FF0000" alink="#FFFFFF">

    <img src='http://c.wen.ru/256908.wbmp?Nahsorhsed' alt='Создай сайт! Create site!'/><br/>
    <big>NAHSORHSEDA</big><br/>

    <?php include("../menu.php"); ?><br/>

    <?

    echo "<small>";

    echo 
    "<b><u>my school days</u></b><br/>";

    if (
    $file_count 0)
    {
    $first_record $page $conf["items_per_page"];
    $last_record $first_record $conf["items_per_page"];

    while (list(
    $fileIndexValue$file_name) = each ($file_array))
    {

    if ((
    $fileIndexValue >= $first_record) AND ($fileIndexValue $last_record))
    {

    echo 
    "<a href=\"$file_name\">$file_name</a> ("round(filesize($file_name)/1024,1) . "kb)<br/>------<br/>";
    $total $total filesize($file_name);
    }
    }

    if ((
    $file_count 0) AND ($page != 0))
    {
    // previous button
    $prev_page $page -1;
    echo 
    "<br/><a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev Page</a><br/>";
    }


    if ((
    $file_count 0) AND ($last_record $file_count))
    {
    // next button
    $next_page $page 1;
    echo 
    "<br/><a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">Next Page</a><br/>";
    }
    echo 
    "<br/>Total Files:<br/>$file_count ";
    if (
    $file_count == 1)
    {echo 
    "file";}
    else
    {echo 
    "files";}

    echo 
    " (" round($total/1024,1) . "kb)";
    }
    closedir($dp);
    echo 
    "</small>";
    ?>
    <br/>
    <?
    echo '<form action="process.php" method="post">'
              
    .'search file: <input name="q" title="search:" size="5" maxlength="99999999999"/><br/>'
              
    .'<input type="submit" value="go"/></form>' ?>


    <small>page:<? echo"$page"?></small><br/>
    <?
    echo '<form action="'.$_SERVER["PHP_SELF"].'" method="get">'
              
    .'Jump to Page: <input name="page" title="Jump to Page:" size="3" maxlength="3"/><br/>'
              
    .'<input type="submit" value="Jump"/></form>' ?>

    <small><a href="http://nahsorhseda.wen9.com/Rock2.html">home</a></small>
    </p>
    </body>
    </html>


    thnks in advance
    glad to resolve problems in c++ n php

  2. #2
    nahsorhseda's Avatar
    nahsorhseda is offline x10 Sophmore nahsorhseda is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    mumbai
    Posts
    116

    Re: a little help with php directory function

    i got it .....thanks for not helping me out
    glad to resolve problems in c++ n php

+ Reply to Thread

Similar Threads

  1. [PHP] PHP For Starters
    By Complex in forum Tutorials
    Replies: 24
    Last Post: 06-14-2008, 11:40 PM
  2. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 09:16 PM
  3. Sigo con problemas con phpbb2
    By reciecho in forum Soporte
    Replies: 7
    Last Post: 10-20-2007, 06:28 PM
  4. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers