public function login($u = NULL, $p = NULL) { $this->Connect(); // 1. valid // TODO: read view try { $r = $this->_u_rd($u); } catch (Exception $e) { throw new c2Ex("Invalid user!" . (C2_SYS_ERR ? "\n" . $e->getMessage() : "")); } // 3. login tries try { $this->_u_cltr($r); } catch (Exception $e) { throw new c2Ex("Login tries exceeded!" . (C2_SYS_ERR ? "\n" . $e->getMessage() : "")); } // 2. online if (c2Str::tof($r['o'])) { // online, within grace if ($this->_u_cgt($r)) { throw new c2Ex("Online!"); } } // 2. login try { $this->_u_login($u, $p); } catch (Exception $e) { $this->_u_iltr($u); throw new c2Ex("Invalid password!" . (C2_SYS_ERR ? "\n" . $e->getMessage() : "")); } return $this->save('u', $u); }