Beispiel #1
0
require_once '../jwc/jiaowu_cookie.class.php';
$openid = $_GET['openid'];
$v_yzm = $_GET['v_yzm'];
$mmc = memcache_init();
// 初始化缓存
//得到学号
$zjh = memcache_get($mmc, $openid . "zjh");
//得到密码
$mm = memcache_get($mmc, $openid . "password");
$cookieApiObj = new CookieApi();
$contents = $cookieApiObj->login($zjh, $mm, $v_yzm, $openid);
$pattern = '/<title>([\\w\\W]*?)<\\/title>/';
preg_match_all($pattern, $contents, $out, PREG_SET_ORDER);
if ($out[0][1] == iconv("UTF-8", "GB2312", "学分制综合教务")) {
    $class_mysqlObj = new Class_mysql();
    //删除存在的数据
    $sql_state = "delete from tb_studentScore where openid='{$openid}'";
    $res = $class_mysqlObj->query($sql_state);
    if ($res) {
        if ($cookieApiObj->getStudentScore($openid)) {
            $url = "http://ifreeweixin.sinaapp.com/scoreView/scoreResultView.php?openid={$openid}";
            echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"0;url={$url}\">";
        }
    } else {
        echo "操作失败";
    }
} else {
    $errStr = "error";
    $url = "http://ifreeweixin.sinaapp.com/scoreView/scoreResultView.php?openid={$openid}&&errStr={$errStr}";
    echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"0;url={$url}\">";
}
Beispiel #2
0
            $msgStr = $msgStr2;
        } else {
            if ($flag == 3) {
                $msgStr = $msgStr3;
            }
        }
    }
}
$arr1 = array('state' => "success", 'message' => $msgStr);
$arr2 = array('state' => "error", 'message' => "认证失败, 请检查密码、验证码输入是否正确");
$arr3 = array('state' => "error", 'message' => "你已经认证过学号:{$mmc_Openid},无需再次认证,如果要更改学号,请联系客服");
if (empty($mmc_Openid)) {
    /**
     * 如果未认证,则进行认证操作
     */
    $cookieApiObj = new CookieApi();
    $contents = $cookieApiObj->login($zjh, $mm, $v_yzm, $openid);
    $pattern = '/<title>([\\w\\W]*?)<\\/title>/';
    preg_match_all($pattern, $contents, $out, PREG_SET_ORDER);
    if ($out[0][1] == iconv("UTF-8", "GB2312", "学分制综合教务")) {
        memcache_set($mmc, $openid . "password", $mm);
        if ($cookieApiObj->getStudentInfo($openid) && $cookieApiObj->getStudentSyllabus($openid) && $cookieApiObj->getStudentScore($openid)) {
            memcache_set($mmc, $openid . "zjh", $zjh);
            echo json_encode($arr1);
        }
    } else {
        echo json_encode($arr2);
    }
} else {
    echo json_encode($arr3);
}