Hallo Patrick,
Grund sind folgende UA-Strings (nach den besuchten Seiten zu urteilen, handelt es sich um Spammer):
Typ 1: Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1)
Typ 2: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 7.0; Win32; 1&1); .NET CLR 2.0.50727; IEMB3; IEMB3)
Typ 3: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
Typ 4: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; http://bsalsa.com)
Typ 5: User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)
Wie man sieht, steht immer eine Klammer "(" vor "compatible".
Ich möchte nun diese beknackten UAs immer der im UA-String zuerst vorkommenden Browserversion zuordnen, beim oben genannten Typ 1 soll ein MSIE 6 gezählt werden, bei Typ 3 ein MSIE 7.
Die zuerst vorkommende Browserversion steht immer direkt nach der ersten Klammer "(".
Also muss man eigentlich nur sicherstellen, dass immer die erste Klammer im RegExp matcht, gefolgt von dem, was man sonst noch matchen will.
Also:
$allIE++ if (/[^(]+?(compatible; MSIE / && !/Opera/);
$anzahlIE3++ if (/[^(]+?(compatible; MSIE 3/ && !/Opera/);
$anzahlIE4++ if (/[^(]+?(compatible; MSIE 4/ && !/Opera/);
$anzahlIE5++ if (/[^(]+?(compatible; MSIE 5/ && !/Opera/);
$anzahlIE6++ if (/[^(]+?(compatible; MSIE 6/ && !/Opera/);
$anzahlIE7++ if (/[^(]+?(compatible; MSIE 7/ && !/Opera/);
Das sollte m.E. den Anforderungen genügen.
Gruß, Don P