special front page from certain IP’s in php

This is trivial I know, but I needed to store the code as I don't use it anymore...

$page                   = $_REQUEST['page'];
if ($page == '') {
/*
        kode for at sætte specifik forside for specifikke IP'er
*/
        $this_ip = split("\.", $_SERVER["REMOTE_ADDR"]);
        if (
                (
                        $this_ip[0] == "10" &&
                        $this_ip[1] == "2" &&
                        $this_ip[2] == "1" &&
                        (
                                (
                                        $this_ip[3] <= "70" &&
                                        $this_ip[3] >= "60"
                                ) ||
                                $this_ip[3] == "10"
                        )
                ) || (
                        $this_ip[0] == "212" &&
                        $this_ip[1] == "242" &&
                        $this_ip[2] == "248" &&
                        $this_ip[3] == "84"
                )
        ) {
                $page = 'lan';
        } else {
                $page = 'main';
        }
}
Dette indlæg blev udgivet i Knowledge Base, PHP, Programmering. Bogmærk permalinket.

Skriv et svar