Code: Select all
<?php
function updateFiles()
{
mysql_connect("localhost", "root", "pw") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
mysql_query("INSERT INTO files (filename, type) VALUES('test1', 'avi')") or die(mysql_error());
}
function viewFiles()
{
mysql_connect("localhost", "root", "pw") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$path = "/var/www/files";
$dh = opendir($path);
while ($file = readdir($dh))
{
if($file!="." && $file!="..")
echo "<a href='files/$file'>$file</a><br/>";
}
closedir($dh);
}
?>