auth.value=JSON.stringify(data); user.value = username; form.submit(); }); }, 1000); <?php } catch (Exception $e) { echo "alert('error: " . $e->getMessage() . "');"; } break; } } else { if ($_POST['register2']) { try { $reg = $u2f->doRegister(json_decode($_SESSION['regReq']), json_decode($_POST['register2'])); addReg($user->id, $reg); } catch (Exception $e) { echo "alert('error: " . $e->getMessage() . "');"; } finally { $_SESSION['regReq'] = null; } } else { if ($_POST['authenticate2']) { try { $reg = $u2f->doAuthenticate(json_decode($_SESSION['authReq']), getRegs($user->id), json_decode($_POST['authenticate2'])); updateReg($reg); echo "alert('success: " . $reg->counter . "');"; } catch (Exception $e) { echo "alert('error: " . $e->getMessage() . "');"; } finally { $_SESSION['authReq'] = null;
$showDetail = true; editDetail($smarty, $_REQUEST['id']); break; case "cancel": $template = "tour_list.tpl"; $showList = true; reload($smarty); break; case "register": $template = "tour_reg.tpl"; $showDetail = true; showForm($smarty); break; case "addreg": $template = "tour_reg.tpl"; $hasil = addReg($smarty); if ($hasil) { $showDetail = false; $smarty->assign('showSukses', true); } else { $showDetail = true; showForm($smarty); } break; default: $template = "tour_list.tpl"; $showList = true; reload($smarty); break; } // assign template