Help Me Create My First Php Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help Me Create My First Php Script

    i want to create a simple picture gallery with wapbuddy script but the problem is that it echos all the other html n php files within that directory all i want it to do is echo only the links of image files.....to be more specific files with .gif,.jpg.jpeg.png and.wbmp extension

    it ill be my first php script if you help me out so please help me!!!!!

    here is the wapbuddy script

    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>wallapapers section</title><body>
    <?php
    include("../wapbuddy_settings.php");
    if (!isset($_GET[&#39;page&#39;])) $page =$_GET[&#39;page&#39;];
    $total = 0;
    
    if(!($dp = opendir("./"))) die ("Cannot open ./");
    $file_array = array(); 
    while ($file = readdir ($dp))
    {
    if(substr($file,0,1) != &#39;.&#39; 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=&#39;[url]http://c.wen.ru/256908.wbmp?Nahsorhsed&#39;[/url] alt=&#39;Создай сайт! Create site!&#39;/>
    
    <big>NAHSORHSEDA</big>
    
    [url="upload.html"]upoad your pics[/url]
    
    <?php include("../menu.php"); ?>
    
    
    <?
    
    echo "[size="1"]";
    
    echo "[b][u]These downloads Are So Cool![/u][/b]
    ";
    
    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)
    ------
    ";
    $total = $total + filesize($file_name);
    }
    }
    
    if (($file_count > 0) AND ($page != 0))
    {
    // previous button
    $prev_page = $page -1;
    echo "
    <a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev Page</a>
    ";
    }
    
    
    if (($file_count > 0) AND ($last_record < $file_count))
    {
    // next button
    $next_page = $page + 1;
    echo "
    <a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">Next Page</a>
    ";
    }
    echo "
    Total Files:
    $file_count ";
    if ($file_count == 1)
    {echo "file";}
    else
    {echo "files";}
    
    echo " (" . round($total/1024,1) . "kb)";
    }
    closedir($dp);
    echo "[/size]";
    ?>
    
    
    <?
    echo &#39;<form action="process.php" method="post">&#39;
              .&#39;search file: <input name="q" title="search:" size="5" maxlength="99999999999"/>
    &#39;
              .&#39;<input type="submit" value="go"/></form>&#39; ?>
    
    
    [size="1"]page:<? echo"$page"; ?>[/size]
    
    <?
    echo &#39;<form action="&#39;.$_SERVER["PHP_SELF"].&#39;" method="get">&#39;
              .&#39;Jump to Page: <input name="page" title="Jump to Page:" size="3" maxlength="3"/>
    &#39;
              .&#39;<input type="submit" value="Jump"/></form>&#39; ?>
    
    [size="1"][url="http://nahsorhseda.wen9.com/Rock2.html"]home[/url][/size]
    </p>
    </body>
    </html>

    #2
    why doesnt any one help me out

    Comment


      #3
      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>wallapapers section</title><body>
      <?php
      include("../wapbuddy_settings.php");
      if (!isset($_GET[&#39;page&#39;])) $page =$_GET[&#39;page&#39;];
      $total = 0;
      
      if(!($dp = opendir("images/"))) die ("Cannot open ./");
      $file_array = array(); 
      while ($file = readdir ($dp))
      {
      if(substr($file,0,1) != &#39;.&#39; 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=&#39;[url]http://c.wen.ru/256908.wbmp?Nahsorhsed&#39;[/url] alt=&#39;Создай сайт! Create site!&#39;/>
      
      <big>NAHSORHSEDA</big>
      
      [url="upload.html"]upoad your pics[/url]
      
      <?php include("../menu.php"); ?>
      
      
      <?
      
      echo "[size="1"]";
      
      echo "[b][u]These downloads Are So Cool![/u][/b]
      ";
      
      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)
      ------
      ";
      $total = $total + filesize($file_name);
      }
      }
      
      if (($file_count > 0) AND ($page != 0))
      {
      // previous button
      $prev_page = $page -1;
      echo "
      <a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev Page</a>
      ";
      }
      
      
      if (($file_count > 0) AND ($last_record < $file_count))
      {
      // next button
      $next_page = $page + 1;
      echo "
      <a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">Next Page</a>
      ";
      }
      echo "
      Total Files:
      $file_count ";
      if ($file_count == 1)
      {echo "file";}
      else
      {echo "files";}
      
      echo " (" . round($total/1024,1) . "kb)";
      }
      closedir($dp);
      echo "[/size]";
      ?>
      
      
      <?
      echo &#39;<form action="process.php" method="post">&#39;
                .&#39;search file: <input name="q" title="search:" size="5" maxlength="99999999999"/>
      &#39;
                .&#39;<input type="submit" value="go"/></form>&#39; ?>
      
      
      [size="1"]page:<? echo"$page"; ?>[/size]
      
      <?
      echo &#39;<form action="&#39;.$_SERVER["PHP_SELF"].&#39;" method="get">&#39;
                .&#39;Jump to Page: <input name="page" title="Jump to Page:" size="3" maxlength="3"/>
      &#39;
                .&#39;<input type="submit" value="Jump"/></form>&#39; ?>
      
      [size="1"][url="http://nahsorhseda.wen9.com/Rock2.html"]home[/url][/size]
      </p>
      </body>
      </html>
      make images folder upload there lol
      Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
      Visit: WapMasterz Coming Back Soon!
      _______
      SCRIPTS FOR SALE BY SUBZERO
      Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
      FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
      _______
      Info & Tips
      php.net
      w3schools.com

      Comment


        #4
        i knew i could make a new folder but ill be adding many sripts like delete and upload in the same folder and other login essentials
        the problem of making another folder is when the link is echoed for example i have a file "cccccccar ttt.jpg" when it is in the sme folder it gives me the correct download link but if i make a subdirectory
        itill echo the link something like src="cccccccc" and the rest is removed even the extention

        do you have a way in which i can i exclude all php files in the directory and echo all other files


        and tell me something about the code below
        Code:
        if(substr($file,0,1) != &#39;.&#39; and $file != "index.php" and $file != "search.php")

        Comment


          #5
          you wont a format script??
          Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
          Visit: WapMasterz Coming Back Soon!
          _______
          SCRIPTS FOR SALE BY SUBZERO
          Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
          FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
          _______
          Info & Tips
          php.net
          w3schools.com

          Comment


            #6
            you wont a format script??[/b]
            i really dont know what you mean by that i think your try to say delete script ....i got thaat
            please tell me how to exclude all php files from echoing in the wapbuddy script

            Comment

            Working...
            X