What is wrong about my code?
Posted: Tue Mar 23, 2010 10:03 am
I am trying to write a php code with IP's so that my server will let me connected on my admin if and only if my IP's are the same as in my codes. Here is the code i am using:
<?php
// only local requests
if ($_SERVER['REMOTE_ADDR'] !== '99.19.32.053' || $_SERVER['REMOTE_ADDR'] !== '99.19.32.053' ) die(header("Location: /"));
?>
When I use the above php code with one IP, it works fine but when i use the below, adding an additional ip, it gives me the error
<?php
// only local requests
if ($_SERVER['REMOTE_ADDR'] !== '99.19.32.053','99.104.10.003' || $_SERVER['REMOTE_ADDR'] !== '99.19.32.053','99.104.10.003' ) die(header("Location: /"));
?>
error given:
Parse error: syntax error, unexpected ',' in /home01/maliqu/public_html/admin/home.php on line 24
So how can i correct my code to have it works from 2 different ip's locations?
<?php
// only local requests
if ($_SERVER['REMOTE_ADDR'] !== '99.19.32.053' || $_SERVER['REMOTE_ADDR'] !== '99.19.32.053' ) die(header("Location: /"));
?>
When I use the above php code with one IP, it works fine but when i use the below, adding an additional ip, it gives me the error
<?php
// only local requests
if ($_SERVER['REMOTE_ADDR'] !== '99.19.32.053','99.104.10.003' || $_SERVER['REMOTE_ADDR'] !== '99.19.32.053','99.104.10.003' ) die(header("Location: /"));
?>
error given:
Parse error: syntax error, unexpected ',' in /home01/maliqu/public_html/admin/home.php on line 24
So how can i correct my code to have it works from 2 different ip's locations?