Example #1
0
header("Content-type: text/html; charset=utf-8");
session_start();
if (isset($_SESSION['loginStatus']) && $_SESSION['loginStatus'] == 1) {
    //
} else {
    header('Location: login.php?error=1&bak=homework');
    exit;
}
if (isset($_SESSION['type']) && ($_SESSION['type'] == '研究生' || $_SESSION['type'] == '教师')) {
    echo '<script>alert("抱歉!此功能暂不支持' . $_SESSION['type'] . '使用!");document.location = "./";</script>';
    exit;
}
include 'config.php';
include 'lib/infoQuery.class.php';
$student = new infoQuery($_SESSION['sid'], $_SESSION['password']);
$course = $student->getOptionalCourseName();
$data = file_get_contents('http://www.sky31.com/elective/');
$arr = json_decode($data, true);
foreach ($arr['data'] as $key => $value) {
    if ($value['title'] == $course) {
        $courseHw = $value['content'];
        break;
    }
}
?>

<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">