/** * Kontroller inndata og utfør utpressing */ public function utpress() { // wait time? if (($wait = $this->ut->getWait()) > 0) { \ess::$b->page->add_message("Du må vente " . \game::counter($wait, true) . " før du kan utføre en ny utpressing.", "error"); return; } // validate form $form_info = ''; if ($this->ut->up->data['up_utpressing_last']) { $form_info = sprintf("Siste=%s;", \game::timespan($this->ut->up->data['up_utpressing_last'], \game::TIME_ABS | \game::TIME_SHORT | \game::TIME_NOBOLD)); } else { $form_info = "First;"; } if ($wait) { $form_info .= sprintf("%%c11Ventetid=%s%%c", \game::timespan($wait, \game::TIME_SHORT | \game::TIME_NOBOLD)); } else { $form_info .= "%c9No-wait%c"; } if (!$this->form->validateHashOrAlert(postval('hash'), $form_info)) { return; } // mangler alternativ? $option = $this->ut->getOption(postval("opt")); if (!$option) { \ess::$b->page->add_message("Du må velge et alternativ.", "error"); return; } // lagre valg for neste gang \ess::session_put("utpressing_opt_key", postval("opt")); // forsøk utpressing $result = $this->ut->utpress($option); if ($msg = $result->getMessage()) { \ess::$b->page->add_message($msg); } // oppdater anti-bot $this->antibot->increase_counter(); }