From 19f1b5d2a1730f8e37c8fc5585d30b99e70a8575 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 28 Jan 2015 18:10:23 +0100 Subject: Automatically login to phorkie --- src/phorkie/Login/AutologinResponse.php | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/phorkie/Login/AutologinResponse.php (limited to 'src') diff --git a/src/phorkie/Login/AutologinResponse.php b/src/phorkie/Login/AutologinResponse.php new file mode 100644 index 0000000..9384e3b --- /dev/null +++ b/src/phorkie/Login/AutologinResponse.php @@ -0,0 +1,53 @@ +status = $status; + $this->message = $message; + } + + public function send() + { + if ($this->status == 'error') { + //Cookie to prevent trying autologin again and again. + // After 1 hour the cookie expires and autologin is tried again. + setcookie('tried-autologin', '1', time() + 60 * 60); + } + + $data = htmlspecialchars(json_encode($this), ENT_NOQUOTES); + header('Content-type: text/html'); + echo << + + Autologin response + + + + + +XML; + } +} +?> -- cgit v1.2.3