$query_name = mysql_query($sql_name, $link) or die(mysql_error()); $name_ret = mysql_fetch_row($query_name); $name = $name_ret[2]; $xb = $name_ret[4]; if ($xb == '男') { $ch = '同学'; } if ($xb == '女') { $ch = '同学'; } //搜索数据库是否已经有数据 $sql_check = "SELECT * FROM `jwc_chengji` WHERE `xh` = '{$xh}' LIMIT 1 "; $query_char = mysql_query("SET NAMES UTF8"); $query_check = mysql_query($sql_check, $link) or die(mysql_error()); $check_ret = mysql_fetch_row($query_check); $jieguo = po_chengji($str, $xh, $name, $ch, $link); $title = "{$name} {$ch}欢迎使用&【广药学生成绩查询】"; echo $title . "&&" . $jieguo; function get_utf8_string($content) { $encoding = mb_detect_encoding($content, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5')); return mb_convert_encoding($content, 'utf-8', $encoding); } function po_chengji($str, $xh, $name, $ch, $link) { $zxfxj = get_utf8_string("%实得总学分小计:"); $pjxfjd = get_utf8_string("%平均学分绩点:"); $zxfjd = get_utf8_string("%总学分绩点"); $str = str_replace("</font></span></td> \t</tr>", "%", $str); $str = str_replace("</td> \t</tr>", "&】", $str); $str = str_replace("<tr> \t\t<td>", "【", $str);
</div> </div> <script type="text/javascript"> var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://"); document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Fc8c6b4ac78fb9378987b263d5babdb1a' type='text/javascript'%3E%3C/script%3E")); </script> </body> </html> <?php po_chengji($_POST['xh'], $_POST['pw']); po_xuanxiu($_POST['xh'], $_POST['pw']); function get_utf8_string($content) { $encoding = mb_detect_encoding($content, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5')); return mb_convert_encoding($content, 'utf-8', $encoding); } function get_personinfo($xh, $pw) { $api_url = 'http://zlgc.gdpu.edu.cn/chengji/jwcapi.php?xh=' . $xh . '&pw=' . $pw . '&flag=1'; $ret_personinfo = file_get_contents($api_url); return $ret_personinfo; } function get_chengji($xh, $pw) { $api_url = 'http://zlgc.gdpu.edu.cn/chengji/jwcapi.php?xh=' . $xh . '&pw=' . $pw . '&flag=2';