function spamhurdles_db_get($key) { global $PHORUM; $record = $PHORUM['DB']->interact(DB_RETURN_ROW, "SELECT data,expire_time\n FROM {$PHORUM['spamhurdles_table']}\n WHERE id = '" . $PHORUM['DB']->interact(DB_RETURN_QUOTED, $key) . "'"); // If a record was found, then return the data in case the record // isn't expired. If the record is expired, then delete it from // the database. if ($record) { if ($record[1] > time()) { return unserialize($record[0]); } else { spamhurdles_db_remove($key); } } return NULL; }
function spamhurdles_db_get($key) { $sql = "SELECT data,expire_time FROM " . SPAMHURDLES_TABLE . " " . "WHERE id = '" . addslashes($key) . "'"; $record = phorum_db_interact(DB_RETURN_ROW, $sql); // If a record was found, then return the data in case the record // isn't expired. If the record is expired, then delete it from // the database. if ($record) { if ($record[1] > time()) { return unserialize($record[0]); } else { spamhurdles_db_remove($key); } } return NULL; }
function phorum_mod_spamhurdles_cleanup_key($key = NULL) { if ($key === NULL && isset($GLOBALS["PHORUM"]["SPAMHURDLES"]["key"])) { $key = $GLOBALS["PHORUM"]["SPAMHURDLES"]["key"]; } if ($key !== NULL) { spamhurdles_db_remove($key); } }