bindValue(':ip', $mask); $query->bindValue(':mod', $mod['id']); $query->bindValue(':time', time()); if ($reason !== '') { markup($reason); $query->bindValue(':reason', $reason); } else $query->bindValue(':reason', null, PDO::PARAM_NULL); if ($length > 0) $query->bindValue(':expires', $length); else $query->bindValue(':expires', null, PDO::PARAM_NULL); if ($board) $query->bindValue(':board', $board); else $query->bindValue(':board', null, PDO::PARAM_NULL); $query->execute() or error(db_error($query)); modLog('Created a new ban (#' . $pdo->lastInsertId() . ') for ' . utf8tohtml($mask) . ' with ' . ($reason ? 'reason: ' . utf8tohtml($reason) . '' : 'no reason')); } function unban($id) { // TODO: permissions $query = prepare("DELETE FROM `bans` WHERE `id` = :id"); $query->bindValue(':id', $id); $query->execute() or error(db_error($query)); modLog("Removed ban #{$id}"); }