What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Help me please with script

Help me please with script
Author: Message:
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
O.P. Help me please with script
Dempsey gave me this script to show how many soundpacks are in my soundpacks folder (on the site):


function count_files( $dir )
{
     $retval = 0;
     if( $dir && is_dir( $dir ) )
     {
          if( ($d = opendir( $dir )) !== false )
          {
               while( ($f = readdir( $d )) !== false )
               {
                    if( is_file( $dir . "/" . $f ) ) ++$retval;
               }
               closedir( $d );
          }
     }
     return $retval;
}

print count_files( "/soundpacks" );



I firstly dont get how to use php :$ and how to add it to my homepage. :(

Please, please help me :P
04-26-2005 06:04 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Help me please with script
open notepad and paste this code into a new file
code:
<?
function count_files( $dir )
{
     $retval = 0;
     if( $dir && is_dir( $dir ) )
     {
          if( ($d = opendir( $dir )) !== false )
          {
               while( ($f = readdir( $d )) !== false )
               {
                    if( is_file( $dir . "/" . $f ) ) ++$retval;
               }
               closedir( $d );
          }
     }
     return $retval;
}

print count_files( "/soundpacks" );
?>


save it as soundpacks.php or whatever and upload
04-26-2005 06:12 PM
Profile PM Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
O.P. RE: Help me please with script
Thanks how would i insert the script to work in a page so it says hosting 62 soundpacks or whatever :P
04-26-2005 08:46 PM
Profile PM Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: Help me please with script
You need your pages to be .php ones.. and in the place you want it to appear you put..
code:
<?php
function count_files( $dir )
{
     $retval = 0;
     if( $dir && is_dir( $dir ) )
     {
          if( ($d = opendir( $dir )) !== false )
          {
               while( ($f = readdir( $d )) !== false )
               {
                    if( is_file( $dir . "/" . $f ) ) ++$retval;
               }
               closedir( $d );
          }
     }
     return $retval;
}

echo "We have ".count_files( "/soundpacks" )." sound packs..";
?>

or whatever..
The previous sentence is false. The following sentence is true.
04-26-2005 09:05 PM
Profile PM Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
O.P. RE: Help me please with script
Thanks alot it really works :D
04-26-2005 09:31 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On