function loginUser($un, $psw) { $_SESSION['uid'] = $uid = Adapter::getAValue('UID', '`person`', 'name=?', array($un), "s"); $_SESSION['type'] = Adapter::getAValue('type', '`person`', 'uid=?', array($uid), "i"); if ($uid == -1) { print 1; return; } if (!Adapter::isExists('`person`', 'UID=? AND hash=?', array($uid, getHash($psw)), "is")) { print 2; return; } /*login code*/ $_SESSION['logged'] = 1; print 3; }