Created
March 17, 2009 02:38
-
-
Save reconbot/80240 to your computer and use it in GitHub Desktop.
local edit .htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>.htaccess Editor</title> | |
</head> | |
<body> | |
<center> | |
<br /><br /> | |
<h1>.htaccess Editor</h1> | |
<br /> | |
<b>This is a php based .htaccess editor. Its probably a bad idea. but at least you have to be from localhost.</b> | |
<br /><br /> | |
<?php | |
if ($_SERVER['REMOTE_ADDR'] == "127.0.0.1" || $_SERVER['REMOTE_ADDR'] == "::1") | |
{ | |
if ($_POST) //if we're posting changes | |
{ | |
// write the changes | |
$directives = $_POST['code']; | |
$file = fopen(".htaccess","w+"); | |
fputs($file, $directives); | |
fclose($file); | |
} | |
$file = fopen(".htaccess","r+") or exit("Unable to open .htaccess"); | |
$directives = fread($file, filesize(".htaccess")); | |
fclose($file); | |
} else {exit( "Access Denied for " . $_SERVER['REMOTE_ADDR']);} | |
?> | |
<form name = "htedit" METHOD="post"> | |
<TEXTAREA NAME="code" ROWS=6 COLS=40> | |
<?php echo htmlspecialchars($directives); ?> | |
</TEXTAREA> | |
<br /> | |
<INPUT TYPE="submit"> | |
<INPUT TYPE="reset"> | |
</form> | |
</center> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment