PHP script for file listings

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
jeffjohn
-


Joined: 02 May 2008
Posts: 38
Location: France 44290 or New Forest,UK

PostPosted: Tue Nov 25, 2008 11:25 am    Post subject: PHP script for file listings Reply with quote

I have the PHP5 package installed and working without problem; so far with a simple date/time and 'Silentum' calendar. Has anyone had experience of showing a list of their MP3 and jpeg files that can be streamed for visitors?
Back to top View user's profile Send private message
rrinc
-


Joined: 24 Feb 2006
Posts: 725
Location: Arkansas, USA

PostPosted: Wed Nov 26, 2008 8:28 am    Post subject: Reply with quote

A file listing is pretty simple. Here's one I made a long time ago. In a table it displays folders, then files.
Code:
<table border=0>
<tr><td><u><b>File</b></u></td><td><u><b>Type</b></u></td></tr>
<?php
$dir_handle = @opendir('./') or die('Cannot read folder.<br />');
while (($file = readdir($dir_handle)) != false)
{
   if($file!='.' && $file!='..' && $file!='index.php') // exclude anything here
   {
      if (is_file($file))
      {
         $FILES[] = $file;   
      }
      else
      {
         $FOLDERS[] = $file;
      }
   }
}
closedir($dir_handle);

foreach($FOLDERS as $f)
{
   echo '<tr><td><a href="'.$f.'">'.$f.'</a></td><td>Folder</td></tr>';
}

foreach($FILES as $f)
{
   echo '<tr><td><a href="'.$f.'">'.$f.'</a></td><td>File</td></tr>';
}
?>
</table>

_________________
-Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados.
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
jeffjohn
-


Joined: 02 May 2008
Posts: 38
Location: France 44290 or New Forest,UK

PostPosted: Wed Nov 26, 2008 9:27 am    Post subject: Reply with quote

very many thanks, rrink, looks just right for me; I'll give it a try later today! jeffjohn
Back to top View user's profile Send private message
jeffjohn
-


Joined: 02 May 2008
Posts: 38
Location: France 44290 or New Forest,UK

PostPosted: Wed Nov 26, 2008 4:37 pm    Post subject: mysql login/password Reply with quote

I found a music streamer called "kplaylist" http://www.kplaylist.net that looks to be 'just the job', but quickly came unstuck!

It says: Could not login to set up the database with the supplied default user name and password!

MySQL response: Can't connect to MySQL server on '1.0.0.1' (10060)

[tried 1.0.0.1 because I got the same msg. with 'localhost'].

I used the default user/pswd from the script, kplaylist/kplaylist.

Anyone know what is going on???
Back to top View user's profile Send private message
jeffjohn
-


Joined: 02 May 2008
Posts: 38
Location: France 44290 or New Forest,UK

PostPosted: Wed Nov 26, 2008 4:45 pm    Post subject: Reply with quote

in other words...I think...what is the user name and password to use Mysql... is it the consol access user/pwd ?
Back to top View user's profile Send private message
jeffjohn
-


Joined: 02 May 2008
Posts: 38
Location: France 44290 or New Forest,UK

PostPosted: Wed Nov 26, 2008 4:54 pm    Post subject: Reply with quote

Ah....got it (!) I have to install MySQL first ! (?)
Back to top View user's profile Send private message
jeffjohn
-


Joined: 02 May 2008
Posts: 38
Location: France 44290 or New Forest,UK

PostPosted: Wed Nov 26, 2008 9:29 pm    Post subject: Reply with quote

Sorry - must have been a hard day - above 'problems' as I had not remembered I had lost my Mysql application! reinstalled and up and running! Apologies! jeffjohn
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group