-----Original Message----- From: Andrew Ballard [mailto:aballard@xxxxxxxxx] Sent: Thursday, September 09, 2010 10:13 AM To: Jack Cc: PHP Subject: Re: Show text without converting to html On Thu, Sep 9, 2010 at 9:52 AM, Jack <JackListMail@xxxxxxxxx> wrote: > > Hello All, > > > I have some code which converts to some html to ascii characters. > This basically obfuscates the html code, but shows it correctly on an page. > > > I am trying to show the results of the obfuscation ( works correctly > because it displays the html value ), but I want to then show the > obfuscated html code so they can copy it. > > An example is I want to show them this below: > > <a > href="mailto:you > 4; > 0;email.addr
 > 1;� 0115;s?subject=&cc=&bcc=&body=" style="" class="" > id="">your@email > ;� 46;address</a> > > > > Which was created by the code, but I apparently can't seem to echo it > and get it to display like above.. It converts it to html no matter what I do. This should do it: <?php $var = '<a href="mailto:your@email.address?subject=&cc=&bcc=&body=" style="" class="" id="">your@email.address</a>'; echo htmlspecialchars($var); ?> The obfuscation doesn't buy you much, though. <?php var_dump(html_entity_decode($var, ENT_QUOTES, 'utf-8')); ?> string(106) "<a href="mailto:your@xxxxxxxxxxxxx?subject=&cc=&bcc=&body=" style="" class="" id="">your@xxxxxxxxxxxxx</a>" The only people for whom the value will be obscure will be the humans who actually try to read the HTML source code itself. Neither web browsers nor harvesting scripts won't have any trouble reading it. Andrew Hi Andrew, I thought this was suppose to help against many of the havesting scripts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php