Jump to content

website tracking code problem


daveyedgar

Recommended Posts

I get this error, I think my code needs some cleaning but I can't figure out where the issue is.

 

 

Parse error: syntax error, unexpected T_STRING in /home/user/public_html/mydomain.com/tracking.php on line 12

 

 

*********code*************

<?php

//connecting to the database we setup

DEFINE('DB_HOST','localhost');

DEFINE('DB_USER','username');

DEFINE('DB_PASS','password');

 

DEFINE('DB_PRIMARY','mydatabase');

 

mysql_connect(DB_HOST,DB_USER,DB_PASS);

mysql_select_db(DB_PRIMARY);

 

// Server variables

$ip = $_SERVER['REMOTE_ADDR'];

$referer = $_SERVER['HTTP_REFERER'];

$useragent = $_SERVER['HTTP_USER_AGENT'];

 

// capturing data we passed in the url

//ie. http://domain.com/page.php?k=my+keyword&s=yahoo

// I've added the engine the click is coming from as

// I'm starting to branch out to other engines now

$keyword = mysql_real_escape_string($keyword);

$source = mysql_real_escape_string($source);

 

$sql = "INSERT INTO clicks (keyword, source, ip, referer, useragent, time, site) VALUES ('$keyword','$source','$ip','$referer','$useragent',NOW(),'$site')";

mysql_query($sql);

 

$id = mysql_insert_id();

 

?>

 

*************** end code ************

 

******* code on index page ******

<?php

$site=$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

include('../../tracking.php');

?>

<a href="http://hop.clickbank.net/?tid=<;? echo $id; ?>">link</a>

 

*************** end code *************

 

 

Thanks a million in advance :)

Link to comment
https://forums.phpfreaks.com/topic/192784-website-tracking-code-problem/
Share on other sites

The only error I see is in your index page

<a href="http://hop.clickbank.net/?tid=<;? echo $id; ?>">link</a>

the php has a semicolon that is not needed.

<a href="http://hop.clickbank.net/?tid=<?=$id; ?>">link</a>

 

 

HTH

Teamatomic

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.