Mary: Browsererkennung und Weiterleitung...

Beitrag lesen

ich suche ein Script, welches den Browser erkennt und dann bei Übereinstimmung (oder Nichtübereinstimmung) auf eine andere Seite weiterleitet.

Hi, das hier funktioniert ganz gut:

<?php

/////////////////////////////////////
// Browser-Weiche
// (c) 2001, 2002
// =================================
// Stephan Baehr
// http://www.e-workers.de/index.php
// und
// Olaf Gleba
// http://www.creatics.de/
// und
// Ralph G. Schulz
// http://barrierefrei.e-workers.de/
// ==================================
// Free 4 All, but please leave this
// copyright-notice intact. Thanx!
/////////////////////////////////////
//Leicht Veränderte Version/

$browser = getenv("HTTP_USER_AGENT");
// Browser mit eindeutiger Anmeldung

// IE6
if (preg_match("/MSIE 6.+Win./", $browser)) {
header("Location: http://localhost/first.php");
exit;
}

// IE3
if (preg_match("/MSIE 3.+Win./", $browser)) {
header("Location: http://localhost/first.php");
exit;
}

// IE4
if (preg_match("/MSIE 4.+Win./", $browser)) {
header("Location: http://localhost/first.php");
exit;
}

// IE5
if (preg_match("/MSIE 5.+Win./", $browser)) {
header("Location: http://localhost/first.php");
exit;
}

// Op6
if (preg_match("/Opera\/6./", $browser)) {
header("Location: http://localhost/first2.php");
exit;
}
// Op7
if (preg_match("/Opera\/7./", $browser)) {
header("Location: http://localhost/ew/first2.php");
exit;
}
// Op4
if (preg_match("/Opera\/4./", $browser)) {
header("Location: http://localhost/first2.php");
exit;
}
// Op5
if (preg_match("/Opera\/5./", $browser)) {
header("Location: http://localhost/first2.php");
exit;
}
// NN4
if ((preg_match("/Mozilla\/4.+Win./", $browser)) && (!isset($client))) {
header("Location: http://localhost/ersatz.html");
exit;
}
// NN4
if ((preg_match("/Mozilla\/4.+Mac./", $browser)) && (!isset($client))) {
header("Location: http://localhost/ersatz.html");
exit;
}

// IE2 Win
if (preg_match("/MSIE 2.+Win./", $browser)) {
header("Location: http://localhost/first.php"); //hier jeweils die absolute URI eingeben
exit;
}
// NN3 Win
if ((preg_match("/Mozilla\/3.+Win./", $browser)) && (!isset($client))) {
header("Location: http://localhost/ersatz.html");
exit;
}

// NN3 Macintosh
if ((preg_match("/Mozilla\/3.+Mac./", $browser)) && (!isset($client))) {
header("Location: http://localhost/ersatz.html");
exit;
}
?>

Mußt natürlich die Pfade mit eignen ersetzen, war zu faul das rauszunehmen.*g*

Gruß Mary