Reputation: 165
i am tracking the users at my site through php and mysql but the bot is creating problem .more than users bot are available at my site and i want to enter only real users ip address not bot ip address. i know few ip address of google which starts from 66.249 like that ip address from bing also start from somthing like that.but for several other search engine bot like yandex baidu and others i cant predict the ip address. i have thought of using if else statment to do so. for example if
$ip=='66.249'
{do nothing}
else {
insert into database
}
but i am thinking if there is something which can identify bot easily and i can use something like that
if
useragent=='bot'
{
do nothing
}
else
{
insert into database
}
please suggest anything
Upvotes: 1
Views: 540
Reputation: 5196
You should check for $_SERVER['HTTP_USER_AGENT'
] in php . Humans will be having values like Mozilla etc.
Upvotes: 1