Beispiel #1
0
 private function _login()
 {
     //$url = "http://my.ujs.edu.cn/captchaValidate.portal?captcha=1&what=captcha&value=1";
     //_http($url, '', $this->_cookie);
     //登陆信息门户
     if (empty($this->code)) {
         copy($this->_cookie, $this->cookieTemp);
         $this->_cookie = $this->cookieTemp;
         //登陆图书馆
         $url = 'http://huiwen.ujs.edu.cn:8080/reader/hwthau.php';
         $ret = _http($url, '', $this->_cookie, $this->_cookie);
         //var_dump($ret);
         return true;
     }
     $url = "http://my.ujs.edu.cn/userPasswordValidate.portal";
     $post = "captchaField={$this->code}&Login.Token1={$this->_sno}&Login.Token2={$this->_password}&goto=http%3A%2F%2Fmy.ujs.edu.cn%2FloginSuccess.portal&gotoOnFail=http%3A%2F%2Fmy.ujs.edu.cn%2FloginFailure.portal";
     _http($url, $post, $this->_cookie, $this->_cookie);
     copy($this->_cookie, $this->cookieTemp);
     $this->_cookie = $this->cookieTemp;
     //登陆图书馆
     $url = 'http://huiwen.ujs.edu.cn:8080/reader/hwthau.php';
     $ret = _http($url, '', $this->_cookie, $this->_cookie);
     //var_dump($ret);
     return $ret;
 }
 function checkGraduate()
 {
     $url = 'http://yjsgl.ujs.edu.cn/yjsweb2009/yjs/jibenxinxi.aspx?xz=2';
     $output = _http($url, '', $this->cookieFile);
     $output = mb_convert_encoding($output, "utf-8//IGNORE", "gb2312");
     preg_match('/<input name="txtKSXM" type="text" value="(.*)" id="txtKSXM"/i', $output, $nm);
     $name = $nm[1];
     if (trim($name)) {
         //认证成功
         return 1;
     } else {
         return 0;
     }
 }
Beispiel #3
0
function my_vpn()
{
    header("Content-Type:text/html;charset=utf-8");
    $user = M('vpn_id', 'njust_', 'DB_CONFIG1');
    $id = (int) I('get.id');
    if ($id == null) {
        $data = $user->query('select max(id) from njust_vpn_id');
        $id = (int) $data[0]['max(id)'];
        //http://www.xiaoxiang123.com/Verify/Verify.ashx?0.6107400471810251
        $url = "http://www.xiaoxiang123.com/Verify/Verify.ashx";
        $cookie = dirname(__FILE__) . "/{$id}.txt";
        //save cookie and pic
        $verify = _http($url, '', '', $cookie);
        $filename = dirname(__FILE__) . "/vpic/{$id}.gif";
        file_put_contents($filename, $verify);
        //let the id increase in sql,and save cookie
        //$data_['cookie']=strstr(file_get_contents($cookie), "FALSE");
        $data_['id_'] = 1 + $id;
        $user->data($data_)->add();
        echo $id;
    } else {
        $code = I('get.code');
        //post to succeed
        $url2 = "http://www.xiaoxiang123.com/handler/reg.ashx";
        $cookie = dirname(__FILE__) . "/{$id}.txt";
        $post = array('username' => "{$id}@away", 'password' => 'away@away', 'password1' => 'away@away', 'verify' => "{$code}");
        echo _http($url2, $post, $cookie, '');
        @unlink($cookie);
    }
}