// 사용자 ID $user_id=$member[user_id]; // 자기가 관리한 반만 볼 수 있도록 제한 // call pear init & call call_pear_init(); require_once("DB.php"); require_once("HTML/Template/IT.php"); // Template $tpl = new HTML_Template_IT("/home/hosting_users/academysoft/www/templates"); if(!$tpl->loadTemplatefile("movie_view.tpl.htm", true, true)) Error("loadTemplatefile"); // DB 접속 $db =& DB::connect(call_pear_db_dsn()); if (PEAR::isError($db)) { die($db->getMessage()); } // 암호풀기 $movie_seq = (int)call_decrypt($user_id,$p_movie_seq); $movie_sch_seq = (int)call_decrypt($user_id,$p_movie_sch_seq); // 조회 $sql = "SELECT m.MOVIE_ID, m.TITLE, s.PLAN_ILSI, m.URL " ." FROM TB_MOVIE m, TB_MOVIE_SCH s " ." WHERE s.MOVIE_SEQ = m.SEQ " ." AND s.MOVIE_SEQ = $movie_seq " ." AND s.CLASS_ID = '$_SESSION[ss_class_id]' ";
function func_state_request($bookid, $examid, $userid, $examlgubun, $examsgubun) { echo $elapsedtime; // 권한 검사 $connect=dbConn(); $member=member_info(); call_pear_init(); require_once("DB.php"); // DB 접속 $db =& DB::connect(call_pear_db_dsn()); if (PEAR::isError($db)) { die($db->getMessage()); } //****************************** // CLASS_ID 찾기 $sql = "SELECT TB_REG1.CLASS_ID " ." FROM TB_CLASS, TB_REG1 " ." WHERE TB_REG1.USER_ID = '$userid' " ." AND BOOK_ID = '$bookid' " ." AND TB_REG1.CLASS_ID = TB_CLASS.CLASS_ID"; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $class_id = $row[0]; } //****************************** // TB_EXAM.SEQ 찾기 $sql = "SELECT SEQ " ." FROM TB_EXAM " ." WHERE BOOK_ID = '$bookid' " ." AND EXAM_ID = '$examid' "; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $exam_seq = $row[0]; } //****************************** // TB_EXAM_SCH.SEQ 찾기 $sql = "SELECT SEQ " ." FROM TB_EXAM_SCH " ." WHERE CLASS_ID = '$class_id' " ." AND EXAM_SEQ = '$exam_seq' "; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $exam_sch_seq = $row[0]; } $sql = "SELECT r.EXAM_START, r.EXAM_END, r.CUR_QST_SEQ, r.ELAPSED_TIME, r.RETAKE_CNT, r.SKIP_NO " ." FROM TB_EXAM_SCH s, TB_EXAM e, TB_EXAM_REC r " ." WHERE e.EXAM_ID = '$examid' " ." AND r.USER_ID = '$userid' " ." AND e.BOOK_ID = '$bookid' " ." AND r.EXAM_SCH_SEQ = '$exam_sch_seq' "; $res =& $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $r_examstart = $row[0]; $r_examend = $row[1]; $r_curqstseq = $row[2]; $r_elapsedtime = $row[3]; $r_retakecnt = $row[4]; $r_skipno = $row[5]; } $arr = array($r_examstart, $r_examend, $r_curqstseq, $r_elapsedtime, $r_retakecnt, $r_skipno); $rtn = implode(",", $arr); echo $rtn; }
function func_reg_ing($bookid, $examid, $userid, $examlgubun, $examsgubun, $elapsedtime) { // 권한 검사 $connect=dbConn(); $member=member_info(); call_pear_init(); require_once("DB.php"); // DB 접속 $db =& DB::connect(call_pear_db_dsn()); if (PEAR::isError($db)) { die($db->getMessage()); } //****************************** // CLASS_ID 찾기 $sql = "SELECT TB_REG1.CLASS_ID " ." FROM TB_CLASS, TB_REG1 " ." WHERE TB_REG1.USER_ID = '$userid' " ." AND BOOK_ID = '$bookid' " ." AND TB_REG1.CLASS_ID = TB_CLASS.CLASS_ID"; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $class_id = $row[0]; } //****************************** // TB_EXAM.SEQ 찾기 $sql = "SELECT SEQ " ." FROM TB_EXAM " ." WHERE BOOK_ID = '$bookid' " ." AND EXAM_ID = '$examid' "; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $exam_seq = $row[0]; } //****************************** // TB_EXAM_SCH.SEQ 찾기 $sql = "SELECT SEQ " ." FROM TB_EXAM_SCH " ." WHERE CLASS_ID = '$class_id' " ." AND EXAM_SEQ = '$exam_seq' "; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $exam_sch_seq = $row[0]; } // select 문제번호를 불러온다. $sql = "SELECT SEQ " ." FROM TB_EXAM_REC " ." WHERE USER_ID = '$userid' " ." AND EXAM_SCH_SEQ = '$exam_sch_seq' "; echo $sql; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $r_seq = $row[0]; } // TB_EXAM_REC RECORD UPDATE $sth = $db->prepare("UPDATE TB_EXAM_REC SET ELAPSED_TIME = ? WHERE SEQ = ?"); $data = array($elapsedtime, $r_seq); $db->execute($sth, $data ); echo "update complete : "; echo $elapsedtime; } // end function func_reg_ing
function func_reg_Skip($bookid, $examid, $userid, $p_examlgubun, $p_examsgubun, $skipno, $elapsedtime) { // 권한 검사 $connect=dbConn(); $member=member_info(); call_pear_init(); require_once("DB.php"); // DB 접속 $db =& DB::connect(call_pear_db_dsn()); if (PEAR::isError($db)) { die($db->getMessage()); } //****************************** // CLASS_ID 찾기 $sql = "SELECT TB_REG1.CLASS_ID " ." FROM TB_CLASS, TB_REG1 " ." WHERE TB_REG1.USER_ID = '$userid' " ." AND BOOK_ID = '$bookid' " ." AND TB_REG1.CLASS_ID = TB_CLASS.CLASS_ID"; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $class_id = $row[0]; } //****************************** // TB_EXAM.SEQ 찾기 $sql = "SELECT SEQ " ." FROM TB_EXAM " ." WHERE BOOK_ID = '$bookid' " ." AND EXAM_ID = '$examid' "; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $exam_seq = $row[0]; } //****************************** // TB_EXAM_SCH.SEQ 찾기 $sql = "SELECT SEQ " ." FROM TB_EXAM_SCH " ." WHERE CLASS_ID = '$class_id' " ." AND EXAM_SEQ = '$exam_seq' "; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $exam_sch_seq = $row[0]; } //****************************** $sql = "SELECT SEQ, SKIP_NO " ." FROM TB_EXAM_REC " ." WHERE EXAM_SCH_SEQ = '$exam_sch_seq' " ." AND USER_ID = '$userid' "; $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $r_seq = $row[0]; } //****************************** $res = $db->query($sql); if (PEAR::isError($db)) { die($db->getMessage()); } while ($res->fetchInto($row)) { $r_skipno = $row[1]; } $r_skipno = $skipno."@".$r_skipno; // 문제번호 추가 // 수정 $sth = $db->prepare("UPDATE TB_EXAM_REC SET SKIP_NO = ?, UPDATE_ILSI = now(), ELAPSED_TIME = ? WHERE SEQ = ?"); $data = array($r_skipno, $elapsedtime, $r_seq); $db->execute($sth, $data ); }