diff --git a/authparams.php b/authparams.php index c853dcd..996d337 100644 --- a/authparams.php +++ b/authparams.php @@ -14,19 +14,27 @@ class authparams If non is found, return "anonymous", "anonymous" */ public function __construct ($authprocesses=array("session","post")) { - foreach ($authprocesses as $authprocess) + if (php_sapi_name () === "cli") { - try + $this->email = "cli"; + $this->password = ""; + } + else + { + foreach ($authprocesses as $authprocess) { - $res = $this->$authprocess(); - $this->email = $res["email"]; - $this->password = $res["password"]; - break; - } - catch (Exception $e) - { - $this->email = "anonymous"; - $this->password = "anonymous"; + try + { + $res = $this->$authprocess(); + $this->email = $res["email"]; + $this->password = $res["password"]; + break; + } + catch (Exception $e) + { + $this->email = "anonymous"; + $this->password = "anonymous"; + } } } }