require dirname(__FILE__) . '/includes/init.php'; if ($_REQUEST['act'] == 'list') { //考试名称 $prjs = get_exam_prjs($_SESSION["class_code"]); $smarty->assign("prjs", $prjs); // $smarty->assign("select_prj", 2); $smarty->display('score_summary_list.htm'); exit; } elseif ($_REQUEST['act'] == 'ajax_load') { $prj_id = empty($_REQUEST['prj_id']) ? '' : trim($_REQUEST['prj_id']); //考试名称 $prj_name = get_exam_prj_name($prj_id); $subjects = get_subjects($class_code, $prj_id); $res = scoreStatistics($class_code, $prj_id); $result = array('subjects' => $subjects, 'students' => $res); make_json($result); exit; } elseif ($_REQUEST['act'] == 'import') { /* 将文件按行读入数组,逐行进行解析 */ $line_number = 0; $scores_list = array(); $data = file($_FILES["importFile"]["tmp_name"]); $titles = array(); $prj_id = ''; $begin_flag = false; foreach ($data as $line) { // 转换编码 // if (($_POST['charset'] != 'UTF8') && (strpos(strtolower(EC_CHARSET), 'utf') === 0)) // { // $line = ecs_iconv($_POST['charset'], 'UTF8', $line); // }
<?php define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; if ($_REQUEST['act'] == 'list') { $smarty->display('teacher_list.htm'); exit; } if ($_REQUEST['act'] == 'ajax_list') { $list = teacher_list(); make_json($list); } elseif ($_REQUEST['act'] == 'ajax_save') { $id = !empty($_REQUEST['teacher_id']) ? intval($_REQUEST['teacher_id']) : 0; if ($id == 0) { //insert $sql = "insert into " . $ecs->table("teacher") . " (name,sexuality,birthday,\r\n\t\tnational,id_card,phone,email,address,\r\n\t\ttitle,is_header,level,class_code,\r\n\t\tcreated )\r\n\t\tvalues \r\n\t\t\t('" . $_REQUEST["name"] . "','" . $_REQUEST["sexuality"] . "',\r\n\t\t\t'" . $_REQUEST["birthday"] . "','" . $_REQUEST["national"] . "',\r\n\t\t\t'" . $_REQUEST["id_card"] . "','" . $_REQUEST["phone"] . "','" . $_REQUEST["email"] . "',\r\n\t\t\t'" . $_REQUEST["address"] . "','" . $_REQUEST["title"] . "','" . $_REQUEST["is_header"] . "',\r\n\t\t\t'" . $_REQUEST["level"] . "','" . $_SESSION["class_code"] . "',\r\n\t\t\tnow())"; $db->query($sql); admin_log(addslashes($_REQUEST["name"]), 'add', 'teacher'); make_json_result("添加“" . $_REQUEST["name"] . "”成功!"); } else { $sql = "update " . $ecs->table("teacher") . " set name='" . $_REQUEST["name"] . "',\r\n\t\t\tsexuality='" . $_REQUEST["sexuality"] . "',\r\n\t\t\tbirthday='" . $_REQUEST["birthday"] . "',\r\n\t\t\tnational='" . $_REQUEST["national"] . "',\r\n\t\t\tid_card='" . $_REQUEST["id_card"] . "',\r\n\t\t\tphone='" . $_REQUEST["phone"] . "',\r\n\t\t\temail='" . $_REQUEST["email"] . "',\r\n\t\t\taddress='" . $_REQUEST["address"] . "',\r\n\t\t\ttitle='" . $_REQUEST["title"] . "',\r\n\t\t\tis_header='" . $_REQUEST["is_header"] . "',\r\n\t\t\tlevel='" . $_REQUEST["level"] . "'\r\n\t\t\twhere teacher_id=" . $id; $db->query($sql); admin_log(addslashes($_REQUEST["name"]), 'update', 'teacher'); make_json_result("修改“" . $_REQUEST["name"] . "”成功!"); } } elseif ($_REQUEST['act'] == 'ajax_delete') { $id = !empty($_REQUEST['teacher_id']) ? intval($_REQUEST['teacher_id']) : 0; $sql = "delete from " . $ecs->table("teacher") . " where teacher_id=" . $id; $db->query($sql); admin_log($_REQUEST["teacher_id"], 'delete', 'teacher'); make_json_result("删除成功!");
/** * 创建一个JSON格式的数据 * * @access public * @param string $content * @param integer $error * @param string $message * @param array $append * @return void */ function make_json_response($content = '', $error = "0", $message = '', $append = array()) { $res = array('error' => $error, 'message' => $message, 'content' => $content); if (!empty($append)) { foreach ($append as $key => $val) { $res[$key] = $val; } } make_json($res); }
$newPass = md5(md5($NewPassword) . $admin["ec_salt"]); } } else { /* 检查密码是否正确 */ if ($admin["password"] == md5($OldPassword)) { $isRight = true; $newPass = md5($NewPassword); } } //修改密码 if ($isRight) { $sql = "update hteacher.ht_admin_user set password='******' where user_id=" . $id; $db->query($sql); make_json(array("isOk" => 1, "message" => "")); } else { make_json(array("isOk" => 0, "message" => "旧密码有误!")); } } elseif ($_REQUEST['act'] == 'calculator') { $smarty->display('calculator.htm'); } elseif ($_REQUEST['act'] == 'menu') { include_once 'includes/inc_menu.php'; // 权限对照表 include_once 'includes/inc_priv.php'; foreach ($modules as $key => $value) { ksort($modules[$key]); } ksort($modules); foreach ($modules as $key => $val) { $menus[$key]['label'] = $_LANG[$key]; if (is_array($val)) { foreach ($val as $k => $v) {
//扫描所有数据库 $guardian = getGuardianByUsername($phone); if ($guardian) { $res = forgetPwd_changePwd_guardian($guardian, $guardian["school_code"], $password); make_json($res); exit; } else { make_json_error("根据您输入的电话号码" . $phone . "找不到绑定的账户!"); exit; } } else { if ($status == 'admin') { $admin = getAdminByPhone($phone); if ($admin) { $res = forgetPwd_changePwd_admin($admin, $password); make_json($res); exit; } else { make_json_error("根据您输入的电话号码" . $phone . "找不到绑定的账户!"); exit; } } } } elseif ($_REQUEST['act'] == 'logout') { /* 清除cookie */ setcookie('ECSCP[admin_id]', '', 1); setcookie('ECSCP[admin_pass]', '', 1); setcookie('ECSCP[status_id]', '', 1); setcookie('ECSCP[school_code]', '', 1); setcookie('ECSCP[class_code]', '', 1); $sess->destroy_session();
<?php define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; if ($_REQUEST['act'] == 'list') { set_params(); $smarty->display('score_list.htm'); exit; } if ($_REQUEST['act'] == 'ajax_list') { $list = score_list(); make_json($list); } elseif ($_REQUEST['act'] == 'ajax_get_subject') { $exam_prj = empty($_REQUEST["prj_id"]) ? "" : trim($_REQUEST["prj_id"]); $subjects = get_subjects($class_code, $exam_prj); make_json($subjects); } elseif ($_REQUEST['act'] == 'ajax_add') { $exam_prj = empty($_REQUEST["add_prj_id"]) ? "" : trim($_REQUEST["add_prj_id"]); $student = empty($_REQUEST["add_student_code"]) ? "" : trim($_REQUEST["add_student_code"]); if (!$exam_prj || !$student) { make_json_error("参数有误!"); exit; } $subjects = get_subjects($class_code); $scores = array(); //[subject ==> score] foreach ($subjects as $subject) { $s = $subject["subject"]; $score = empty($_REQUEST["add_score_" . $s]) ? "" : trim($_REQUEST["add_score_" . $s]); if ($score) { $scores[$s] = $score;
make_json_result("修改成功!"); } elseif ($_REQUEST['act'] == 'ajax_delete') { $id = !empty($_REQUEST['exam_id']) ? trim($_REQUEST['exam_id']) : ""; $sql = "delete from " . $ecs->table("exam") . " where exam_id in (" . $id . ")"; $db->query($sql); admin_log($_REQUEST["exam_id"], 'delete', 'exam'); make_json_result("删除成功!"); } elseif ($_REQUEST['act'] == 'getSmsContent') { $prj_id = !empty($_REQUEST['prj_id']) ? trim($_REQUEST['prj_id']) : ""; $sql = "select * from " . $ecs->table("exam") . " where prj_id='" . $prj_id . "'"; $rows = $db->getAll($sql); $content = "【《" . get_exam_prj_name($prj_id) . "》考试安排】"; foreach ($rows as $row) { $content .= $row["examdate"] . ',' . substr($row["stime"], 0, 5) . '-' . substr($row["etime"], 0, 5) . '在' . $row["classroom"] . '考试' . $row["subject"] . ';'; } make_json(array("error" => 0, "msg" => $content)); } elseif ($_REQUEST['act'] == 'publish') { $prj_id = !empty($_REQUEST['prj_id']) ? trim($_REQUEST['prj_id']) : ""; $sql = "select * from " . $ecs->table("exam") . " where prj_id='" . $prj_id . "'"; $rows = $db->getAll($sql); $title = "《" . get_exam_prj_name($prj_id) . "》考试安排"; $notice = '<table cellspacing="0" cellpadding="0" style="width:100%"><tbody>'; $notice .= '<tr style="font-weight:bold;">'; $notice .= '<td style="text-align:center;width:15%;border:1px solid rgb(27, 240, 180)">考试科目</td>'; $notice .= '<td style="text-align:center;width:15%;border:1px solid rgb(27, 240, 180)">监考老师</td>'; $notice .= '<td style="text-align:center;border:1px solid rgb(27, 240, 180)">考试日期</td>'; $notice .= '<td style="text-align:center;border:1px solid rgb(27, 240, 180)">考试起止时间</td>'; $notice .= '<td style="text-align:center;width:20%;border:1px solid rgb(27, 240, 180)">所在教室</td>'; $notice .= '</tr>'; foreach ($rows as $row) { $notice .= '<tr>';