I realize ist not sophisticated but quite straight forward...
adding the following in a php file or function:
QUOTE
if (!check_ip($admin_info, $_SERVER['REMOTE_ADDR'])) {
echo "You are not allowed in here !";
exit(0);
}
echo "You are not allowed in here !";
exit(0);
}
The check function:
QUOTE
function check_ip(&$ip_addresses, $valid_ip) {
$valid = false;
$i = 0;
$address = count($ip_addresses);
while (($i<$address) && (!$valid)) {
$valid = ($ip_addresses[$i]['ip'] == $valid_ip);
$i++;
}
return $valid;
}
$valid = false;
$i = 0;
$address = count($ip_addresses);
while (($i<$address) && (!$valid)) {
$valid = ($ip_addresses[$i]['ip'] == $valid_ip);
$i++;
}
return $valid;
}
And some addresses of course:
QUOTE
$admin_info[0]['ip'] = '155.155.155.155';
$admin_info[0]['name'] = 'Myname';
$admin_info[0]['name'] = 'Myname';
The IP addesses are stored in a config.php file that is included in a acp.php file in which the admin functions are implemented.
I do not need a members data base I just want that some functions are only accessable for myself or 1-2 other admins... It works for me but is it a smart way to go? Of course I can make mistakes in the implementation but the main question is, is it safe when I only allow access based on IP addresses?