Reignfire Posted September 11, 2013 Share Posted September 11, 2013 Hi, I have a phpform where people can upload papers but they also need to fill in a little textbox with information about the paper. Most people copy some text from the word file straight into the textbox but if there are some quotes in it and you press submit you always get a Bad Request error page. The thing is if you go to the textbox and you replace the copied quotes with quotes you type yourself it works. I know there are some problems with these "smart quotes" but i put some phpcode to replace the smart quotes with normal quotes: $paperinfo = str_replace( array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"), array("'", "'", '"', '"', '-', '--', '...'), $paperabstract); $paperinfo = str_replace( array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)), array("'", "'", '"', '"', '-', '--', '...'), $paperabstract); but still it isn't working. Also when i use the correct quotes and press submit it first checks for empty fields but if i use the copied quotes it isn't even checking which fields are empty it goes straight to the bad request page. Hope somebody can help me with this problem. Quote Link to comment Share on other sites More sharing options...
Reignfire Posted September 11, 2013 Author Share Posted September 11, 2013 oh wrong section sorry, how can i move this to phpcoding help? Quote Link to comment Share on other sites More sharing options...
Solution kicken Posted September 11, 2013 Solution Share Posted September 11, 2013 If you get bad request, most likely your PHP is never even running. Your server may have some kind of filter enabled to reject requests with the smart quotes in them. Check your server's error logs to see if you can get a more detailed reason why the bad request error occurs. Quote Link to comment Share on other sites More sharing options...
Reignfire Posted September 11, 2013 Author Share Posted September 11, 2013 Yes indeed, it was a modsecurity problem. It's working again. Thanks. 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.