Top

Webpage Editor VERSION 2 - UPDATED


PHP Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  6.5 (of 4 scores)
Date Added  Jun 23, 2007
Last Updated  Jul 17, 2007
Tags  editor  fopen  fwrite  page  php  webpage  xstatic 

Description

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.

Grab the Code

<?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("./");
}
?>
 

Comments

  (30)  RSS
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jun 23, 2007 10:38 am
Just as a side note it also hides the . and ..
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jun 23, 2007 10:52 am
also you can test it at http://webtastix.co.nz/test/edit.php
Hawkee
Comments: 1,092
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jun 23, 2007 7:39 pm
This can be a huge security hazard on any server. If anybody besides the administrator gains access they could potentially gain access to the server and do something malicious.
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jun 24, 2007 4:27 am
ya on mine, it has 5 md5'd encrypted passwords, can not edit this file, can not edit my configuration file, can not edit my index file but everything else. Plus i always pick very carefully who i give access to and who i don't give access to
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jun 25, 2007 6:33 am
On version 2 it has

Make a Page
Delete a Page
Navigate through Folders

And thats it for now, so its slowly coming along
[M]ike
Comments: 33
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jun 30, 2007 4:08 pm
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.
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 1, 2007 5:02 am
[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.
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 3, 2007 8:02 am
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
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 3, 2007 8:09 am
Oh ya, i know its not alot on looks, but i'm making a design for it

So please don't criticize me on the design side of it. I'm more after the coding points and that :D
tehtacoking
Comments: 2
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 7, 2007 9:53 am
MAJOR security risk dude,
http://webtastix.co.nz/tehtaco.php
(i didn't do anything bad...just proving a point)
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 7, 2007 1:07 pm
thanks for pointing that out, fixed.
Hawkee
Comments: 1,092
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 7, 2007 1:30 pm
This is still a major security risk. Definitely don't use this unless you absolutely know what you're doing. Furby, I suggest you add a login and password feature that requires the session before any files are created, edited or deleted.
Earl
Comments: 10
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 15, 2007 6:54 pm
I added a session login system to mine. I found a bug, when you go into another directory that has same file names to the prior folder of where the edit.php file is, it'll open the file in the main directory.
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 16, 2007 1:09 am
Thanks, fixed
Earl
Comments: 10
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 16, 2007 2:50 am
I'm sorry dude but I believe some of your coding is not 100% correct yet, now you're generating tstring errors starting at line three.
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 17, 2007 7:19 am
hmm when i hit edit and then save it changed all my \" to "
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 17, 2007 7:22 am
but none the less fixed :P
sharpknife
Comments: 12
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 17, 2007 10:14 pm
great idea.. but I'd rather not risk it
tehtacoking
Comments: 2
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Jul 18, 2007 5:56 pm
hmm, you haven't fixed the bug yet :S
cool.php got saved to the base of drive e:\
peterpowell
Comments: 39
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Aug 10, 2007 8:50 am
i would pass everything through htmlentities(); when saving and html_entity_decode(); when loading it into the editor

;)

-PP
Snipe
Comments: 7
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Aug 10, 2007 3:06 pm
Hey I liked this script just I had some problems with it, like when I went to edit a new page inside a folder, it would give me errors...not sure why, but maybe I can fix it, also I started playing around with it, and i think I made it better and easy to use. Tell me if you want a copy of it :)
Snipe
Comments: 7
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Aug 10, 2007 4:36 pm
Furby please reply, thanks.
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Aug 11, 2007 12:39 am
pm me the script and i'll try it out, but thanks for the feedback
Snipe
Comments: 7
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Aug 13, 2007 12:22 pm
Hey Furby did you make a new version that you havnt released yet? And i'll send you my copy of mine.
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Aug 14, 2007 2:15 am
i'm making the next version at the moment, nearly completed
Snipe
Comments: 7
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Aug 14, 2007 12:38 pm
Two questions

1. When will the next version be released?
2. I looked on this website I saw posted above and they have v2.1, and this is only v2 right?

Thanks
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Aug 15, 2007 4:59 am
oh v2.2 then :P i better change the script :P thanks for pointing that out :P, and next version in about under a week :P
Undefined_Variable
Comments: 5
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Feb 20, 2008 1:21 am
You need to add \'s before the (")'s because the code is seeing them as variables and directories because it's not commented out or w/e
F*U*R*B*Y*
Comments: 627
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Feb 20, 2008 2:27 am
yeah uh working on VERSION 3
skytech
Comments: 1
 
PHP Snippet:  Webpage Editor VERSION 2 - UPDATED
Posted on Mar 25, 2008 3:55 pm
pls can any body here instruct me on how to use this webpage code snippet becoz i install it and it brought back page cannot be found,pls help out and how can i integrate it to each page of my site in order to edit them.

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom