public static function save_place() { $flash = new Flash(); $post_data = Flight::request()->data; // recaptcha $secret = getenv('RECAPTCHA_SECRET'); $gRecaptchaResponse = $post_data['g-recaptcha-response']; $recaptcha = new ReCaptcha($secret); $resp = $recaptcha->verify($gRecaptchaResponse, $_SERVER['REMOTE_ADDR']); if ($resp->isSuccess()) { // verified! $address = "{$post_data['calle']} {$post_data['altura']}, {$post_data['ciudad']}, {$post_data['provincia']}, Argentina"; // save new place Place::create(array('name' => $post_data['name'], 'address' => $address, 'start_hour' => $post_data['start_hour'], 'end_hour' => $post_data['end_hour'], 'days' => $post_data['days'], 'comments' => $post_data['comments'])); $flash->message('success'); } else { $errors = $resp->getErrorCodes(); $flash->message('error'); } Flight::redirect('/', 302); }