- $redirect = 'http://' . $_SERVER['HTTP_HOST'];
- header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
- exit;
+ //delete last openid cookie.
+ // if you deliberately log out, you do not want to be logged in
+ // automatically on the next page reload.
+ setcookie('lastopenid', '0', time() - 3600);
+
+ header('Location: ' . Tools::fullUrl());
+ exit();
+}
+
+$bAutologin = false;
+if (isset($_GET['autologin']) && $_GET['autologin']
+ && isset($_COOKIE['lastopenid'])
+) {
+ $bAutologin = true;
+ // autologin=1: start openid autologin
+ // autologin=2: response from openid server
+ if ($_GET['autologin'] == 1) {
+ $_POST['openid_url'] = $_COOKIE['lastopenid'];
+ }