public function getLogUrl() { $url = ""; $auth = new PayqrModuleAuth(); if ($user = $auth->getUser()) { $url = PayqrModule::getBaseUrl() . "/log.php?user_id={$user->user_id}&key={$this->log_key}"; } return $url; }
private function recoverUser() { if (isset($_COOKIE[$this->key])) { $db = PayqrModuleDb::getInstance(); $user = $db->select("select user_id, username, merch_id from " . PayqrModuleDb::getUserTable() . " where md5(concat(user_id, username, '" . $this->salt . "')) = ?", array($_COOKIE[$this->key]), array("s")); if ($user) { $_SESSION[$this->key] = $user; } } else { $location = PayqrModule::getBaseUrl() . "/module/auth/"; $auth_location = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}"; if ($location != $auth_location) { header("Location: {$location}"); } $_SESSION[$this->key] = false; } }
public static function redirect($url) { $location = PayqrModule::getBaseUrl() . $url; header("Location: {$location}"); }