public function verifyData() { $FU = new FUser(); $res = "-1"; //suppongo campi vuoti $VLog = new VLog(); if ($VLog->getMail() && $VLog->getPassword()) { $_mail = $VLog->getMail(); $_password = $VLog->getPassword(); try { $user = $FU->loadUser($_mail); if ($user) { if ($_mail == $user->getMail() && $_password == $user->getPassword() && $user->getStatus()) { $res = "0"; //l'utente esiste ed è verificato } else { if (!$user->getStatus()) { $res = "1"; } else { $res = "2"; } //password errata } } else { $res = "3"; } //Non esiste l'utente } catch (Exception $e) { $res = "5"; } } else { $res = "4"; } echo $res; }
public function query($data) { if (is_array($data) && $data) { $ret = $this->execute('query', $data); return $ret; } else { VLog::warning("插入数据请填写数据."); } }
public function login() { $FU = new FUser(); $bool = false; $VLog = new VLog(); if ($VLog->getMail() && $VLog->getPassword()) { $_mail = $VLog->getMail(); $_password = $VLog->getPassword(); $user = $FU->loadUser($_mail); if ($user) { if ($_mail == $user->getMail() && $_password == $user->getPassword() && $user->getStatus()) { $session = new USession(); $_name = $user->getName(); $_surname = $user->getSurname(); $_ssn = $user->getSSN(); $_status = $user->getStatus(); $_type = $user->getType(); $session->setValue('name', $_name); $session->setValue('surname', $_surname); $session->setValue('ssn', $_ssn); $session->setValue('type', $_type); $session->setValue('mail', $_mail); $bool = true; //l'utente Ú loggato } } } return $bool; }