Skip to content

Commit

Permalink
fix(tracker): 修复未汇报IPv4时也检查IP是否被禁,导致报错的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tongyifan committed Aug 8, 2019
1 parent e48a4c1 commit d2245e1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions announce.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,17 @@
$ipv4 = $ip;
}

// check banned IPv4 address
$nip = ip2long($ipv4);
$res = sql_query("SELECT * FROM bans WHERE $nip >= first AND $nip <= last") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0) err("403-该IP被封禁,请与{$REPORTMAIL}联系!");
if (isset($ipv4)) {
$nip = ip2long($ipv4);
// check banned IPv4 address
$res = sql_query("SELECT * FROM bans WHERE $nip >= first AND $nip <= last") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0) err("403-该IP被封禁,请与{$REPORTMAIL}联系!");

// warn the user who enables `public4` in campus
if (check_tjuip($nip) && $az['enablepublic4'] == 'yes' && $az['showtjuipnotice'] == 'no')
sql_query("UPDATE users SET showtjuipnotice = 'yes' WHERE id = " . sqlesc($az['id']));
if (check_tjuip($nip) && $az['enablepublic4'] == 'yes' && $az['showtjuipnotice'] == 'no')
sql_query("UPDATE users SET showtjuipnotice = 'yes' WHERE id = " . sqlesc($az['id']));

}

// check banned IPv6 address
if (isset ($ipv6)) {
Expand Down

0 comments on commit d2245e1

Please sign in to comment.