What's Here?
- Members: 118,478
- Replies: 434,469
- Topics: 67,154
- Snippets: 2,407
- Tutorials: 638
- Total Online: 939
- Members: 50
- Guests: 889
Who's Online?
|
Welcome to Dream.In.Code |
|
Getting PHP Help is Easy!
Join 118,478 PHP Programmers for FREE! Ask your question and get quick answers from experts. There are 939 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!
|
|
Submitted By: SpaceMan
|
|
Rating:

|
|
Views: 13,522 |
Language: PHP
|
|
Last Modified: March 13, 2005 |
Instructions: chmod the file to edit 0666.
will edit files with textarea. |
Snippet
<?php
$loadcontent = "my_edit_file.php";
if($save_file) {
$fp = @ fopen($loadcontent, "w");
if ($fp) {
print '<a href='. $_SERVER[PHP_SELF ]. '>Refresh</a>';
print "<html><head><META http-equiv=\"refresh\" content=\"0;URL=$_SERVER[PHP_SELF]\"></head><body>";
}
}
$fp = @ fopen($loadcontent, "r");
$lines = explode("\n", $loadcontent);
for ($a = 1; $a < $count+1; $a++) {
$line .= "$a\n";
}
?>
<form method=post action="<?=$_SERVER[PHP_SELF]?>">
<input type="submit" name="save_file" value="Save">
<table width="100%" valign="top" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="3%" align="right" valign="top"><pre style="text-align: right; padding: 4px; overflow: auto; border: 0px groove; font-size: 12px" name="lines" cols="4" rows="<?=$count+3;?>"><?=$line;?></pre></td>
<td width="97%" align="left" valign="top"><textarea style="text-align: left; padding: 0px; overflow: auto; border: 3px groove; font-size: 12px" name="savecontent" cols="150" rows="<?=$count;?>" wrap="OFF"><?=$loadcontent?></textarea></td>
</tr>
</table>
<br>
<input type="submit" name="save_file" value="Save">
</form>
Copy & Paste
|
|
|
Reference Sheets
Bye Bye Ads
Free DIC T-Shirt
Related Sites
Monthly Drawing
Partners
Top Contributors
Top 10 Kudos This Month
|