<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of checkEmail
 *
 * @author admin@3embed
 */
require_once 'ConDB.php';

class checkUserGroup {
    public $isAMember;
    public $groupId;
    
    public function __construct($uid) {
        $db = new ConDB();
        $get_user_qry = "select * from usergroups where uid ='" . $uid . "' and IsApproved = 1";
        $user_res = mysql_query($get_user_qry, $db->conn);
        
        if(mysql_num_rows($user_res) > 0){
            $user_row = mysql_fetch_assoc($user_res);
            $this->isAMember = true;
            $this->groupId = $user_row['Gid'];
        }else{
            $this->isAMember = false;
            $this->groupId = '0';
        }
        
        $db->close($db);
    }
    
    public function checkInGroup($uid,$gid){
        $db = new ConDB();
        $get_user_qry = "select * from usergroups where uid ='" . $uid . "' and IsApproved = 1 and gid = '".$gid."'";
        $user_res = mysql_query($get_user_qry, $db->conn);
        
        if(mysql_num_rows($user_res) > 0){
            $user_row = mysql_fetch_assoc($user_res);
            $this->isAMember = false;
            $this->groupId = $user_row['Gid'];
        }else{
            $this->isAMember = true;
            $this->groupId = '0';
        }
        
        //$db->close($db);
    }
}

?>