sw0o0sh Posted November 29, 2006 Share Posted November 29, 2006 Hi, I've nearly perfected my content management system (basically my own geocities yay) after many stressful encounters with functions and needing about 1000 brain blasts to code what I was able to at times.But anyway, now I'm at a little bit less difficult run in, yet stumped too. The part of my site where you edit the file is pretty much flawless, except for one thing, when you request that your file is to be editted, and the file to be editted contains a <textarea>, the <textarea> you edit in breaks. I tried variations of htmlspecialchars() and such in random areas, but that isnt going to work; and hasn't.So here's my code as of now, (ignore the invalid structure, im just pasting a piece of a huge file)[code]else if($_GET[act] == 'edit'){if($_POST[alter]){ $opennew=fopen("directory/".$logged[webpage]."/".$_GET[edit],'w'); $content=stripslashes($_POST[content]); fwrite($opennew,$content);}$open=fopen("directory/".$logged[webpage]."/".$_GET[edit],'r');?><form style='text-align:center;' method='post' action='manage.php?act=edit&edit=<?PHP echo $_GET[edit]; ?>'><textarea style='font-family:times new roman;font-size:12pt;' rows='20' cols='100' width='100%' name='content'><?PHPwhile(!feof($open)){ echo fgets($open);}?></textarea><br /><input type='submit' name='alter' value='Update Page' /> <input type='reset' value='Undo Changes' /> <input type='button' value='Preview Page' onclick='window.location="directory/<?PHP echo $logged[webpage]."/".$_GET[edit]; ?>";' /> </form>[/code]I obviously know what I have now isn't an attempt at fixing the error, i just left it normal as i gave up trying along time ago as this simple feature to the site was one of the first things I did and decided to get to last.Thanks anybody. Quote Link to comment Share on other sites More sharing options...
Jocka Posted November 29, 2006 Share Posted November 29, 2006 so you can't just dohtmlentities(fgets($open));? that doesn't work? Quote Link to comment Share on other sites More sharing options...
sw0o0sh Posted November 29, 2006 Author Share Posted November 29, 2006 Lol wow, that is a heavenly function. Works like a charm now, thanks. Quote Link to comment Share on other sites More sharing options...
Jocka Posted November 29, 2006 Share Posted November 29, 2006 lmao I didn't even mean to answer with that. I thought you already used it when you said "I tried variations of htmlspecialchars() and such in random areas..." Quote Link to comment Share on other sites More sharing options...
sw0o0sh Posted November 29, 2006 Author Share Posted November 29, 2006 [quote author=Jocka link=topic=116764.msg475923#msg475923 date=1164837357]lmao I didn't even mean to answer with that. I thought you already used it when you said "I tried variations of htmlspecialchars() and such in random areas..."[/quote]No, i was trying stupid stuff like htmlspecialchars(include()) and such. And when i tried altering fgets i put the function after fgets not before. So thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.