Topic awaiting preservation: PHP/MySQL Code Check... |
|
---|---|
Author | Thread |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 10-07-2001 06:32
This code is suposed to grab the host and then store it in the database if there is no listing of it yet. And increment hits if it is listed. This is used when I am checking which parked domain names are delivering the most hits to the site. code: <? |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 10-07-2001 10:27
The following code should work (I haven't tested it, because I don't have time): |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 10-08-2001 16:57
The code you sugest should make my result resemble: code: $database = "****";
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 10-08-2001 17:09
Oops... code: <? |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 10-08-2001 19:14
Ahhhhhhhhhhhhhh, I didn't see 'id' field (and therefore my code won't work correctly). Anyway, IMHO You don't need 'id' filed at all... This is how I would do this (I've tested this and it works fine): |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 10-08-2001 20:37
Here is a problem. |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 10-08-2001 20:51
The last version of my script from above works fine. I have tested it locally and it worked without problems. I even added two bogus domains like you said - with www.x.com and www.y.com that point to the same server. After that I've called the script from both domains (i.e. www.x.com/log.php & www.y.com/log.php ) and domains were added to the database. When I tried to access them again counter was incremented correctly (duplicate entry wasn't created). So, I really don't know what's wrong in your case. Did you include the script in all your pages? Also, did you modify SQL table according to SQL scheme that I posted above? |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 10-09-2001 00:26
I am running it simply on the index.php page. |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 10-09-2001 00:47
If it increments main domain counter when you access parked domain, then something is probably wrong with HTTP_HOST variable (it is probably set to the same value). You can easily check this by doing an "echo $HTTP_HOST" from both domains... |