Forum Moderators: coopster
I'm having some troubles with this php script.
Basicly I have a browser logger. It works perfectly, but when an unrecognized browser comes to the site, the rest of the script doesn't work below the else { .. } value. after the else value, I have a mysql query to insert the browser into my mysql db, and it doesn't insert if the browser is unknown. here's how the script looks
****************** // Firefox elseif(eregi("Firefox", $user_agent)){ elseif(eregi("safari", $user_agent)){ // more browsers else { ... mysql query to insert data here ... thanks [1][edited by: CodilX at 4:38 pm (utc) on June 13, 2007]
// Opera
if (eregi("opera",$user_agent)){
$brower="Opera"
$version=$val;
}
$brower="Mozilla Firefox"
$version=$val[1];
}
// Safari
$browser = "Safari";
$version = "";
}
$browser_name = "Unknown";
$version = "";
}
******************
2. it dies after the else { .. }
3. no I don't have a die statement, here's how it looks :
$sql_insert="INSERT INTO visits values('','".$date."',,'".$ip."','".$browser."','".$referer."','".$rules."');";
mysql_query($sql_insert, $dbconnect);
mysql_query($sql_insert, $dbconnect) or die(mysql_error());