Web Hosting Forum | Lunarpages
News: April 3, 2008 - New Contest! - Win 5 Years of Hosting and $1,000!
May 5, 2008 - May 08 Web Site of the Month? - Submit your LINKS!!!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 16, 2008, 08:38:33 AM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: Help with logging incoming affiliate url's ?  (Read 522 times)
Speed_Brown
Newbie
*
Offline Offline

Posts: 1


« on: May 06, 2008, 06:58:17 PM »

Hi,

My situation is as follows, thanks for any help you can give.

I need to log individual affiliate urls coming into my site. My link affiliate will send traffic to me, each with a unique url eg. ' http://www.my-site.com/?pubid=#PUBLISHER_ID ' where 'PUBLISHER_ID' is a unique number like '12345'. I need to save each incoming URL  presumably in a MYSQL database where i can use php to print it out.

Anyone know the best way to achieve logging unique incoming URL'S?

-Steve
 
Logged
MrPhil
Über Jedi
*****
Offline Offline

Posts: 2825


« Reply #1 on: May 06, 2008, 09:33:28 PM »

Well, as an overview, your /index.php would have the code

$pubid = $_REQUEST['pubid'];

to capture the affiliate ID. Are you also looking for other information to capture? Then if you want to log this ID by saving it in a database,

$result = mysql_query("INSERT INTO tablename (affiliate_ID) VALUES ('$pubid');");

would log every single occurrence. (Of course, that isn't the full code, but just the heart of it.) My SQL book isn't at hand, but you might be able to add a keyword such as UNIQUE to prevent duplicates. Or, you could first do a query to see if that ID is already in the database, and INSERT it only if it's not. Presumably you'd want to save more information than just the affiliate ID, such as a timestamp or a count of hits or the incoming IP address.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM