<?php //-->-->-->-->-->-->-->-->-->-->-->-->-->--> $sFilePath = ''; $sFilePath = $_GET['old-name']; $sFilePathEncoded = htmlspecialchars($sFilePath); $sNewFilePath = $_GET['new-name']; $sNewFilePathEncoded = htmlspecialchars($sNewFilePath); if (substr($sFilePath, 0, 1) != "/") { $sFilePath = "/$sFilePath"; } if (!strstr($sFilePath, "/usr50/home/retrovox")) { $sFilePath = "/usr50/home/retrovox".$sFilePath; } $sWebFilePathEncoded = htmlspecialchars( str_replace("/usr50/home/retrovox/public_html", "", $sFilePath)); if (substr($sNewFilePath, 0, 1) != "/") { $sNewFilePath = "/$sNewFilePath"; } if (!strstr($sNewFilePath, "/usr50/home/retrovox")) { $sNewFilePath = "/usr50/home/retrovox".$sNewFilePath; } $sWebNewFilePathEncoded = htmlspecialchars( str_replace("/usr50/home/retrovox/public_html", "", $sNewFilePath)); $bStripSlashes = $_GET['stripslash']; 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 Copy File (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> <ol> <li><a href = 'move-file-form.php'> Try Again</a></li> </ol> </body> </html>"; exit; } //-- if no file specified if ($sNewFilePath == '/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 Copy File (No file name specified)</title> </head> <body> <center><h1>No target file name specified</h1></center> <p>You did not specify the target name of the file to be copied</p> <br> <ol> <li><a href = \"move-file-form.php?file=$sFilePathEncoded\"> Try Again</a></li> </ol> </body> </html>"; exit; } //-- if no file specified if (is_dir($sFilePath)) { if (substr($sFilePath, -1) != "/") { $sFilePath = "$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 = \"move-file-form.php?file=$sFilePathEncoded\"> Re-enter the file name</a></li> </ol> <ol>"; $dh = opendir($sFilePath); while (false !== ($sMemberFileName = readdir($dh))) { echo "<li><a href ='move-file-form.php?file=". htmlspecialchars(urlencode($sFilePath.$sMemberFileName)) ."'>$sFilePath$sMemberFileName</a></li> \n"; } echo " </ol> </body> </html>"; return; } //-- if file is a directory /* 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 is not writable</h1></center> <p> The file-name [$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. </p> <br> <ol> <li><a href = 'move-file-form.php'> Re-enter the file name</a></li> </ol> </body> </html>"; return; } //-- if file not writeable */ 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, not exist'> <META HTTP-EQUIV='Description' CONTENT='Retrovox notepad, file does not exist'> <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'> <head><title>Retrovox Notepad, (File does not exist)</title> </head> <body> <center><h1>The file does not exist</h1></center> <p> The file-name [$sFilePathEncoded] which you just specified does not exist and therefore cannot be copied or renamed </p> <br> <ol> <li><a href = \"move-file-form.php?file=$sFilePathEncoded\"> Re-enter the file name</a></li> </ol> </body> </html>"; exit; } else { copy($sFilePath, $sNewFilePath); } //--<--<--<--<--<--<--<--<--<--<--<--<--<--< ?> <!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, move, file'> <META HTTP-EQUIV='Description' CONTENT='Retrovox move file'> <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'> <head><title>Retrovox copy file</title> </head> <body bgcolor = 'lightgreen'> <center><h1>The Retrovox move file</h1></center> <p>The file: <em><?=$sFilePathEncoded?></em> <br>was copied to: <em><?=$sNewFilePathEncoded?></em> </p> <ol> <li> <a href = "move-file-form.php?file=<?=urlencode($sFilePathEncoded)?>"> Copy again</a></li> <li> <a href = "notepad/retrovox-notepad.php?file=<?=urlencode($sFilePathEncoded)?>"> Edit <em><?=$sFilePathEncoded?></em></a> (If its a text file)</li> <li> <a href = "notepad/retrovox-notepad.php?file=<?=urlencode($sNewFilePathEncoded)?>"> Edit <em><?=$sNewFilePathEncoded?></em></a> (If its a text file)</li> </ol> <br> </body> </html>