Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.


How to disable certain part of the PHP code

antony Offline referral

Posts: 478
Joined: Jul 2013
Reputation: 5

Senior Member
How is possible to disable a php code from being read without removing it from PHP file.

I want to disable this one {$error_message}
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

Support Team


Rapidsoft technologies Offline referral

Posts: 196
Joined: Sep 2015
Reputation: 1

Try htmlspecialchars($string);

That will encode all the HTML tags to character codes (<div> would become &lt;div&gt;, which will be displayed without being parsed as html) This way, script tags cannot be created as well.

Be sure to clean the content before supplying it to a database though, for example by escaping with mysqli_escape_string() (others will probably advice you to use prepare statements).

It is most likely not best practice to put HTML character encoded strings into the database, as it simply increases the string size unnecessarily. (And it doesn't provide protection against SQL injection on its own)

User(s) browsing this thread: 1 Guest(s)