public function init_usr(array $aInf = null) { $oUsr = new UserCls(); UserCls::set_lng(self::$sLng); $sLgn = UserCls::log_in(); $aInf[] = self::t("If no match login it will be registered. No personal data collect"); if ($sAut = $_REQUEST["aut"]) { if (!$sLgn) { $aErr[] = self::t('No login'); $bFmd = false; //enter mode } else { if (!UserCls::is_usr_dta($sLgn) and $sAut == self::t("Enter")) { echo "<pre>sLgn"; var_dump($sLgn); echo "</pre>"; $aErr[] = self::t('No match login'); $bFmd = true; //register mode } elseif (!($sPsw = $_REQUEST["psw"]) or UserCls::is_usr_dta($sLgn) and !($aDta = $oUsr->get_usr_dta($sLgn, $sPsw))) { //empty or wrong pass $aErr[] = self::t('No match password'); $bFmd = $sAut != self::t("Enter") && !UserCls::is_usr_dta($sLgn) ?: false; //check mode } } } if (!$aErr) { if ($sAut == self::t("Register")) { $aDta = $oUsr->set_usr_dta($sLgn, $sPsw = $_REQUEST["psw"], ["dt_reg" => date("Y-m-d H:i:s"), "psw" => password_hash($sPsw, PASSWORD_DEFAULT), "lng" => self::$sLng]); } else { $aDta = $oUsr->get_usr_dta($sLgn, $sPsw); } } $sHtm = self::say_hi($aDta["lgn"]); if ($aErr) { $sHtm .= "<div class='mes_err'>" . implode("<br>", $aErr) . "</div>"; } if (!$aDta && !isset($bFmd)) { $bFmd = false; } //enter mode by default if (isset($bFmd)) { $sHtm .= UserCls::show_frm_aut($bFmd, $aInf); } if ($aDta and !$this->oUsr) { if ($aDta["ses"] != ($sSid = session_id())) { $aDta = $oUsr->set_usr_dta($sLgn, "", $aDta); } $this->oUsr = $oUsr; } return $sHtm; }
public static function chk_usrs() { $oUsr = new UserCls(); $aDta = $oUsr->get_data(); return $sLgn; }