<?php //-->-->-->-->-->-->-->-->-->-->-->-->-->--> $bNewFile = false; $sFilePath = ''; $sFileContents = ''; $aaTextLines = ''; $sFilePath = $_GET['file']; $sFilePath = "/usr50/home/retrovox".$sFilePath; $sFilePathEncoded = htmlspecialchars($sFilePath); $sWebFilePathEncoded = htmlspecialchars(str_replace("public_html", "", $sFilePath)); $iEditorColumns = $_GET['cols']; $iEditorRows = $_GET['rows']; if ($iEditorColumns == '') { $iEditorColumns = 80; } if ($iEditorRows = '') { $iEditorRows = 80; } if ($sFilePath == '/usr50/home/retrovox') { echo " <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'> <html> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'> <META HTTP-EQUIV='Keywords' CONTENT='Retrovox, edit, file, unspecified'> <META HTTP-EQUIV='Description' CONTENT='Retrovox notepad, file-name unspecified'> <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'> <head><title>Retrovox Notepad, (No file name specified)</title> </head> <body> <center><h1>No file name specified</h1></center> <p>You did not specify any file to be edited</p> <br> <a href = 'retrovox-notepad-choose-file.html'>Try Again</a> </body> </html>"; //-- is this possible return; } //-- if no file specified if (is_dir($sFilePath)) { echo " <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'> <html> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'> <META HTTP-EQUIV='Keywords' CONTENT='Retrovox, edit, file, directory'> <META HTTP-EQUIV='Description' CONTENT='Retrovox notepad, the path is a directory'> <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'> <head><title>Retrovox Notepad, (The path is a directory)</title> </head> <body> <center><h1>The path is a directory</h1></center> <p> The file-name [$sFilePathEncoded] which you just specified is a directory (folder). The Retrovox Notepad system is for editing text files located on the server. </p> <br> <ol> <li><a href = 'retrovox-notepad-choose-file.html'>Re-enter the file name</a></li> <li><a href = \"$sWebFilePathEncoded\"> View the contents of the directory (folder)</a> [If it is accessible from the web]</li> </ol> </body> </html>"; return; } //-- if file is a directory if (file_exists($sFilePath)) { echo " <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'> <html> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'> <META HTTP-EQUIV='Keywords' CONTENT='Retrovox, edit, file'> <META HTTP-EQUIV='Description' CONTENT='Retrovox notepad, the file already exists'> <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'> <head><title>Retrovox Notepad, (The file already exists)</title> </head> <body> <center><h1>The path is a directory</h1></center> <p> The file-name [$sFilePathEncoded] already exists. </p> <br> <ol> <li><a href = 'retrovox-notepad-choose-file.html'>Re-enter the file name</a></li> <li><a href = \"retrovox-notepad.php?file=$sFilePathEncoded\"> Edit the existing file</a></li> </ol> </body> </html>"; return; } //-- if file exists if (!is_writable($sFilePath)) { echo " <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'> <html> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'> <META HTTP-EQUIV='Keywords' CONTENT='Retrovox, edit, file, unwritable'> <META HTTP-EQUIV='Description' CONTENT='Retrovox notepad, file unwritable'> <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'> <head><title>Retrovox Notepad, (File is not writable)</title> </head> <body> <center><h1>The file path is not writable</h1></center> <p> The file-path [$sFilePathEncoded] which you just specified has its permissions set so that is cannot be edited (updated or modified in any way). You can overcome this problem by typing <pre> chmod a+w $sFilePath </pre> when you are logged into the retrovox server. This could also indicate that you have entered a directory path incorrectly. </p> <br> <ol> <li><a href = 'retrovox-notepad-choose-file.html'>Re-enter the file name</a></li> </ol> </body> </html>"; return; } //-- if file is not writeable $bNewFile = true; //--<--<--<--<--<--<--<--<--<--<--<--<--<--< ?> <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'> <html> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'> <META HTTP-EQUIV='Keywords' CONTENT='Retrovox, edit, file'> <META HTTP-EQUIV='Description' CONTENT='Retrovox notepad'> <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'> <head><title>Retrovox Notepad</title> </head> <body> <center><h1>The Retrovox Notepad</h1></center> <p></p> <form action = 'retrovox-notepad-save.php' method = 'post'> <br> <em>Editing file: <?= htmlspecialchars($sFilePath) ?></em> <br> <textarea name = 'fileContents' cols = '<?=$iEditorColumns?>' rows = '<?=$iEditorRows?>'> </textarea> <br> <input type = 'submit' value = 's a v e f i l e'> <input type = 'hidden' name = 'saveFilePath' value = '<?=htmlspecialchars($sFilePath)?>'> </form> <br> </body> </html>