Function um Browser und OS aus $REMOTE_ADDR zu bestimmen
Nicola
- php
Hallo Ihr,
kennt von Euch jemand eine wirklich brauchbare Function/Class mit der ich aus $REMOTE_ADDR den Browser und das OS herausbekomme?
Habe ein Loggin-Script, dass mir die $REMOTE_ADDR in einer datenbank speichert - diese würde ich gerne auswerten ... habe versucht selbst was zu basteln, aber da muss ich ja tausend Möglichkeiten berücksichtigen - wenns von Linux kommt, wenns ein bot ist, usw. ...
Vielen Dank,
Eure Nicola
Moin!
kennt von Euch jemand eine wirklich brauchbare Function/Class mit der ich aus $REMOTE_ADDR den Browser und das OS herausbekomme?
In $REMOTE_ADDR steht doch gar nichts drin. Und in $_SERVER['REMOTE_ADDR'] steht nur die IP-Adresse des zugreifenden Computers (das muß nicht mal der tatsächliche Rechner sein, auf dem der Browser läuft) drin. Was willst du aus dieser Angabe raten?
- Sven Rautenberg
Hallo und sorry,
meinte natürlich getenv("HTTP_USER_AGENT") ...
Und dafür suche ich eben eine Function/Class, die mir den Browser (evtl. die Version) und das Betriebssystem herausfischt ...
Ja ich wieß, dass es keine 100% Lösung gibt, da man z.B. im Opera das Ganze manipulieren kann ... aber für den normalen User würde es doch funktionieren ...
1000x Danke,
Nicola
Hallo nochmal,
versuche es z.Zt. so
<?
$useragent = getenv("HTTP_USER_AGENT");
//Browser
if(eregi("(opera) ([0-9]{1,2}.[0-9]{1,3}){0,1}", $useragent, $regs) || eregi("(opera/)([0-9]{1,2}.[0-9]{1,3}){0,1}", $useragent, $regs)) $browser = "Opera $regs[2]";
elseif(eregi("(msie) ([0-9]{1,2}.[0-9]{1,3})", $useragent, $regs)) $browser = "MSIE $regs[2]";
elseif(eregi("(konqueror)/([0-9]{1,2}.[0-9]{1,3})", $useragent, $regs)) $browser = "Konqueror $regs[2]";
elseif(eregi("(lynx)/([0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2})", $useragent, $regs)) $browser = "Lynx $regs[2]";
elseif(eregi("(netscape6)/(6.[0-9]{1,3})", $useragent, $regs)) $browser = "Netscape $regs[2]";
elseif(eregi("(netscape)/(7.[0-9]{1,3})", $useragent, $regs)) $browser = "Netscape $regs[2]";
elseif(eregi("(mozilla)/(4.[0-9]{1,3})", $useragent, $regs)) $browser = "Communicator $regs[2]";
elseif(eregi("w3m", $useragent)) $browser = "w3m";
else $browser = "unbekannt";
//Betriebsystem
if(ereg("Windows", $useragent)) $osystem = "Windows";
elseif((ereg("Mac", $useragent)) || (ereg("PPC", $HTTP_USER_AGENT))) $osystem = "Mac";
elseif(ereg("Linux", $useragent)) $osystem = "Linux";
else $osystem = "Other";
echo $useragent;
echo "<br>";
echo "<b>Browser:</b> ".$browser;
echo "<br>";
echo "<b>OS:</b> ".$osystem;
?>
Allerdings bekomme ich da nicht heraus, um welche z.B. Windows-Version oder Linux-Version oder Mac-Version es sich handelt ... und was mache ich mit Bots?
Nochmal Danke,
Nicola
if(eregi("(opera) ([0-9]{1,2}.[0-9]{1,3}){0,1}", $useragent,
Allerdings bekomme ich da nicht heraus, um welche z.B. Windows-Version oder Linux-Version oder Mac-Version es sich handelt ... und was mache ich mit Bots?
Vielleicht sammelst Du einfach mal ein paar Tage oder Wochen die Daten aus User-Agent und schaust Dir an, was da so alles auftaucht. In etwa so (bei den Leerzeilen willkürlich gekürzt):
Aberja Checkomat
Advanced Browser (http://www.avantbrowser.com)
appie 1.1 (www.walhello.com)
Avant Browser (http://www.avantbrowser.com)
B+l+i+t+z+B+O+T+@+t+r+i+c+u+s+.+c+o+m (Mozilla compatible)
BlackBerry7230/3.7.1
BlackBerry7230/3.7.1 UP.Link/5.1.2.10
Cafi/1.02 (OSIX; 128-bit)
Der Bot aus Poppelsdorf (http://www.linkchecker.avaris-webdesign.de)
Enter new UA String or choose a common one. Then press ENTER
FavOrg
Gigabot/2.0
GoForIt.com
Googlebot/2.1 (+http://www.google.com/bot.html)
HeinrichderMiragoRobot (http://www.miragorobot.com/scripts/deinfo.asp)
ia_archiver
IE 5.5 Compatible Browser
Iltrovatore-Setaccio/1.2 (It-bot; http://www.iltrovatore.it/bot.html; info@iltro
IP*Works! V5 HTTP/S Component - by /n software - www.nsoftware.com
Java/1.4.1_02
Java/1.4.2_05
Java/1.5.0
larbin-mb (larbin-mb@dont.mail.me)
larbin-mb larbin-mb@dont.mail.me
libwww-perl/5.65
libwww-perl/5.76
Links SQL (http://gossamer-threads.com/scripts/links-sql/)
Mediapartners-Google/2.1
Microsoft Data Access Internet Publishing Provider Protocol Discovery
MJ12bot/v0.5.0 (http://www.majestic12.co.uk/projects/dsearch/mj12bot.php) run by
Mozilla/2.0 (compatible; Ask Jeeves/Teoma)
Mozilla/2.0 (compatible; MS FrontPage 5.0)
Mozilla/2.0 (compatible; MSIE 3.02; Update a; AK; AOL 4.0; Windows 95)
Mozilla/2.0 (compatible; MSIE 3.0; Windows 95)
Mozilla/3.0 (compatible)
Mozilla/3.0 (compatible; Indy Library)
Mozilla/3.0 (compatible; MSIE 3.01; Mac_PowerPC)
Mozilla/3.01 (compatible; NPT 0.0 beta)
Mozilla/3.01 (compatible;)
Mozilla/4.0
Mozilla/4.0 (0000000000; 0000 0000; 00000000000)
Mozilla/4.0 (compatible; BorderManager 3.0)
Mozilla/4.0 (compatible; Cerberian Drtrs Version-3.1-Build-16)
Mozilla/4.0 (compatible; Cerberian Drtrs Version-3.1-Build-17)
Mozilla/4.0 (compatible; grub-client-2.3)
Mozilla/4.0 (compatible; Lotus-Notes/6.0; Windows-NT)
Mozilla/4.0 (compatible; MSIE 4.01; AOL 4.0; Windows 98)
Mozilla/4.0 (compatible; MSIE 4.01; AOL 5.0; Mac_PPC)
Mozilla/4.0 (compatible; MSIE 4.01; AOL 7.0; Windows 95)
Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)
Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
Mozilla/4.0 (compatible; MSIE 4.0; Windows 95)
Mozilla/4.0 (compatible; MSIE 4.5; Mac_PowerPC)
Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)
Mozilla/4.0 (compatible; MSIE 5.01; AOL 5.0; Windows NT)
Mozilla/4.0 (compatible; MSIE 5.01; AOL 8.0; Windows NT 5.0)
Mozilla/4.0 (compatible; MSIE 5.01; Windows 95)
Mozilla/4.0 (compatible; MSIE 5.01; Windows 95; DT)
Mozilla/4.0 (compatible; MSIE 5.01; Windows 95; pi 3.0.0.0)
Mozilla/4.0 (compatible; MSIE 5.0; AOL 5.0; Windows 95; DigExt)
Mozilla/4.0 (compatible; MSIE 5.0; AOL 5.0; Windows 98; DigExt)
Mozilla/4.0 (compatible; MSIE 5.0; Linux 2.4.18doc i586) Opera 6.0 [en]
Mozilla/4.0 (compatible; MSIE 5.0; Linux) Opera 5.0 [en]
Mozilla/4.0 (compatible; MSIE 5.0; Linux) Opera 6.03 [de]
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.21 [en]
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; 1&1 Internet AG)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; BCD2000)
Mozilla/4.03 [de] (Win95; I)
Mozilla/4.05 (Macintosh; I; PPC)
Mozilla/5.0 (compatible; Konqueror/3.2; Linux 2.4.27; X11) (KHTML, like Gecko)
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040530 Debian/1.6-6.back
Opera/7.22 (Windows NT 5.0; U) [de]
PEERbot www.peerbot.com
PHP version tracker
PHP/4.2.2
pipeLiner/0.3a (PipeLine Spider; http://www.pipeline-search.com/webmaster.html;
Plucker/Py-@@VERSION@@
psbot/0.1 (+http://www.picsearch.com/bot.html)
Seekbot/1.0 (http://www.seekbot.net/bot.html) HTTPFetcher/0.3
Seekbot/1.0 (http://www.seekbot.net/bot.html) RobotsTxtFetcher/1.1
SlimBrowser
SpurlBot/0.2
T-Online Browser
TSM-100v/42190013 Browser/1.2.1 Profile/MIDP-1.0 Configuration/CLDC-1.0 UP.Link/
TurnitinBot/2.0 (http://www.turnitin.com/robot/crawlerinfo.html)
TurnitinBot/2.0 http://www.turnitin.com/robot/crawlerinfo.html
UP.Browser/6.1.0.1.140 (Google CHTML Proxy/1.0)
User-Agent: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
uû¿v
W3C_Validator/1.305.2.148 libwww-perl/5.800
Wget/1.5.3
Wget/1.7
Wget/1.9.1
Witzbold 08/15
www.adressendeutschland.de
www.mtel.com
Xenu Link Sleuth 1.2e
Yahoo-MMCrawler/3.x (mms dash mmcrawler dash support at yahoo dash inc dot com)
ZipppBot/0.11 (ZipppBot; http://www.zippp.net; webmaster@zippp.net)
hi,
kennt von Euch jemand eine wirklich brauchbare Function/Class mit der ich aus $REMOTE_ADDR den Browser und das OS herausbekomme?
meine schuhgröße ist 46. leite bitte daraus her, welche haarfarbe ich habe, und welches mein lieblingsessen ist.
Habe ein Loggin-Script, dass mir die $REMOTE_ADDR in einer datenbank speichert - diese würde ich gerne auswerten ... habe versucht selbst was zu basteln, aber da muss ich ja tausend Möglichkeiten berücksichtigen - wenns von Linux kommt, wenns ein bot ist, usw. ...
REMOTE_ADDR ist die IP, über die die anfrage hereinkommt. wie du daraus auf _irgendetwas_ clientseitig vorhandenes schließen willst, ist mir schleierhaft.
gruß,
wahsaga