74487
Mar 19, 2009, updated at 11:19:28 (UTC)
4894
1
0
IP-Netz erkennen und auf bestimmte Seite weiterleiten
Hallo,
ich suche eine Lösung für folgene Sache:
Eine Startseite die die IP überprüft.
Wenn IP = 192.168.1.x gehe zu Seite1
Wenn IP = 192.168.2.x gehe zu Seite2
usw.
Die IF-Abfragen usw. sind kein Problem. Was ich suche ist das die letzte Zahl (also hier das X) egal ist (also 1,2,4,6,3,6,4,5,. ... usw.).
Über schnelle Antworten würde ich mich freuen.
MfG, Notzke
ich suche eine Lösung für folgene Sache:
Eine Startseite die die IP überprüft.
Wenn IP = 192.168.1.x gehe zu Seite1
Wenn IP = 192.168.2.x gehe zu Seite2
usw.
Die IF-Abfragen usw. sind kein Problem. Was ich suche ist das die letzte Zahl (also hier das X) egal ist (also 1,2,4,6,3,6,4,5,. ... usw.).
Über schnelle Antworten würde ich mich freuen.
MfG, Notzke
Please also mark the comments that contributed to the solution of the article
Content-Key: 111859
Url: https://administrator.de/contentid/111859
Printed on: April 26, 2024 at 14:04 o'clock
1 Comment
if(!preg_match("/^192\.168\.(\d+)\..*$/iD",$_SERVER['REMOTE_ADDR'],$matches))
die("not an allowed ip address");
switch(intval($matches[1])) {
case 1:
$newloc = "http://a.com";
break;
case 2:
$newloc = "http://b.com";
break;
default:
$newloc = "http://notfound.com";
}
header("Location: ".$newloc);
exit(0);
Grüße
Max