Hi everyone,
i need some assistance with simple code. First, I am using this script to open txt includes and edit the contents for an easy admin panel. However im having a hard time.Call stripslashes() on the data before writing it.
This is the code:
oh and if anyone wants to show me how to incorporate a WYSIWYG editor into the txt field so people dont know html to edit that would be great.Code:<? if($_POST['Submit']){ $open = fopen("textfile.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "File updated.<br />"; echo "File:<br />"; $file = file("textfile.txt"); foreach($file as $text) { echo $text."<br />"; } echo "<p><a href=\"./livepage.php\">click here to view the live updated webpage</a></p>"; echo "<p><a href=\"./mainadminpage.php\">click here to view the admin menu</a></p>"; }else{ $file = file("textfile.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?>
Also, for my admin panel, i want to be able to goto, for example:
index.php?page=aboutus and that aboutus var would be added to that code to include that txt file. i think its like global vars or something. I used to play around with php awhile ago, but ive seem to forgotten alot
any help would be greatly appriciated.
thank you




Reply With Quote

Bookmarks