View previous topic :: View next topic |
Author |
Message |
jeffjohn -
Joined: 02 May 2008 Posts: 38 Location: France 44290 or New Forest,UK
|
Posted: Tue Nov 25, 2008 11:25 am Post subject: PHP script for file listings |
|
|
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 |
|
|
rrinc -
Joined: 24 Feb 2006 Posts: 725 Location: Arkansas, USA
|
Posted: Wed Nov 26, 2008 8:28 am Post subject: |
|
|
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 |
|
|
jeffjohn -
Joined: 02 May 2008 Posts: 38 Location: France 44290 or New Forest,UK
|
Posted: Wed Nov 26, 2008 9:27 am Post subject: |
|
|
very many thanks, rrink, looks just right for me; I'll give it a try later today! jeffjohn |
|
Back to top |
|
|
jeffjohn -
Joined: 02 May 2008 Posts: 38 Location: France 44290 or New Forest,UK
|
Posted: Wed Nov 26, 2008 4:37 pm Post subject: mysql login/password |
|
|
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 |
|
|
jeffjohn -
Joined: 02 May 2008 Posts: 38 Location: France 44290 or New Forest,UK
|
Posted: Wed Nov 26, 2008 4:45 pm Post subject: |
|
|
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 |
|
|
jeffjohn -
Joined: 02 May 2008 Posts: 38 Location: France 44290 or New Forest,UK
|
Posted: Wed Nov 26, 2008 4:54 pm Post subject: |
|
|
Ah....got it (!) I have to install MySQL first ! (?) |
|
Back to top |
|
|
jeffjohn -
Joined: 02 May 2008 Posts: 38 Location: France 44290 or New Forest,UK
|
Posted: Wed Nov 26, 2008 9:29 pm Post subject: |
|
|
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 |
|
|
|