> How do make admin site that lists htm documents from directory and i can
> define link name to each of these?
> So when user comes, he sees link list to these documents, with names i
> defined.

Something not unlike this might work:
[Untested code]

create table links(
    linkid int(11) auto_increment unique not null,
    title text,
    directory text,
    filename text
);

<?php
    exec("/usr/bin/pwd", $results, $error);
    if ($error){
        die("Error $error executing pwd.  Usually path/permissions.<BR>\n");
    }
    $directory = $results[0];
    $query = "select title, filename from links where directory =
'$directory'";
    $links = mysql_query($query) or die(mysql_error());
    while(list($title, $filename, $url) = mysql_fetch_row($links)){
        $link[$filename] = $title;
    }
    $dir = opendir($directory);
    $urldir = substr($directory,
strlen("/full/path/to/your/web/root/htdocs/"));
    while($filename = readdir($dir)){
        if (isset($link[$filename])){
            echo "<A HREF=$urldir/$filename>$link[$filename]</A><BR>\n";
        }
        else{
            echo "<A HREF=$urldir/$filename>$filename</A><BR>\n";
        }
    }
?>

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to