function openid() { $oid = ""; if (!array_key_exists("code", $_GET)) { return ""; } $code = $_GET["code"]; // return the openid in cache if ($this->code_cached != "" && $this->code_cached == $code && $this->openid_cached != "" && strlen($this->openid_cached) > 0) { return $this->openid_cached; } $this->code_cached = $code; $access_token = ""; $oid = ""; wx_openid_from_code($code, $access_token, $oid); $this->openid_cached = $oid; return $oid; }
log_visitor_info(); require_once "srvc_book_abstract.php"; $guest_num_max = 20; $guest_num_default = 2; $BOARD_M_DEFAULT = $guest_num_default; // user can make a reservation from tommorrow $FIRST_OPEN_AFTER_TODAY = 0; $TIME_OF_FIRST_OPEN_DAY = time() + $FIRST_OPEN_AFTER_TODAY * SEC_PER_DAY; $right_now_day = full_date($TIME_OF_FIRST_OPEN_DAY); // try to get wx-openid $wx_oid = ""; $wx_code = array_string4key($_GET, "code"); $wx_state = array_string4key($_GET, "state"); if ($wx_code != null && $wx_state == TOO_WX_STATE_DEFAULT) { $wx_access_token = ""; wx_openid_from_code($wx_code, $wx_access_token, $wx_oid); if ($wx_oid != null) { setcookie(KEY_COOKIE_TOO_WX_OID, $wx_oid, time() + 3600); } $redirect_url = TOO_HOME_URL . "/wx/book.php#wechat_redirect"; header("Location:" . $redirect_url); exit; } $wx_oid = array_string4key($_COOKIE, KEY_COOKIE_TOO_WX_OID); if ($wx_oid == null) { $wx_oid = ""; } ?> <?php $available_days = [];