--- docman.php 2000/07/26 11:46:19 1.2 +++ docman.php 2000/08/04 10:07:04 1.6 @@ -96,7 +96,14 @@ $gblPw = ""; if ($gblAuth) { - $htusers=fopen(dirname($SCRIPT_FILENAME)."/.htusers","r"); + $htusers_file=dirname($SCRIPT_FILENAME)."/.htusers"; + if (! file_exists($htusers_file)) { + $htusers=fopen($htusers_file,"a+"); + fputs($htusers,"# Change owner of $htusers_file to root !!\n"); + fputs($htusers,"demo:full name:md5_hash\n"); + fclose($htusers); + } + $htusers=fopen($htusers_file,"r"); while($user = fgetcsv($htusers,255,":")) { if ($user[0] == $GLOBALS["PHP_AUTH_USER"]) { $gblUserName=$user[1]; @@ -124,7 +131,7 @@ // the directory below should be /icons/ or /icons/small/ // on Apache; a set of icons is included in the distribution - $gblIconLocation = "icons/" ; + $gblIconLocation = "/icons/" ; // files you want to be able to edit in text mode // and view with (primitive) syntax highlighting @@ -150,19 +157,19 @@
-= $text ?>
= date($GLOBALS[gblDateFmt]) ?> - = date($GLOBALS[gblTimeFmt]) ?> - = $GLOBALS[gblUserName] ?> - [logout] + [?relogin== $GLOBALS[gblPw] ?>">logout]file size: " . $fsize . " Bytes" ; + $fsize = filesize($fsPath) ; + $fmodified = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", filemtime($fsPath)) ; + $faccessed = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", fileatime($fsPath)) ; + echo "
" ; - echo "last modified: " . $fmodified . "
" ; - echo "last accessed: " . $faccessed . "
" ; - echo " owner: " . fileowner($fsPath) . "
" ; - echo " group: " . filegroup($fsPath) . "
" ; - echo " permissions: " ; - echo printf( "%o", fileperms($fsPath) ) . "" ; - echo "
file size: " . $fsize . " Bytes" ; } - if ( $editable && ($writable || !$exists) ) { + if ( $editable && ($writable || !$exists) && !$file_lock ) { $fh = fopen($fsPath,"a+") ; rewind($fh) ; $fstr = fread($fh,filesize($fsPath)) ; @@ -269,39 +277,50 @@ $fstr = htmlentities( $fstr ) ; ?> - " ; + echo htmlentities($tstr) . "
" ; + echo "last modified: " . $fmodified . "
" ; + echo "last accessed: " . $faccessed . "
" ; + echo " owner: " . fileowner($fsPath) . "
" ; + echo " group: " . filegroup($fsPath) . "
" ; + echo " permissions: " ; + echo printf( "%o", fileperms($fsPath) ) . "" ; + echo "