Page 1 of 1

Session data & adsense. Strange situation

Posted: Sun Aug 26, 2007 12:04 am
by julian_lp
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I'm trying to figure out why google adsense doesn't modify the session data, even though it asks my site after every load

Let me explain it in more detail:

Lets say I have a page called 1.php, and in this page, I add the following code:

Code: Select all

$ip_stats = $_SERVER['REMOTE_ADDR'];
	$sql = 'INSERT INTO stats (ip_stats,) ';
	$sql .= "VALUES ('$ip_stats')";
	$result = mysql_query($sql);
Now I ask the page w ww. whatever. com/1.php (wich has adsense code on it) and then I go to the mysql table and what I get is:

66.249.70.198
66.249.70.198
xxx.xxx.5.67

The first 2 ip's are known google ip's, whereas the third one is mine (or eventually the client's asking ip). This pattern repeats itself over and over


BUT, if I add this code:

Code: Select all

if (isset($_SESSION['ip_has_visited'])){
		$_SESSION['ip_has_visited']++;		  
	}else{
		$_SESSION['ip_has_visited'] = 1;		  	  
	}

	if ($_SESSION['ip_has_visited']>20){
		$ip_stats = 'This ip has visited my site '.$_SESSION['ip_has_visited'].' times: '.$ip_stats;		
		$sql = 'INSERT INTO stats (ip_stats,) ';
		$sql .= "VALUES ('$ip_stats')";
		$result = mysql_query($sql);

	}
I never get a single entry by google's Ips, in this case 66.249.70.198 (I do get record of people asking my site more than 20 times), I just cant understand why, It's just in front of my nose and I cant figure out what's going on.
Anyone can tell me what's happening?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sun Aug 26, 2007 12:39 am
by volka
My bets are on "google does not send the session cookie back".

Posted: Sun Aug 26, 2007 2:06 pm
by julian_lp
volka wrote:My bets are on "google does not send the session cookie back".
Absolutely correct, now I don't check against session's vars anymore and I am able to filter google asks. It was just in front of my nose as I said, but I couldn't see it :)
Thanks Volka