|
-
Jun 7th, 2007, 02:45 PM
#1
Thread Starter
Hyperactive Member
Modify this code.
Right now I have code that allows me to submit text in order to create a .htm file on my server automatically.
I wish to also be able to delete a certain file from the server.
Here is the code I have now that allows me to create files on my server:
Code:
Form:
<form method="post" action="activate.php">
<input name="textarea" type="text" value="">
<input value="Submit" type="submit">
</form>
Activate.php:
<?php
$textarea = $_POST['textarea'];
$textarea = str_replace("\r", "", $textarea);
$textarea = str_replace("\n", "", $textarea);
$textarea = str_replace("\r\n", "", $textarea);
$textarea = str_replace("\n\r", "", $textarea);
$textarea = trim($textarea);
$textarea = str_replace(" ", "_", $textarea);
$file = fopen($textarea . ".htm", "x");
fwrite($file, "authorized");
fclose($file);
chmod($textarea . ".htm", 0777);
?>
I would like code that allows me to delete the file i specify from the server. (permissions are set to do this)
For example, If i added another form to the page, istead of creating the file, delete it.
<form method="post" action="activate.php">
<input name="textarea" type="text" value="DELETETHISFILE.HTM">
<input value="Submit" type="submit">
</form>
Submitting the above form would delete "DELETETHISFILE.HTM" off the server.
Please, thanks.
-
Jun 7th, 2007, 03:52 PM
#2
-
Jun 7th, 2007, 08:14 PM
#3
Thread Starter
Hyperactive Member
8 gigs/ram (hey why not)
300 gig HD x2
Windows XP 64
-
Jun 7th, 2007, 11:40 PM
#4
Re: Modify this code.
your code would look something like this:
PHP Code:
$page = "files/html_doc.html";
unlink($page);
you might want to do some error catching too
My usual boring signature: Something
-
Jun 10th, 2007, 06:46 AM
#5
Thread Starter
Hyperactive Member
Re: Modify this code.
Anyone want to code it for this lazy SOB? 
Well not lazy, busy.
Last edited by penagate; Jun 10th, 2007 at 09:33 AM.
Reason: merged double post
-
Jun 10th, 2007, 02:21 PM
#6
My usual boring signature: Something
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|