Esempio n. 1
0
function DB_get_userSchoolList()
{
    $sql = "Select scode,sname FROM user_school WHERE group_enable='1' ORDER BY scode ASC";
    $sql_result = mysql_query($sql) or die('MySQL query error');
    while ($row = mysql_fetch_assoc($sql_result)) {
        toPrint_multiTagWithoutAttr('schoolList', $row);
    }
}
Esempio n. 2
0
function DB_get_related_gp_list($groupkey)
{
    if (isset($_SESSION['userkey'])) {
        $sql = "SELECT org_id FROM user_profile WHERE BINARY userkey='" . $_SESSION['userkey'] . "'";
        $sql_result = mysql_query($sql) or die('MySQL query error1');
        $row_data = mysql_fetch_assoc($sql_result);
        $org_id = $row_data['org_id'];
        $sql2 = "SELECT subjectkey FROM p_group WHERE BINARY groupkey='" . $groupkey . "'";
        $sql2_result = mysql_query($sql2) or die('MySQL query error2');
        $row_data2 = mysql_fetch_assoc($sql2_result);
        $subjectkey = $row_data2['subjectkey'];
        $sql3 = "SELECT groupkey,subjectkey,gp_topic,gp_scratch FROM p_group WHERE enable ='1' AND (gp_orgkey like '%" . $org_id . "%' OR subjectkey = '" . $subjectkey . "') ORDER BY subjectkey,gp_orgkey limit 5";
        echo $sql3;
        $sql3_result = mysql_query($sql3) or die('MySQL query error3');
        echo $sql3;
        while ($row_data3 = mysql_fetch_assoc($sql3_result)) {
            toPrint_multiTagWithoutAttr('relatedgrouplist', $row_data3);
        }
    }
}
Esempio n. 3
0
function DB_select_user_joined_gp($dataArray)
{
    if (isset($_SESSION['userkey'])) {
        $_userKey = $_SESSION['userkey'];
        $sql = "Select cg.groupkey,cg.gp_topic FROM p_group_list as cgl LEFT JOIN p_group as cg ON cgl.groupkey = cg.groupkey WHERE cgl.enable = '1' AND cg.enable = '1' AND cgl.userkey = '" . $_userKey . "'";
        $sql_result = mysql_query($sql) or die('MySQL query error_group');
        while ($row_data = mysql_fetch_assoc($sql_result)) {
            toPrint_multiTagWithoutAttr('joinedGp', $row_data);
        }
    }
}
Esempio n. 4
0
function DB_select_gpList($dataArray)
{
    $_userKey = $_SESSION['userkey'];
    $tableName = 'p_group_list';
    $sql = "Select pgl.userkey,pgl.status,up.realname,up.userpic,up.org_id from p_group_list as pgl LEFT JOIN user_profile as up ON pgl.userkey = up.userkey WHERE pgl.groupkey = '" . $dataArray['groupkey'] . "' AND pgl.enable='1'";
    $sql_result = mysql_query($sql) or die('MySQL query error');
    $joinedGp = '0';
    while ($row = mysql_fetch_assoc($sql_result)) {
        if ($row['userkey'] == $_userKey) {
            $joinedGp = '1';
        }
        toPrint_multiTagWithoutAttr('grouplist', $row);
    }
    toPrint_oneMsg('joinedGp', $joinedGp);
}
Esempio n. 5
0
function DB_get_allUserList($dataArray)
{
    $sql = "Select u.user_id,identity,remark,realname,username,login_name,login_pw,gender,email,create_date FROM user AS u LEFT JOIN user_profile AS up ON u.user_id = up.user_id WHERE BINARY up.enable = '1' ORDER BY identity ASC,create_date DESC";
    $sql_result = mysql_query($sql) or die('MySQL query error');
    while ($row = mysql_fetch_assoc($sql_result)) {
        toPrint_multiTagWithoutAttr('allUser', $row);
    }
}
Esempio n. 6
0
function DB_select_submitForgetPw($userInfoType, $userInfo, $userMethod, $userHintsAns)
{
    if ($userInfoType == 'email') {
        $colName = 'ufp.pw_email';
    } else {
        $colName = 'u.login_name';
    }
    $sql = "Select u.login_name,u.login_pw,up.realname,ufp.pw_email,ufp.pw_ques,ufp.pw_ans FROM user_forget_pw AS ufp LEFT JOIN user AS u ON ufp.user_id = u.user_id LEFT JOIN user_profile AS up ON u.user_id = up.user_id WHERE BINARY " . $colName . " = '" . $userInfo . "'";
    $sql_result = mysql_query($sql) or die('MySQL query error');
    $isExist = mysql_num_rows($sql_result);
    if ($isExist > 0) {
        while ($row = mysql_fetch_assoc($sql_result)) {
            $row['result'] = 'true';
            if ($userMethod == 'chooseEmail') {
                $content = 'Thank you for sign up! Your login informaton:';
                $emailName = $row['realname'];
                $username = $row['realname'];
                $content = $content . '<p>Login name:' . $row['login_name'] . '</p><p>Login password' . $row['login_pw'] . '</p>';
                $subject = 'Learning collaborative and sharing platform';
                $content = $content . '<p>Please login to the platform again</p>';
                sendEmail($emailName, $username, $content, $subject, $row['pw_email']);
                toPrint_oneMsg('sendemail', 'true');
                toPrint_oneMsg('result', 'true');
            } else {
                if ($userMethod == 'chooseHints') {
                    if ($userHintsAns == $row['pw_ans']) {
                        toPrint_multiTagWithoutAttr('userGetPw', $row);
                    } else {
                        toPrint_oneMsg('hints', 'false');
                        toPrint_oneMsg('result', 'true');
                    }
                }
            }
        }
        $recordStr = 'GetPwSuccess:' . '|userInfoType:' . $userInfoType . '|userInfo:' . $userInfo . '|userMethod:' . $userMethod . '|$userHintsAns:' . $userHintsAns;
        recordlog('getForgetPw', 'index', $recordStr);
        return true;
    } else {
        $isExist = 'false';
        $recordStr = 'GetPwFail:' . '|userInfoType:' . $userInfoType . '|userInfo:' . $userInfo . '|userMethod:' . $userMethod . '|$userHintsAns:' . $userHintsAns;
        recordlog('getForgetPw', 'index', $recordStr);
        toPrint_oneMsg('result', $isExist);
        return false;
    }
}