示例#1
0
 public static function auth($login, $password)
 {
     $db = new PwDb();
     $rs = $db->rawQuery("select id, password from users where login='******'");
     $rs = mysqli_fetch_object($rs);
     $coding = PwUser::$pwd_coding;
     print $coding;
     if (!empty($coding)) {
         $password = $coding($password);
     }
     if ($rs->password == $password) {
         return $rs->id;
     }
     return false;
 }
示例#2
0
 public function get($userid = null)
 {
     if (empty($userid)) {
         $userid = $this->id;
     }
     $grm = new groupsModel();
     $sql = 'SELECT groupid FROM pfmuser_group WHERE userid=' . $userid;
     if ($GLOBALS['conf']->db_debug) {
         print $sql . '<br />';
     }
     $ds = $grm->rawQuery($sql);
     $resp = array();
     while ($row = mysqli_fetch_object($ds)) {
         $resp[] = $this->groups[] = $grm->get($row->groupid);
     }
     $user = parent::get($userid);
     $user->groups = $this->groups;
     return $user;
 }
示例#3
0
 public function get($groupid = null)
 {
     $this->credentials = array();
     if (empty($groupid)) {
         $groupid = $this->id;
     }
     $cred = new credentialModel();
     $ds = $cred->rawQuery('select credential from pfm_group_credential where groupid=' . $groupid);
     $rs = array();
     while ($row = mysqli_fetch_object($ds)) {
         $rs[] = $row->credential;
     }
     foreach ($rs as $row) {
         $cds = $cred->get($row);
         $this->credentials[] = $cds->name;
     }
     $group = parent::get($groupid);
     $group->credentials = $this->credentials;
     return $group;
 }
示例#4
0
 public static function removeCredential($groupid, $credential)
 {
     $db = new PwDb();
     $sql = "delete from pfm_group_credential where groupid='" . $groupid . "' and credential='" . $credential . "'";
     return $db->rawQuery($sql);
 }