Ok, who here has a host which is gay and makes you go through like 4/5 pages to get to your site to edit? Well this way, you can just visit one page and edit it.
Just upload and visit.
SUGGESTION
Add a encryptor, i use 18 diffrent cookies which is pretty hard to get around.
<?php
echo "<body align='center'>";
if (isset($_GET[dir])) {
echo "<form name='edit' action='$PHP_SELF?dir='.$_GET[dir].'' method='POST'>";
echo "<input type='hidden' name='dir' value='$_GET[dir]'>";
}else {
echo "<form name='edit' action='$PHP_SELF' method='POST'>";
echo "<input type='hidden' name='dir' value='./'>";
}
echo "<input type='text' value='page' name='page'><br><input type='radio' name='file' value='makepage'>Make a Page<input type='radio' name='file' value='delpage'>Delete a Page<br><input value="submit" type="submit"></form>";
function list_files($dir)
{
if(is_dir($dir))
{
if($handle = opendir($dir))
{
while($file = readdir($handle))
{
if($file != "." && $file != "..")
{
if (!strtolower(strrchr($file,"."))) {
if (isset($_GET[dir])) {
echo '<br><a href="edit.php?dir='.$_GET[dir].''.$file.'">'.$file.'</a>';
}else {
echo '<br><a href="edit.php?dir='.$_GET[dir].''.$file.'">'.$file.'</a>';
}
}else {
echo '<br><a href="?open='.$file.'">'.$file.'</a>';
}
}
}
closedir($handle);
}
}
}
//Use this to make a page
if (isset($_POST[file])) {
if ($_POST[file] == makepage) {
$dir = $_POST[dir];
$file = $_POST[page];
if($handle = opendir($dir)) {
if (file_exists($_GET[dir] . "/$file")) {
echo "Folder or file '$file' already exists!";
}elseif(fopen($_GET[dir] . "/$file", 'w')) {
echo "New file '$file' created";
}else {
echo "Error: Can't create new file '$file'!";
}
}
elseif(file_exists($file)) {
echo "Folder or file '$file' already exists!";
}elseif(fopen($file,"w")) {
echo "New file '$file' created";
}else {
echo "Error: Can't create new file '$file'!";
}
}else {
$file = $_POST[page];
if(!file_exists($file)) { echo "Error: File '$file' does not exist!"; }
else if(unlink($file)) { echo "File: '$file' deleted succesfully"; }
}
}
if (isset($_POST['save'])) {
$file = stripslashes($_POST[save]);
$handle = fopen($_GET['open'],'w');
fwrite($handle, $file);
echo "Successfully wrote to $_GET[open]";
}elseif (isset($_GET['open'])) {
echo "<h3>$_GET[dir] $_GET[open]</h3>";
echo "<br><br>";
echo "<form name='save' method='post' action='edit.php?open=$_GET[open]'>";
echo "<textarea rows=20 cols=100% name='save'>".htmlspecialchars(file_get_contents($_GET['open']))."</textarea>";
echo "<br><input type='Submit' value='Save'>";
}if (isset($_GET[dir]) && !isset($_GET[open])) {
list_files("./$_GET[dir]");
}else {
list_files("./");
}
?>
MAJOR security risk dude,
http://webtastix.co.nz/tehtaco.php
(i didn\'t do anything bad...just proving a point)
UPDATED, This is Version 2, i\'m pretty sure it all works, but not a 100% certain on the save, but the rest works, now can go into sub dir/folders, and so on and forth, edit stuff from sub dir(not sure if it saves) so please tell me if it doesn\'t save, it kept saying didn\'t have correct privilege\'s but it did so i dunno
[quote=[M]ike]Pretty nifty, it\'s always nice to have an online control panel, means you can give other users a way to edit/update your site. Maybe add a member system with rites, so that some users can edit more than others etc. etc. Could become a very nice and popular Admin Control Panel script. Good job so far Furby.[/quote]
you can give other users a way to edit/update your site. --- Not reckon mended if some noob gets your site, they could get your account banned.
Maybe add a member system with rites, so that some users can edit more than others etc. etc. --- Reffer to above problem, and also it also varies how people set up a member system, mine uses cookies but others may use sessions which mean you would need to edit script, which is what you would have to do now.....
But besides that, thanks. Version 2 nearly ready for upload, just working on Dir/Folder stuff.
Pretty nifty, it\'s always nice to have an online control panel, means you can give other users a way to edit/update your site. Maybe add a member system with rites, so that some users can edit more than others etc. etc. Could become a very nice and popular Admin Control Panel script. Good job so far Furby.