Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > Filemanager v1.0
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 3rd July 16:35
bas_timmer49
External User
 
Posts: 1
Default Filemanager v1.0



I have my second program:

Filemanager!!!

It contains 2 files(this files are in the admin directory of the folder
meant in the showindex.php file($dir)):

showindex.php
---
<?php
$dir = "/pub/publicfiles/"; // Change this to your situation

$dp = opendir($dir);

$filenames = array();

while($file = readdir($dp))
{
array_push($filenames, $file);
}

// Compile an array of the files
for($i = 0; $i < count($filenames); $i ++)
{
if(!(is_dir("$dir/$filenames[$i]")))
{
//echo $filenames[$i]."<br>";
echo "<A
HREF=\"filemanager.php?pid=open&file=".$filenames[$i]."\">".$filenames[$i]."
</a><br>";
}
}
?>
---

filemanager.php

---
<?php
/*
Filemanager v1.0
v1.0 First Release
*/
$filename = $_GET['file']; // Read filename from url
if ($_GET['pid'] == 'open') {
echo "<HTML><HEAD><TITLE>".$filename."</title></head>"; // echo
HTML-code
echo "<body><h1>Contents of $filename</h1><br>"; / more code
$filecontents = nl2br(file_get_contents('../'.$filename)); // Read
contents of file
echo $filecontents;
echo "<br><a href=\"filemanager.php?pid=edit&file=$filename\">E dit</a>";
}
if ($_GET['pid'] == 'edit') {
echo "<HTML><HEAD><TITLE>Edit ".$filename."</title></head>";
$filecontents = file_get_contents('../'.$filename);
echo "<body><h1>Edit $filename</h1><br>";
echo "<form name=form
action=\"filemanager.php?pid=edit2&file=$filename\ " method=post>";
echo "<textarea name=file cols=60 rows=30>$filecontents</textarea>";
echo "<input type=submit value=Submit>";
echo "</form>";
}
if ($_GET['pid'] == 'edit2') {
$newcontent = $_POST['file'];
echo "<HTML><HEAD><TITLE>$filename</title></head>";
$file = fopen("../".$filename, "w+");
$result = fwrite($file, $newcontent);
echo "<body>Resultaat".$result;
echo "<br><a href=\"filemanager.php?pid=open&file=$filename\">O pen</a>";
fclose($file);
}
echo "<br><br><br><small>Copyright Bas</small></body></html>";
?>
---
Change $dir to your dir
/ is the root dir of your harddisk

If you have any improvements(not deleting files, i have planned that
already), Post or mail me!!!

You can run it with showindex.php and from there it runs filemanager.php.

I would like it if you make a p[osibbility to add files(with the same
structure)

Regards,

Bas
  Reply With Quote


 


2 3rd July 16:35
linux
External User
 
Posts: 1
Default Filemanager v1.0



Just my experience... I had a very nice program like this.. Had it
protected with htaccess... Someone got into it somehow.. I don't know
if it was on the inside or outside, but they really messed up my
machine.. Had to reload Redhat.... :-(

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com
  Reply With Quote
3 4th July 00:06
php-general
External User
 
Posts: 1
Default Filemanager v1.0


[.. snip insecure code ..]

Please dont post all the programs you write and then ask, 'help me
make this better.'

if I did this I'd probably be passing John up in #posts on the list


Curt
--
"My PHP key is worn out"

PHP List stats since 1997:
http://zirzow.dyndns.org/html/mlists/
  Reply With Quote
4 4th July 00:06
jay.blanchard
External User
 
Posts: 1
Default Filemanager v1.0


[snip]
Please dont post all the programs you write and then ask, 'help me
make this better.'

if I did this I'd probably be passing John up in #posts on the list
[/snip]

*LOL* Ditto
  Reply With Quote
5 4th July 00:06
ryan
External User
 
Posts: 1
Default Filemanager v1.0


[snip]
Please dont post all the programs you write and then ask, 'help me
make this better.'
[/snip]

Yes, don't *ever* do that, only I am allowed to do
that...
and another thing, don't ask John H for help (or sarcastic comments)...
that too is reserved just for me.
You have been warned....

:-D

Cheers,
-Ryan
  Reply With Quote
6 4th July 00:06
jnichel
External User
 
Posts: 1
Default Filemanager v1.0


Fine, I'm taking my ball, and going home. *sniff*

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
  Reply With Quote


 


7 4th July 00:06
holmes072000
External User
 
Posts: 1
Default Filemanager v1.0


From: "Ryan A" <ryan@coinpass.com>

This John H guy sounds like a dick. Someone should boot him.

---John Holmes...
  Reply With Quote
8 4th July 00:06
jnichel
External User
 
Posts: 1
Default Filemanager v1.0


I agree. In fact, the only people that should be allowed on here should
be me, and those who want to my work for me (for free of course).

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
  Reply With Quote
9 4th July 00:06
robert
External User
 
Posts: 1
Default Filemanager v1.0


I don't know him personally but I've heard he's generally a nice guy but
that sometime he goes off his meds. So generally think warm and fuzzy,
then intermittently pop in a bloody image of a psycho murderer -- Norman
Bates will do! >

Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
  Reply With Quote
10 4th July 07:22
ryan
External User
 
Posts: 1
Default Filemanager v1.0


Hahahaha
I totally agree, but the problem is this d*** knows a fu***** hellava lot
about PHP and we would be
pretty lost on the list without him.....

Its the old problem of which is worse...the devil or the deep sea...

Cheers,
-Ryan
  Reply With Quote
Reply


Thread Tools
Display Modes




666