[RESOLVED] Warning: Wrong parameter count for in_array() in...
I'm getting this error on my page counter: Warning: Wrong parameter count for in_array() in... on line 14.
Here's the code:
PHP Code:
$user_agents = getenv('HTTP_USER_AGENT');
$losers = array(
'Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)',
'Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
'Mozilla/5.0 (compatible; AhrefsBot/4.0; +http://ahrefs.com/robot/)',
'Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)',
'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
'Wotbox/2.01 (+http://www.wotbox.com/bot/)',
'TurnitinBot/2.1 (http://www.turnitin.com/robot/crawlerinfo.html)',
'Mozilla/5.0 (compatible; Ezooms/1.0; ezooms.bot@gmail.com)'
);
if (!in_array($user_agents))
{
session_start();
// global $counter;
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
if (!isset($_SESSION['countme']))
{
$_SESSION['countme']="set";
$sql="SELECT * FROM count";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$count = $row['value'];
$newcount = $count + 1;
$sql="UPDATE count SET value='$newcount'";
$result = mysql_query($sql);
}
}
This is line 14:
PHP Code:
if (!in_array($user_agents))
I don't think the counter is working right either. Any help will be appreciated.