function add_log($type, $table, $affected_id, $data, $query = "", $error = "") { if (!$this->log) { return; } global $main; $date = "'" . date_now() . "'"; $user_type = "'" . $main->userdata->user_type . "'"; $user_id = $main->userdata->user_id; $type = "'" . $type . "'"; $ip = "'" . get_ip() . "'"; $dns = "'" . get_dns() . "'"; $table = "'" . $table . "'"; if ($user_type == "''") { return; } if ($data == '') { $data = 'NULL'; } else { $data = "'" . addslashes($data) . "'"; } if ($query == '') { $query = 'NULL'; } else { $query = "'" . addslashes($query) . "'"; } if ($error == '') { $error = 'NULL'; } else { $error = "'" . addslashes($error) . "'"; } $log_query = "INSERT INTO " . $this->logs_table . " (date, user_type, user_id, type, ip, dns, tablename, affected_id, data, query, error) VALUES ({$date}, {$user_type}, {$user_id}, {$type}, {$ip}, {$dns}, {$table}, {$affected_id}, {$data}, {$query}, {$error})"; $insert_id_return = $this->insert_id; $last_query_return = $this->last_query; $this->query_data($log_query); $this->log_insert_id = $this->insert_id; $this->log_last_query = $this->last_query; $this->insert_id = $insert_id_return; $this->last_query = $last_query_return; }
function check_blacklist($trade) { $checks = array('content' => $trade['content'], 'word' => $trade['site_name'] . ' ' . $trade['site_description'], 'dns' => get_dns($trade['domain']), 'domain' => $trade['domain'], 'email' => $trade['email'], 'header' => $trade['header'], 'server_ip' => $trade['server_ip'], 'user_ip' => $_SERVER['REMOTE_ADDR']); foreach (dir_read_files(DIR_BLACKLIST) as $file) { // Only check the specific blacklist if a check is set if (!string_is_empty($checks[$file])) { $fp = fopen(DIR_BLACKLIST . '/' . $file, 'r'); while (!feof($fp)) { list($item, $reason) = explode('|', trim(fgets($fp))); if (!string_is_empty($item) && stristr($checks[$file], $item) !== false) { return array($item, $reason); } } fclose($fp); } } return false; }