Advertisement:

Problem with javascript code

Aloittaja Forocv, helmikuu 08, 2005, 08:16:38 AP

« edellinen - seuraava »

Forocv

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="hxxp:www.forocv.com/cgi-bin/axs/ax.pl?mode=img&ref='); [nonactive]
   document.write( escape( document.referrer ) );
   document.write('" height="1" width="1" style="display:none" alt="" />');
// -->
</script><noscript>
   <img src="hxxp:www.forocv.com/cgi-bin/axs/ax.pl?mode=img [nonactive]" 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

Oldiesmann

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="" />';
Michael Eshom
Christian Metal Fans

Forocv


Forocv

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

[Unknown]

Try using, instead:

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

-[Unknown]

Forocv


Advertisement: