|
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]
|