Example #1
0
function manager_login($username, $password, $ishashed = 0)
{
    $twtapi = user_getTWTAPI();
    $result = $twtapi->query('twt.login', array('username' => $username, 'password' => $password, 'ishashed' => $ishashed));
    //print_R($result);
    if ($result) {
        //这里表示的是该用户确实存在....下面我们要判断该用户是老师还是学生...
        $usernumb = $result->usernumb;
        //这里表示的是老师...但是有的老师确实是支部的干部,,这里还是得确认...
        $query = " where partybranch_secretary ='" . $usernumb . "' or partybranch_organizer ='" . $usernumb . "' or partybranch_propagator ='" . $usernumb . "'";
        $query_r = getByWhere('partybranch', $query);
        if ($query_r) {
            $is_gangbu = 1;
            $partybranch_id = $query_r['partybranch_id'];
            //print_R($partybranch_id);
            //print_R('<br>');
        } else {
            $is_gangbu = 0;
            //这里要注意了:如果这里的人是老师的话,他不是支部委员,也不在info表中,那么这个人将没有
            //支部信息....也就是没有支部id....和那些没有支部的人登陆是一样的,,无法看到支部成员的//的内容.但是如果他有个人发展流程图,和上传资料还是可以看到的.....
            $query1 = " where sno ='" . $usernumb . "'";
            $query1_r = getByWhere('student_info', $query1);
            if ($query1_r['partybranch_id']) {
                //表示有内容...
                $partybranch_id = $query1_r['partybranch_id'];
            } else {
                $partybranch_id = 0;
            }
            //end of else..
        }
        //end of else...
        //下面判断的非常多...当老师和同学进入的时候,看到的是不同的页面.....
        if (strlen($usernumb) == 6) {
            $is_teacher = 1;
            //是干部
        } elseif (strlen($usernumb) == 10) {
            $is_teacher = 0;
            //不是干部...
        }
    }
    //end of if..result..
    if ($result) {
        $where = " where manager_name = '" . $result->twtname . "' and manager_status = 0 and manager_isdeleted = 0 ";
        //print_R($where);
        $manager = getByWhere('manager', $where);
        //print_R($manager);
        //这里表示通过在数据库中查找发现确实该用户是管理员..
        if ($manager) {
            $authority = $manager['manager_type'];
            //权限.
            manager_touch($result->twtname, $result->realname, $result->usernumb, $is_gangbu, $is_teacher, $partybranch_id, $authority);
        }
        //end of if....
    }
    //end of if result.....
    //print_R($manager);
    return $manager;
}
Example #2
0
function get_MemberbyClass($classid)
{
    $result1 = array();
    $twtapi = user_getTWTAPI();
    $result = $twtapi->query("class.getstudents", array('classid' => $classid));
    $result1 = $result->students;
    //print_R($result1);
    return $result1;
}
function user_logout()
{
    $twtapi = user_getTWTAPI();
    $result = $twtapi->query("twt.logout", array('username' => $_COOKIE['twt_account'], 'auth_key' => $_COOKIE['twt_authkey']));
    user_clearCookie();
    return $result;
}
function user_login($username, $password, $ishashed = 0)
{
    if (Database::isConnected()) {
        global $db;
        $db->close();
    }
    $twtapi = user_getTWTAPI();
    $result = $twtapi->query('twt.login', array('username' => $username, 'password' => $password, 'ishashed' => $ishashed));
    if ($result) {
        user_touch($result->twtname, $result->auth_key, $result->realname, $result->uid);
        if ($db) {
            global $db;
            $db->conn();
            load_model('user.func');
            user_APISync($result);
        }
    }
    return $result;
}