Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PHP edit files Script


ghost's Avatar
0 0

Hey, i made a script that i use often to edit files, so i dont have to use FTP everytime i want to edit a script, here's the code:


<textarea name="content" width="100%" height="100%" style="width:100%;height:750px;background-color:black;color:LightSlateGrey;font-size:12px;" wrap="logical" rows="21" cols="40">
<?php

$file = $_GET['file'];
if(isset($_GET['file'])){

$x = @file_get_contents($file);
if( !$x ){
echo ('No file selected or no data!');
} else {
echo htmlentities(file_get_contents($file));
}


if(isset($_POST['content'])){

$content = $_POST['content'];
$filew = fopen($file, "w+");

fwrite($filew,stripslashes($content)); 
fclose($filew);
}}

?>
</textarea>

<br><br>
<center>
<input type="submit" value="Edit!" style="height:20px;">  <input type="reset" value="Reset" style="height:20px;">
</form>
</center>```

you can test it here:
http://lolzor.t35.com/edit.php?file=testfile.txt

just a free host i set up, ads and shit..

ok, post your suggestions/improvements or what you think, i'm PHP noob..




*HackingForce~*






SySTeM's Avatar
-=[TheOutlaw]=-
20 0

Code bank it?


ghost's Avatar
0 0

Ok, submitted..;)


Ingelo's Avatar
q|^.^|p - Say w00t!
0 0

Yay, someone was 1337 enough to own it :p


ghost's Avatar
0 0

It probably would have been a good idea to have a check that the file wasn't itself!


ghost's Avatar
0 0

mozzer wrote: It probably would have been a good idea to have a check that the file wasn't itself!

Oh, man, that sucks… lol


SySTeM's Avatar
-=[TheOutlaw]=-
20 0

Liek wowz! Some 1337 haxx0r managed to edit a file using the "edit.php" page which the source was shown in the forums!!! H0MG HAX!

For those of you who are retarded, what I used above, was sarcasm :)


spyware's Avatar
Banned
0 0

Drop the black background. And a "new file" option too. Basics are all there though. Now you need to focus on accessibility, flexability, and clearly security.


ghost's Avatar
0 0
  1. you don't need a "New file" option..just start coding and click Edit, the file will automatilly get created

  2. what's the point of checking if the file is it self, when you can just make a new one that would fuck it, IF that's what you want to do..

  3. the point is to use it so you don't have to upload files via FTP each and everytime you want to edit something, not to be a fucking noob and delete the script!

god damn..


spyware's Avatar
Banned
0 0

HackingForce wrote:

  1. you don't need a "New file" option..just start coding and click Edit, the file will automatilly get created

  2. what's the point of checking if the file is it self, when you can just make a new one that would fuck it, IF that's what you want to do..

  3. the point is to use it so you don't have to upload files via FTP each and everytime you want to edit something, not to be a fucking noob and delete the script!

god damn..

Erh, I didn't delete the script. In the case you weren't talking to me: I still didn't delete it.


ghost's Avatar
0 0

No, i didn't say to did it, just want to make sure the noob who did it feels stupid for doing it!

Peace..:right:


Mouzi's Avatar
Member
0 0

You could add options to chmod the file.