adding scriptdoing problem at admin side
i got a add from goolge . when i place it at my user side it wrok well , i want that script show on my admin side i want just script code , but now whn i fetch adds from data base , there are shown as a add not as a scrpit .. anu idea .. i am using this in php, i have come to shoe some htmlentity function is user for ds if i dng this type of coding how a i manage it .开发者_开发技巧.
$show =' '.$row[add_code].' '; hoe to use htmlentity function
Instead of htmlentities, which converts all characters that have a matching HTML character entity, using htmlspecialchars should suffice. htmlspecialchars
only replaces " ' < > &
, so no markup in the string will be interpreted.
You just pass it your code and it returns a string with those characters converted.
$show = htmlspecialchars(' '.$row[add_code].' ');
htmlentities
works the same.
If I understand correctly, you want to show the advert on the public pages, but the script for the advert on the admin pages?
Why not use a conditional to surround it with <pre>...</pre>
then you won't need to convert any entities and you'll be able to inspect the code as it really is.
精彩评论