...

View Full Version : $_GET + MySQL [Visitors/Referred]



Blockis
02-02-2010, 09:13 PM
OK. Pretty much I am looking for a tutorial on taking a variable in the browser, (EX: google.com?r=123) and adding 1 (Yes, like the number) to 123's referral count. If anyone can direct me on how to do that, that'd be wonderful :)

ALSO, is there a way where we can do it with a line of code simply like:

$referrals[123] = ++;
Or something? So the user has to do something for it to go up?

Blockis

angst
02-02-2010, 09:17 PM
yes, you can use HTTP_REFERER:



$_SERVER['HTTP_REFERER'];


then you'll need to parse the query string to get the data, at that point you should be able to increment the number like:


$value++;

Fumigator
02-02-2010, 09:18 PM
It's as easy as $_GET['r']++. Now, if you want that new number to show up in the URL, you'll need to reload the page. You can do this with a header("Location:URL"), but you'll need to format the query string yourself. You can also use a form with method="GET", then use a hidden input element to handle the the new number.

angst
02-02-2010, 09:30 PM
ah, thanks for the spam.......

( does this ever actually work? )

Fumigator
02-02-2010, 09:37 PM
We're now engaged.

angst
02-02-2010, 09:38 PM
sweet! if only I had clicked sooner! ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum