function block_url($code, $url, $reason, $ip) { global $mydb; $table = DB_SPAM_TABLE; $result = false; if (code_exists($code)) { if (strcmp($url, get_url($code)) == 0) { delete_code($code); } } if (code_spam_exists($code)) { return true; } $result = $mydb->query("INSERT INTO `{$table}` (code, url, reason, ip, date) VALUES ('{$code}', '{$url}', '{$reason}', '{$ip}', NOW())"); return $result; }
function do_delete($code) { if (delete_code($code)) { echo "Code has been deleted."; } }