nej nu er det bare i slut:
http://marzman.dk/galleri/test.phpsource:
<?php
include("/customers/marzman.dk/marzman.dk/httpd.www/dbconnect.php");
$dir = "/customers/marzman.dk/marzman.dk/httpd.www/images";
function scan_dir($dir) {
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (filetype($dir . "/" . $file) == 'dir') {
if (!($file == '.' || $file == '..')) {
scan_dir($dir . "/" . $file);
}
} else {
if (mysql_result(mysql_query(sprintf("select count(1) from galleri_pics where navn = '%s'",$dir . "/" . $file)),0) == 0) {
mysql_query(sprintf("INSERT INTO galleri_pics (navn) values ('%s')",$dir . "/" . $file));
}
}
closedir($dh);
}
}
}
scan_dir($dir);
?>