05. december 1999 - 17:21
Der er
6 kommentarer og 1 løsning
Vise indholdet af Dir.
I forbindelse med en hjemmeside som brugeren selv skal kunne opdatere nemt, vil jeg gerne have at de kunne uploade nogle dokumenter som de har skrevet i word og gemt som .htm dokumenter. Det jeg havde planlagt var at lave en side med to frames, altså et navigations vindue og et hvor linket vises. Dvs. at kunden uploader tre dokumenter dok1.htm, dok2.htm og dok3.thm Det jeg så gerne ville var at de uploadede det i et brugerbibliotek. Eks. upload hvor så titlen på dokumentet vil blive vist som et link i navigationsvinduet, og når de så klikkede på linket kunne de se indholdet i det andet vindue. På den måde ville det ikke være nødvendigt for kunden (Forresten min far) at skulle ind og lave noget programmering af links osv. osv. han skal bare slette og tilføje dokumenter vha. sin FTP.
Annonceindlæg fra Infor
06. december 1999 - 16:14
#1
Spørg holdet bag wiktor.dk De har lavet deres egen hen af det du beder om, de kalder deres DirLister, hvis du spørge pænt, så tror jeg nok du kan få den... Du kan sende til dem på: admin@wiktor.dk Mener jeg.... Kan du ikke bare give mig 10 point for det svar?
06. december 1999 - 23:52
#2
Hmmm. Nu har jeg surfet lidt rundt, og er ikke blevet en skid klogere.... Er det bare mig der er dum, eller kan jeg bare ikke finde det (En anden måde og være dum på)
07. december 1999 - 17:34
#4
jeg tror jeg har fortjent 50 point nu, jeg har fundet dette på px.sklar.com: <?php # filemanager by Lacey Pevey # v0.02 - 1999/12/05 13:46 CST # # You are free to use and distribute this code provided this tiny # header is included. No warranties, fitness for purpose, etc. etc. # # Please send comments/bugfixes/enhancements to # lpevey@mailhost.tcs.tulane.edu. $home = "/home"; //include user's home directory (or whatever you want to give them access to) include( "header.inc"); ?> <script language=javascript> <!-- function submit(form) { form.submit() } //--> </script> <?php if (isset($exit)) { unset($edit); unset($upload); } if (empty($pwd)) $pwd = "/"; if ($action == "upload") exec( "cp $userfile $home$pwd$userfile_name"); $file = $home.$pwd.$fn; function read_file($file) { if (!($fp = fopen($file, 'r' ))) return false; $contents = fread($fp, filesize($file)); fclose($fp); return $contents; } function write_file($file, $contents) { if ($fp = fopen($file, "w")) { fputs($fp, $contents, strlen($contents)); fclose($fp); return 1; } else { return 0; } } //------------------------------------------------------------------------------------------------- if ($copy) { if ($action == "copy") { exec( "cp -R ".$home.$oldname. " ".$home.$newname); } else { ?> <table align=center bgcolor=#999999 border=2 cellspacing=0 cellpadding=3> <tr> <form name=copy method=post action= <?php echo $PHP_SELF; ?>> <td> <input type=hidden name=oldname value=" <?php echo $pwd.$fn; ?>"> <input type=hidden name=action value=copy> <input type=hidden name="pwd" value=" <?php echo $pwd; ?>"> <font face=Verdana><small>Clipboard Contents: <?php echo $pwd.$fn; ?></small></font><br> <input type=submit name="copy" value="Copy as:"> <input type=text size="56" name="newname" value=" <?php echo $pwd.$fn; ?>"><br> <input type=submit name="exit" value="Cancel"></td> </form> </tr> </table><br><br> <?php } } //------------------------------------------------------------------------------------------------- if ($move) { if ($action == "move") { exec( "mv ".$home.$oldname. " ".$home.$newname); } else { ?> <table align=center bgcolor=#999999 border=2 cellspacing=0 cellpadding=3> <tr> <td> <form name=move method=post action= <?php echo $PHP_SELF; ?>> <input type=hidden name="pwd" value=" <?php echo $pwd; ?>"> <font face=Verdana><small>Clipboard Contents: <?php echo $pwd.$fn; ?></small></font><br> <input type=submit name="move" value="Move to:"> <input type=text size="56" name="newname" value=" <?php echo $pwd.$fn; ?>"><br> <input type=hidden name=oldname value=" <?php echo $pwd.$fn; ?>"> <input type=hidden name=action value=move> <input type=submit name="exit" value="Cancel"></td></form> </tr> </table><br><br> <?php } } //------------------------------------------------------------------------------------------------- if ($rename) { if ($action == "rename") { exec( "mv ".$home.$oldname. " ".$home.$newname); } else { ?> <table align=center bgcolor=#999999 border=2 cellspacing=0 cellpadding=3> <tr> <td> <form name=move method=post action= <?php echo $PHP_SELF; ?>> <input type=hidden name="pwd" value=" <?php echo $pwd; ?>"> <font face=Verdana><small>Clipboard Contents: <?php echo $pwd.$fn; ?></small></font><br> <input type=submit name="rename" value="Rename to:"> <input type=text size="56" name="newname" value=" <?php echo $pwd.$fn; ?>"><br> <input type=hidden name=oldname value=" <?php echo $pwd.$fn; ?>"> <input type=hidden name=action value=rename> <input type=submit name="exit" value="Cancel"></td></form> </tr> </table><br><br> <?php } } //------------------------------------------------------------------------------------------------- if ($newfile) { if (isset($fn)) { write_file($file, ""); $edit = 1; } else { echo "You must specify a name for the file you wish to create."; } echo $result; } //------------------------------------------------------------------------------------------------- if ($newdir) { if (isset($newdirname)) { exec( "mkdir ".$home.$pwd.$newdirname); } else { echo "You must specify a name for the directory you wish to create."; } echo $result; } //------------------------------------------------------------------------------------------------- if ($delete) { if ($action == "delete") { exec( "rm -R $file"); } else { ?> <table align=center bgcolor=#999999 border=2 cellspacing=0 cellpadding=3> <tr> <td> <form name=delete method=post action= <?php echo $PHP_SELF; ?>> <font face=Verdana><small>Delete <?php echo $pwd.$fn; ?>?</small></font> <input type=submit name="delete" value="Yes"> <input type=submit name="exit" value="No"> <input type=hidden name="pwd" value=" <?php echo $pwd; ?>"> <input type=hidden name="fn" value=" <?php echo $fn; ?>"> <input type=hidden name=action value=delete></td></form> </tr> </table><br><br> <?php } } //------------------------------------------------------------------------------------------------- if (isset($edit)) { if (!(isset($fn))) echo "No filename was specified."; else { if ($save) { if ((isset($file)) && (isset($contents))) { $contents = stripslashes($contents); write_file($file, $contents); } else { echo "Error saving file to disk"; } } ?> <table bgcolor="#999999" border=2 cellspacing=0 cellpadding=3 align=center> <tr> <td>Current File: <?php echo $fn; ?></td> </tr <tr> <td align=center> <form method="post" action=" <?php echo $PHP_SELF; ?>"> <textarea name="contents" cols=100 rows=25> <?php $contents = read_file($home.$pwd.$fn); echo htmlentities($contents); ?></textarea><br> <input type=submit name="save" value="Save"> <input type=submit name="exit" value="Exit"> <input type=hidden name="pwd" value=" <?php echo $pwd; ?>"> <input type=hidden name="fn" value=" <?php echo $fn; ?>"> <input type=hidden name="edit" value="Edit"></td></form> </tr> </table></form><br> <?php } } //------------------------------------------------------------------------------------------------- exec( "ls -l ".$home.$pwd, $result, $id); $up_pwd = eregi_replace( "/$", "", $pwd); $up_pwd = eregi_replace( "[_a-z0-9\.-]+$", "", $up_pwd); echo " <table align=center bgcolor=#999999 border=2 cellspacing=0 cellpadding=3> <tr> <td>Current Directory: ".$pwd. "</td> </tr> <tr> <td> <table> <tr> <td colspan=2><font face=Verdana><small>Folders:</small></font><td> </tr> <tr> <td><form name=up action=$PHP_SELF method=post><input type=hidden name=pwd value=$up_pwd><a href=\"java script:submit(document.forms['up']);\"><img src=/img/up.gif border=0 alt=up></a> </form></td> <td><form method=post action=$PHP_SELF name=folders> <select name=pwd>"; $i = 1; while (isset($result[$i])) { $result[$i] = eregi_replace( " +", ",", $result[$i]); $line = explode( ",", $result[$i]); if (ereg( "^d", $line[0])) { echo "<option value=\"".$pwd.$line[8]. "/\">".$line[8]. "\n"; } $i++; } ?> </select> <input type=submit value="Open"> <input type=submit name="move" value="Move"> <input type=submit name="copy" value="Copy"> <input type=submit name="delete" value="Delete"> <input type=submit name="rename" value="Rename"> </form></td> </tr> </table></td> </tr> <tr> <td> <form method=post action=" <?php echo $PHP_SELF; ?>" name="files"> <font face=Verdana><small>Files:</small></font><br> <select name=fn> <?php $i = 1; while (isset($result[$i])) { $result[$i] = eregi_replace( " +", ",", $result[$i]); $line = explode( ",", $result[$i]); if (!(ereg( "^d", $line[0]))) { echo "<option value=\"".$line[8]. "\">".$line[8]. "\n"; } $i++; } ?> </select> <input type=hidden name="pwd" value=" <?php echo $pwd; ?>"> <input type=submit name="edit" value="Edit"> <input type=submit name="move" value="Move"> <input type=submit name="copy" value="Copy"> <input type=submit name="delete" value="Delete"> <input type=submit name="rename" value="Rename"> </form></td> </tr> <tr> <td> <table width=100%> <tr> <td width=50% nowrap> <form method=post action=" <?php echo $PHP_SELF; ?>" name="newfile"> <input type=hidden name="pwd" value=" <?php echo $pwd; ?>"> <font face=Verdana><small>New File:</small></font><br> <input type=text name=fn size=20 maxlength=100> <input type=submit name=newfile value="Create"> </form></td> <td width=50% nowrap> <form method=post action=" <?php echo $PHP_SELF; ?>" name="newfolder"> <input type=hidden name="pwd" value=" <?php echo $pwd; ?>"> <font face=Verdana><small>New Folder:</small></font><br> <input type=text name=newdirname size=20 maxlength=100> <input type=submit name=newdir value="Create"> </form></td> </tr> </table></td> </tr> <tr> <td> <form method=post enctype="multipart/form-data" action= <?php echo $PHP_SELF; ?>> <font face=Verdana><small>File Upload:</small></font><br> <input type=hidden name="pwd" value= <?php echo $pwd; ?>> <input type=hidden name="action" value=upload> <input type=file name=userfile size=40> <input name=upload value=" Upload " type=submit> </form></td> </tr> </table> <br> <br> <?php include( "footer.inc"); ?>
07. december 1999 - 17:37
#5
Jamen du har da fortjent dem. Men det link du skrev hvor du havde hentet den, kunne jeg ikke få til og virke. Men alle pointene er dine :-) Takker mange gange.