horseatingweeds Posted September 8, 2008 Share Posted September 8, 2008 I run Apache on a Windows setup for testing but publish on a Linux server. I use a text area and text inputs to add information and create pages. On Windows/Apache I had it working fine. After moving it to Linux apostrophes were escaped in the output, and only if I typed them is. Pasting them, they were not escaped. Example: Bill's shows up as Bill/'s I'm not sure what code to show. I'm just loading the input value into a database, then outputing it into an html template. I've removed the filters to see if I had something funny in there, but no change. I'm thinking this must be something with how Linux treats text. Any ideas? Link to comment https://forums.phpfreaks.com/topic/123222-question-escapes-in-text-areas-apache-on-linux-vs-win/ Share on other sites More sharing options...
JasonLewis Posted September 8, 2008 Share Posted September 8, 2008 When inserting data into a database you should be using mysql_real_escape_string(). Then when outputting the data in your HTML template you can use stripslashes(). Link to comment https://forums.phpfreaks.com/topic/123222-question-escapes-in-text-areas-apache-on-linux-vs-win/#findComment-636369 Share on other sites More sharing options...
horseatingweeds Posted September 8, 2008 Author Share Posted September 8, 2008 Thanks ProjectFear, I think my framework uses mysql_real_escape_string(). I'll give stripslashes() a try. Do you know why the slashes only appear on the Linux server? Link to comment https://forums.phpfreaks.com/topic/123222-question-escapes-in-text-areas-apache-on-linux-vs-win/#findComment-636372 Share on other sites More sharing options...
PFMaBiSmAd Posted September 8, 2008 Share Posted September 8, 2008 Slashes automatically added to post/get/cookie data is due to the magic_quotes_gpc setting being on. Slashes automatically added to data from databases and files is due to the magic_quotes_runtime setting being on. Link to comment https://forums.phpfreaks.com/topic/123222-question-escapes-in-text-areas-apache-on-linux-vs-win/#findComment-636452 Share on other sites More sharing options...
discomatt Posted September 8, 2008 Share Posted September 8, 2008 When inserting data into a database you should be using mysql_real_escape_string(). Then when outputting the data in your HTML template you can use stripslashes(). This is not true. There's no need to remove slashes from a string ONLY escaped with mysql_real_escape_string() when retrieving it from the database. If you have magic_quotes on, then you must stripslash. Link to comment https://forums.phpfreaks.com/topic/123222-question-escapes-in-text-areas-apache-on-linux-vs-win/#findComment-636559 Share on other sites More sharing options...
horseatingweeds Posted September 8, 2008 Author Share Posted September 8, 2008 Thanks discomatt. Magic_quotes_gcp = 1 That setting must have been the difference in my two setups. It looks like that was causing some other problems for me too. Link to comment https://forums.phpfreaks.com/topic/123222-question-escapes-in-text-areas-apache-on-linux-vs-win/#findComment-636774 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.