Fix #1354
This commit is contained in:
parent
2206316f45
commit
8e903b9e9b
|
@ -50,7 +50,7 @@ class m_authip {
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = array();
|
$r = array();
|
||||||
$db->query("SELECT * FROM authorised_ip WHERE uid='$cuid';");
|
$db->query("SELECT * FROM authorised_ip WHERE uid='$cuid' order by ip,subnet;");
|
||||||
while ($db->next_record()) {
|
while ($db->next_record()) {
|
||||||
$r[$db->f('id')]=$db->Record;
|
$r[$db->f('id')]=$db->Record;
|
||||||
if ( (checkip($db->f('ip')) && $db->f('subnet') == 32) ||
|
if ( (checkip($db->f('ip')) && $db->f('subnet') == 32) ||
|
||||||
|
@ -81,7 +81,7 @@ class m_authip {
|
||||||
while ($db->next_record()) {
|
while ($db->next_record()) {
|
||||||
$this->ip_affected_delete($db->f('id'));
|
$this->ip_affected_delete($db->f('id'));
|
||||||
}
|
}
|
||||||
if (! $db->query("delete from authorised_ip where id='$id' and uid='$cuid' limit 1;") ) {
|
if (! $db->query("delete from authorised_ip where id='$id' and ( uid='$cuid' or uid=0) limit 1;") ) {
|
||||||
echo "query failed: ".$db->Error;
|
echo "query failed: ".$db->Error;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,6 @@ class m_authip {
|
||||||
// Extract subnet from ipsub
|
// Extract subnet from ipsub
|
||||||
$tmp=explode('/',$ipsub);
|
$tmp=explode('/',$ipsub);
|
||||||
$ip=$tmp[0];
|
$ip=$tmp[0];
|
||||||
$subnet=intval($tmp[1]);
|
|
||||||
|
|
||||||
// Error if $ip not an IP
|
// Error if $ip not an IP
|
||||||
if ( ! checkip($ip) && ! checkipv6($ip) ) {
|
if ( ! checkip($ip) && ! checkipv6($ip) ) {
|
||||||
|
@ -187,7 +186,9 @@ class m_authip {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the subnet, if not defined, give a /32 or a /128
|
// Check the subnet, if not defined, give a /32 or a /128
|
||||||
if ( ! $subnet ) {
|
if (isset($tmp[1])) {
|
||||||
|
$subnet=intval($tmp[1]);
|
||||||
|
} else {
|
||||||
if ( checkip($ip) ) $subnet=32;
|
if ( checkip($ip) ) $subnet=32;
|
||||||
else $subnet=128;
|
else $subnet=128;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue