From: Domas Mituzas Date: Fri, 11 Jun 2004 15:16:00 +0000 (+0000) Subject: don't use OR on empty variables X-Git-Tag: 1.5.0alpha1~2916 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=27fda7446fa3c9abf0b3ff462cf9aa6cf91abf6e;p=lhc%2Fweb%2Fwiklou.git don't use OR on empty variables --- diff --git a/includes/Block.php b/includes/Block.php index c830ccdc45..e8a53e0efd 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -43,13 +43,17 @@ class Block } # Get a ban from the DB, with either the given address or the given username - function load( $address, $user = 0, $killExpired = true ) + function load( $address = "", $user = 0, $killExpired = true ) { $fname = 'Block::load'; $ret = false; $killed = false; - if ( 0 == $user ) { + if ( 0 == $user && $address=="" ) { + $sql = "SELECT * from ipblocks"; + } elseif ($address=="") { + $sql = "SELECT * FROM ipblocks WHERE ipb_user={$user}"; + } elseif ($user=="") { $sql = "SELECT * FROM ipblocks WHERE ipb_address='" . wfStrencode( $address ) . "'"; } else { $sql = "SELECT * FROM ipblocks WHERE (ipb_address='" . wfStrencode( $address ) .