I would love to get this working but can't I have tried many things
I have ip_list.txt with my IP in it
I have the login_pre.sh file chmod 775
When I put file in directory i try to log in and page refreshes I delete file and lg in and check log and I get i see Invalid IP
i have narrowed it down to the code not reading IP's from the ip_list.txt
I have tried many ways like array_search and !== false statements but no luck
Need ideas please
I have ip_list.txt with my IP in it
I have the login_pre.sh file chmod 775
When I put file in directory i try to log in and page refreshes I delete file and lg in and check log and I get i see Invalid IP
i have narrowed it down to the code not reading IP's from the ip_list.txt
I have tried many ways like array_search and !== false statements but no luck
Need ideas please
Code:
#!/usr/local/bin/php
<?php
$user = getenv('username');
$ip = getenv('ip');
$ip_list = "/usr/local/directadmin/scripts/custom/ip_list.txt";
if ($user == 'demo_user' || $user == 'demo_reseller' || $user == 'demo_admin')
{
//not worried about demos
exit(0);
}
$lines = file($ip_list);
foreach ($lines as $ip_val)
{
if ($ip == $ip_val)
{
exit(0);
}
}
echo "Invalid IP";
exit(1);
?>