Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Aiheen aloitti: Forocv - helmikuu 08, 2005, 08:16:38 AP

Otsikko: Problem with javascript code
Kirjoitti: Forocv - helmikuu 08, 2005, 08:16:38 AP
Hello:

I'm trying to insert the code to the statistics.

I use the ax program.

The code to insert is:

Lainaa
echo '<script type="text/javascript">
<!--
   document.write('<img src="http://www.forocv.com/cgi-bin/axs/ax.pl?mode=img&ref=');
   document.write( escape( document.referrer ) );
   document.write('" height="1" width="1" style="display:none" alt="" />');
// -->
</script><noscript>
   <img src="http://www.forocv.com/cgi-bin/axs/ax.pl?mode=img" height="1" width="1" style="display:none" alt="" />
</noscript>';


But always have the same error:

Lainaa
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /web/htdocs/www.forocv.com/home/foro/Themes/classic/index.template.php on line 215


Is correct the code?

Thank you
Otsikko: Re: Problem with javascript code
Kirjoitti: Oldiesmann - helmikuu 08, 2005, 12:19:01 IP
You don't need to use Javascript...

$ref = urlencode($_SERVER['HTTP_REFERRER']);
echo '<img src="http://www.forocv.com/cgi-bin/axs/ax.pl?mod=img&ref=' . $ref . '" height="1" width="1" style="display:none" alt="" />';
Otsikko: Re: Problem with javascript code
Kirjoitti: Forocv - helmikuu 09, 2005, 03:40:29 AP
Thank you.

Run Fine.

All the best,
Otsikko: Re: Problem with javascript code
Kirjoitti: Forocv - helmikuu 14, 2005, 02:57:10 AP
Hello:

I implemented the code of Oldiesmann.

But I have a problem. All visits return one error log

Lainaa
8: Undefined index: HTTP_REFERER
Archivo: /web/htdocs/www.forocv.com/home/foro/Themes/classic/BoardIndex.template.php (eval?)
LĂ­nea: 101

This error full the error log.

The problem is that HTTP_REFERER is empty?

In php is possible to control this error?

Thank you
Otsikko: Re: Problem with javascript code
Kirjoitti: [Unknown] - helmikuu 14, 2005, 03:13:15 AP
Try using, instead:

$ref = urlencode(@$_SERVER['HTTP_REFERRER']);

-[Unknown]
Otsikko: Re: Problem with javascript code
Kirjoitti: Forocv - helmikuu 14, 2005, 05:49:07 AP
Thank you Unknown.