logicopinion Posted November 25, 2007 Share Posted November 25, 2007 hello everybody, i am trying to create simple cms (content menegment system) and now i am on the run to make something Like : Discription: i have a form with rich text editor, which has to fields, one where is specify page name and another TEXTAREA where i write everything i want to be desplayed on that page so, Code Looks Like this This is The HTML Form With RTE (rich Text Editor) <?php require("includes/vars.php"); mysql_connect("$hostname", "$username", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); print "<table class='titles' align='center' border='0' cellpadding='0' cellspacing='0' width='500'>"; print "<form name='myform' onsubmit='return submitForm();' action='newpage.php' method='post'>"; print "<tr><td>"; print "Choose page ID<hr />"; print "<select name=\"filename\">"; $query = "SELECT * FROM menu ORDER BY id ASC"; $result=mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo "<option>".$row['id']."</option>"; } ?> </select> <hr /> page content <hr /> <script language="JavaScript" type="text/javascript"> <!-- function submitForm() { updateRTE('rte1'); //updateRTEs(); return true; } //Usage: initRTE(imagesPath, includesPath, cssFile) initRTE("images/", "", ""); //--> </script> <script language="JavaScript" type="text/javascript"> <!-- //Usage: writeRichText(fieldname, html, width, height, buttons, readOnly) writeRichText('rte1', 'შეიყვანეთ სასურველი ტექსტი', 400, 200, true, false); //--> </script> </label> </fieldset> <br> <center><input type="submit" value="გაგზავნა"> <input type="reset" value="გასუფთავება..."></center> </form> and this is the code which gets posted Data and creates page: <?php $filename = $_POST['filename']; $rte1 = $_POST['rte1']; $name = "$filename.php"; $content = fopen("../navigation/".$name, 'w') or die("can't open file"); $stringData = "$rte1"; fwrite($content, $stringData); ?> so everything goes fine until it comes to desplay some Styles on that page.. when i make some text bold and then see the code in RTE it looks like this: <span style="font-weight: bold;">This is Bold Text</span> and when i go to Navigation folder where this file must be i open it and see lil differance, it adds \ in front of evry " sign and code looks like this <span style=\"font-weight: bold;\">This is Bold Text</span> hope you see the differance, please can someone give me some edvice about why this happens, maybe u ask so what happens when \ sign is added, tell you if i use this sign no style is applied to text, when i remove them then text looks like as it should be. thank you Quote Link to comment https://forums.phpfreaks.com/topic/78798-magic_quotes/ Share on other sites More sharing options...
revraz Posted November 25, 2007 Share Posted November 25, 2007 Have you tried using removeslashes? Quote Link to comment https://forums.phpfreaks.com/topic/78798-magic_quotes/#findComment-398771 Share on other sites More sharing options...
logicopinion Posted November 25, 2007 Author Share Posted November 25, 2007 no, i was just told to run off magic_quotes_gpc in php.ini file i did it but the same problem .. i realy do not know how to.. Quote Link to comment https://forums.phpfreaks.com/topic/78798-magic_quotes/#findComment-398772 Share on other sites More sharing options...
nuxy Posted November 25, 2007 Share Posted November 25, 2007 Yet another magic_quotes problem.. So glad magic_quotes is gone in php6. Anyways, use stripslashes(), along with htmlspecialchars(), this will help you. Quote Link to comment https://forums.phpfreaks.com/topic/78798-magic_quotes/#findComment-398773 Share on other sites More sharing options...
logicopinion Posted November 25, 2007 Author Share Posted November 25, 2007 thank you guys, can someone show me example with my code i wrote above, i am realy new in php and cant get where to put stripslashes or htmlspecialcharacters, thank you Quote Link to comment https://forums.phpfreaks.com/topic/78798-magic_quotes/#findComment-398782 Share on other sites More sharing options...
PFMaBiSmAd Posted November 25, 2007 Share Posted November 25, 2007 If you made a change to php.ini but it did not take effect, either you did not stop and start your web server afterwords or the php.ini that you made the changes to is not the one that php is using. Quote Link to comment https://forums.phpfreaks.com/topic/78798-magic_quotes/#findComment-398786 Share on other sites More sharing options...
logicopinion Posted November 25, 2007 Author Share Posted November 25, 2007 if (get_magic_quotes_gpc()) {fwrite ($content, stripslashes($stringData));} thank you. i am done Quote Link to comment https://forums.phpfreaks.com/topic/78798-magic_quotes/#findComment-398788 Share on other sites More sharing options...
nuxy Posted November 25, 2007 Share Posted November 25, 2007 thank you guys, can someone show me example with my code i wrote above, i am realy new in php and cant get where to put stripslashes or htmlspecialcharacters, thank you A guide. $rte1 = $_POST['rte1']; to $rte1 = htmlspecialchars(stripslashes($_POST['rte1'])); Read a tutorial if you need more help. Quote Link to comment https://forums.phpfreaks.com/topic/78798-magic_quotes/#findComment-398789 Share on other sites More sharing options...
logicopinion Posted November 25, 2007 Author Share Posted November 25, 2007 but if i use htmlspecialcharacters it ignores all html tags created by RichText Editor, then how can i apply some style to text? if i ignore all html from it? forexample i want to make text BOLD somewhere in the text, when i use HTMLSPECIALCHARACTER, <B> tag is ignored and i get simple text, but i want to be bold when i make it? is there any other way to apply style then ? i think no Quote Link to comment https://forums.phpfreaks.com/topic/78798-magic_quotes/#findComment-398801 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.