You are here: Re: preg_replace question - ASCII characters? « PHP Programming Language « IT news, forums, messages
Re: preg_replace question - ASCII characters?

Posted by deko on 02/08/07 16:22

"the DtTvB" <mechakoopa@gmail.com> wrote in message
news:1170936031.821994.212330@p10g2000cwp.googlegroups.com...
> You should use the function htmlspecialchars().
>
> $refhost = htmlspecialchars($refhost);
>
> But even through you have changed it, you should just see "Array".
> That's because of this line:
>
>> $refhost = parse_url($refurl);
>
> Ok, so you wanted to get the host name, instead of just having
> $refhost = htmlspecialchars($refhost);
>
> you have to make it this:
> $refhost = htmlspecialchars($refhost['scheme'] . '://' .
> $refhost['host'] . (isset($refhost['port']) ? $refhost['port'] : ''));

Thanks for the tip - htmspecialchars() is the way to go...

Here's more complete code:

$refurl = trim(getenv("HTTP_REFERER"));
$refurl = htmlspecialchars($refurl, ENT_NOQUOTES, 'ISO8859-1');
$refhost = parse_url($refurl);
$reflink = "<a href='".$refurl."'>".$refhost['host']."</a>";

what do you think?

still testing...

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация