查询系统
前几天做了个大学英语四六级成绩查询系统,一个 phprpc 版本,一个 wap 版本。它们的核心代码都是相同的。下面就是从 etang.cet 获取大学英语四六级成绩的核心代码:
- function query($examid, $examtype) {
- $examid = trim($examid);
- $examtype = trim($examtype);
- if (!is_numeric($examid)) {
- return '准考证号码必须是数字';
- }
- if (strlen($examid) != 15) {
- return '准考证号码不正确';
- }
- if ($examtype == '1') {
- if ((substr($examid, 6, 4) != '0521') &&
- (substr($examid, 6, 4) != '1052')) {
- return '准考证号码与考试类型不符';
- }
- }
- if ($examtype == '2') {
- if ((substr($examid, 6, 4) != '0512') &&
- (substr($examid, 6, 4) != '0522') &&
- (substr($examid, 6, 4) != '2052')) {
- return '准考证号码与考试类型不符';
- }
- }
- $examid1 = substr($examid, 0, 6) . $examtype . '052' . substr($examid, 10, 5);
- $request = "examtype=$examtype&examid=$examid&image.x=23&image.y=32";
- $content_len = strlen($request);
- $handle = @fsockopen('cet.etang.com', 80, $errno, $errstr, 10);
- $buf = '';
- $id = base_convert(mt_rand().mt_rand(), 10, 36);
- if ($handle) {
- $http_request =
- "POST /dog/cet HTTP/1.0\r\n" .
- "Accept: */*\r\n" .
- "Referer: http://cet.etang.com/cet_girldemand_$id.htm\r\n" .
- "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Alexa Toolbar)\r\n" .
- "Host: cet.etang.com\r\n" .
- "Content-Type: application/x-www-form-urlencoded\r\n" .
- "Content-Length: $content_len\r\n" .
- "Cache-Control: no-cache\r\n" .
- "Cookie: zi=A; examid1=$examid; examtype1=$examtype; sex=girl; examid=$examid1; examtype=$examtype\r\n" .
- "\r\n" .
- $request;
- fputs($handle, $http_request, strlen($http_request));
- while (!feof($handle)) {
- $buf .= fgets($handle, 128);
- }
- fclose($handle);
- }
- else {
- return "查询服务器暂时无法连接";
- }
- $buf = explode("\r\n", $buf);
- $buf = $buf[11];
- $score = "";
- if (substr($buf, 0, 18) == 'Set-Cookie: score=') {
- $score = substr($buf, 18, strpos($buf, ';') - 18);
- }
- if (($score != '') and ($score != 'error')) {
- $score = explode(',', $score);
- }
- else {
- return '你所查询的准考证号码不存在';
- }
- return $score;
- }

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
