function phorum_mod_event_logging_failed_login($data) { // Check for suspended logging. if (!empty($GLOBALS["PHORUM"]["MOD_EVENT_LOGGING"]["SUSPEND"])) { return $data; } if (!$GLOBALS["PHORUM"]["mod_event_logging"]["do_log_login_failure"]) { return $data; } // Check if a user can be found for the used username. // If we can find a user, then we log the user_id, so the filter by // user option in the log viewer will include failed user logins as well. $user_id = phorum_db_user_search('username', $data['username']); $location = ucfirst($data["location"]); $password = event_logging_mask_password($data["password"]); event_logging_writelog(array("source" => $data["location"] . " login", "message" => "{$location} login failure for user " . '"' . $data["username"] . '".', "details" => "The user tried to login using the password " . '"' . $password . '".', "user_id" => $user_id, "loglevel" => EVENTLOG_LVL_WARNING, "category" => EVENTLOG_CAT_SECURITY)); return $data; }
/** * Search for users, based on simple search conditions, which act on * fields in the user table. * * The parameters $field, $value and $operator (which are used for defining * the search condition) can be arrays or single values. If arrays are used, * then all three parameter arrays must contain the same number of elements * and the keys in the arrays must be the same. * * @param mixed $field * The user table field (string) or fields (array) to search on. * * @param mixed $value * The value (string) or values (array) to search for. * * @param mixed $operator * The operator (string) or operators (array) to use. Valid operators are * "=", "!=", "<>", "<", ">", ">=" and "<=", "*". The * "*" operator is for executing a "LIKE '%value%'" matching query. * * @param boolean $return_array * If this parameter has a true value, then an array of all matching * user_ids will be returned. Else, a single user_id will be returned. * * @param string $type * The type of search to perform. This can be one of: * - AND match against all fields * - OR match against any of the fields * * @param mixed $sort * The field (string) or fields (array) to sort the results by. For * ascending sort, "fieldname" or "+fieldname" can be used. For * descending sort, "-fieldname" can be used. By default, the results * will be sorted by user_id. * * @param integer $offset * The result page offset starting with 0. * * @param integer $length * The result page length (nr. of results per page) * or 0 (zero, the default) to return all results. * * @param boolean $count_only * Tells the function to just return the count of results for this * search query. * * @return mixed * An array of matching user_ids or a single user_id (based on the * $return_array parameter) or a count of results (based on $count_only). * If no user_ids can be found at all, then 0 (zero) will be returned. */ function phorum_api_user_search($field, $value, $operator = '=', $return_array = FALSE, $type = 'AND', $sort = NULL, $offset = 0, $length = 0, $count_only = false) { return phorum_db_user_search($field, $value, $operator, $return_array, $type, $sort, $offset, $length, $count_only); }