Website contact form - get_magic_quotes_gpc

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
9,144
Reaction score
10,489
My hosting provider updated the PHP to 8.2. One of my websites contact form returns a blank page.

I changed this:

PHP:
if ( get_magic_quotes_gpc() && isset($_POST) ) {

      phpfmg_stripslashes( $_POST );

  };

To this:

222.PNG


Now the page loads, but when I fill out the contact form and send, it throws a blank page. So I changed this:

PHP:
$strip     = get_magic_quotes_gpc() ;

To this:

PHP:
// $strip = get_magic_quotes_gpc(); // Remove or comment out this line

Now everything works, but when I receive the message from the contact form, it comes like this:

111.PNG


How can I fix this stupid thing? @TomTheCat


p.s sorry for the screenshots, but I will never figure out how to post code on BHW and make it work...
 
Hmm, intersting. So you say you converted
if ( get_magic_quotes_gpc() && isset($_POST) ) {

phpfmg_stripslashes( $_POST );

};
to this?


I don't have access to your code obviously, but why are you trying to sanitize the whole $_POST object/array (or whatever that is called in php. Associative array may be?)?


Rest of the explanation looks even more Greek to me lol so I wouldn't try to fix it.

Obviously, you are having issues with the form submission. You should not submit the whole html to begin with. If you have an editor in the frontend, perhaps change it to a normal textarea, and pass through a nl2br function in the backend view.

Anyway, if you know where that output is being rendered, if you change the output variable and pass it through html_entity_decode function (e.g. html_entity_decode($output) ), that should get rid of the display problem.


As for the blank page, always check your error log. That will tell you what exactly is going wrong. You might think error handling/debugging is unnecessary to run a site, but it actually is not. This is why some people run their sites flawlessly while others spend the rest of the day on Stack Overflow or Chatgpt. :p :D


If you pm me the details, I will solve it for you for free, since I like you. :D :D
 
Last edited:
Did you get this solved?

Well, sorta. I fixed it so that the page displays and the form works.

But I didn't fix the bit where I receive the message. I receive the message with all that HTML there, and in there I can find the contents that were submitted in the contact form.

What's a guy to do :p

Hmm, intersting. So you say you converted

to this?



I don't have access to your code obviously, but why are you trying to sanitize the whole $_POST object/array (or whatever that is called in php. Associative array may be?)?


Rest of the explanation looks even more Greek to me lol so I wouldn't try to fix it.

Obviously, you are having issues with the form submission. You should not submit the whole html to begin with. If you have an editor in the frontend, perhaps change it to a normal textarea, and pass through a nl2br function in the backend view.

Anyway, if you know where that output is being rendered, if you change the output variable and pass it through html_entity_decode function (e.g. html_entity_decode($output) ), that should get rid of the display problem.


As for the blank page, always check your error log. That will tell you what exactly is going wrong. You might think error handling/debugging is unnecessary to run a site, but it actually is not. This is why some people run their sites flawlessly while others spend the rest of the day on Stack Overflow or Chatgpt. :p :D


If you pm me the details, I will solve it for you for free, since I like you. :D :D

All right, I'll shoot you a PM bro. Thank you.

Gogol for the Presidency!

What a legend @Gogol

God! :D
 
Back
Top