/Webboard.php
PHP | 414 lines | 357 code | 57 blank | 0 comment | 59 complexity | 8cc5cb9b364ffa31b2c1d396b9e41abb MD5 | raw file
- <?php
- ob_start();
- session_start();
- if($_POST){
-
- include("connect2.php");
- $user = $_POST["usr"];
- $pass = $_POST["pswd"];
- if (check_login("teacher",$user,$pass)==true)
- {// 1
- if($_SESSION["usertype"] == "admin")
- {
- header("Location:index_admin.php"); //echo $_SESSION["usertype"];
- }
- else if($_SESSION["usertype"] == "teacher")
- {
- header("Location:teacher_page.php");//echo $_SESSION["usertype"];
- }
- else if($_SESSION["usertype"] == "officer")
- {
- header("Location:officer_page.php");//echo $_SESSION["usertype"];
- }
- else if($_SESSION["usertype"] == "teacher_general")
- {
- header("Location:teacherGeneral_page.php");//echo $_SESSION["usertype"];
- }
-
- } //1
- else if(check_login("student",$user,$pass)==true)
- { //2
- header("Location:student_page.php");//echo $_SESSION["usertype"];
- } //2
- else if(check_login("company",$user,$pass)==true)
- { //3
- header("Location:company_page.php");//echo $_SESSION["usertype"];
- } //3
-
- }
- function check_login($table,$user,$pass)
- {
- $sql = "select * from $table where username='$user' and password='$pass'";
- $result = mysql_query($sql);
-
- if(mysql_num_rows($result)>0)
- { //2
-
- $rs = mysql_fetch_array($result);
-
- $_SESSION["username"] = $rs["username"];
-
- if($table == "teacher")
- { //1
- $status = $rs["status"];
- $_SESSION["usertype"] = $status; //ประเภทผู้ใช้ admin officer teacher techerGeneral
- } //1
- else if(($table == "student") or ($table =="company"))
- { //1
-
- $_SESSION["usertype"] =$table;
- } //1
-
- session_write_close();
- mysql_close();
- return true;
- } //2
- else
- { //2
- return false; // login ไม่ผ่าน
- } // end if 2
- } // end function
-
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN" dir="ltr"><!-- InstanceBegin template="/Templates/index_full.dwt.php" codeOutsideHTMLIsLocked="false" -->
- <head profile="http://gmpg.orgs/xfn/11">
- <title>ระบบสารสนเทศฝึกประสบการณ์วิชาชีพฯ :<?php echo $_SESSION['usertype']; ?></title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta http-equiv="imagetoolbar" content="no" />
- <link rel="stylesheet" href="css/layout.css" type="text/css" />
- <link rel="stylesheet" href="css/layout.css" type="text/css" />
- <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" media="screen" />
- <link rel="stylesheet" type="text/css" href="css/style-mix.css" media="screen" />
- <link rel="stylesheet" type="text/css" href="style.css" />
-
-
- <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
- <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
-
- </head>
- <body id="top">
- <div class="wrapper row1">
- <div id="header" class="clear">
- <div class="fl_left">
- <p><img src="img/logo5.png" width="80" height="100"></p>
- </div>
- <div class="fl_center">
- <div class="fl_right" align="right">
- <ul>
- <li><a href="index.php">หนัาหลัก</a></li>
- <li><a href="Webboard.php">เว็บบอร์ด</a></li>
- <?php if(!$_SESSION['username']){?>
- <li><a href="user_login.php">เข้าสู่ระบบ</a></li>
- <li><a href="submit3.php">สมัครสมาชิก</a></li>
- <?php } else { ?>
- <li class="last"><a href="user_logout.php">ออกจากระบบ</a></li>
- <?php } ?>
- </ul>
- </div>
- <br>
- <br>
- <h1> ระบบสารสนเทศฝึกประสบการณ์วิชาชีพ</h1>
- <p> สาขาวิทยาการคอมพิวเตอร์และเทคโนโลยีสารสนเทศ</p>
- </div>
-
- </div>
- </div>
- <div class="wrapper row2">
- <div id="topnav">
- <div class="row-fluid">
- <div class="span9">
- <ul>
- <!-- admin -->
- <? if ($_SESSION["usertype"] == "admin") { ?>
- <li><a href="show_std.php">จัดการข้อมูลนักศึกษา</a></li>
- <li><a href="show_teacher.php">จัดการข้อมูลอาจารย์</a></li>
- <li><a href="show_company.php">จัดการข้อมูลหน่วยงาน</a></li>
- <!-- company -->
- <? } else if ($_SESSION["usertype"] == "company") { ?>
- <li><a href="company_detail.php">ข้อมูลหน่วยงาน</a></li>
- <li><a href="show_request_company.php">แจ้งความจำนงค์รับนักศึกษา</a></li>
- <li><a href="report_StdResume.php">รายงานประวัติส่วนตัวของนักศึกษา</a></li>
- <li><a href="manage_score_forcompany.php">กรอกข้อมูลประเมินผล</a></li>
- <? } else if ($_SESSION["usertype"] == "officer") { ?>
- <!-- officer -->
- <li><a href="#">จัดการข้อมูลหนังสือฝึกประสบการณ์วิชาชีพ</a>
- <ul>
- <li><a href="manage_send_request.php">หนังสือขอความอนุเคราะห์ฝึกประสบการณ์วิชาชีพ</a></li>
- <li><a href="manage_sendSupervision.php">หนังสือนิเทศนักศึกษา</a></li>
- <li><a href="manage_sendStd.php">หนังสือส่งตัวนักศึกษา</a></li>
- <li><a href="manage_sendStd1.php">หนังสือขอตัวนักศึกษา</a></li>
- </ul>
- </li>
- <li><a href="#">จัดการข้อมูลหนังสือโครงการ</a>
- <ul>
- <li><a href="manage_sendProject.php">โครงการปฐมนิเทศก่อนฝึกประสบการณ์</a></li>
- <li><a href="manage_sendSamana.php">โครงการสัมนาหลังฝึกประสบการณ์</a></li>
- </ul>
- </li>
- <? } else if ($_SESSION["usertype"] == "student") { ?>
- <!-- student -->
- <li><a href="resume2.php">ประวัติส่วนตัว</a></li>
- <?php
- include "connect2.php";
- $sql = "select * from register,student where student.std_id = register.std_id and student.std_id = '".$_SESSION['std_id']."' ";
- $rs = mysql_query($sql);
- $row = mysql_fetch_array($rs);
- $num_rows = mysql_num_rows($rs);
-
- $position = $row['position'];
-
- if($num_rows != 0){?>
-
- <li><a href="StdRequest2.php">ส่งคำร้องขอฝึกประสบการณ์</a></li>
- <li><a href="result_request.php">ผลอนุมัติการฝึกประสบการณ์</a></li>
-
- <?php if ($position == 3){?>
-
- <li><a href="show_diary.php">บันทึกประจำวัน</a></li>
-
- <?php }
- } ?>
- <? } else if ($_SESSION["usertype"] == "teacher_general") { ?>
- <!-- teacher_general -->
- <li><a href="show_supervision_forTG.php">ตารางการนิเทศ</a></li>
- <li><a href="show_std_TG.php">ข้อมูลนักศึกษาฝึกประสบการณ์</a></li>
- <li><a href="show_company_TG.php">ข้อมูลแหล่งฝึกประสบการณ์</a></li>
- <li><a href="show_news_forteachergeneral.php">จัดการข่าวประชาสัมพันธ์</a></li>
- <? } else if ($_SESSION["usertype"] == "teacher") { ?>
- <!-- teacher -->
- <li><a href="#">จัดการข้อมูลทั่วไป</a>
- <ul>
- <li><a href="show_std_forteacher.php">ข้อมูลนักศึกษา</a></li>
- <li><a href="show_company_forteacher.php">ข้อมูลแหล่งฝึกประสบการณ์</a></li>
- <li><a href="show_project.php">ข้อมูลโครงการ</a></li>
- <li><a href="show_group.php">ข้อมูลหมู่เรียน</a></li>
- <li><a href="register_new3.php">จัดการหมู่เรียนนักศึกษา</a></li>
- <li><a href="manage_score.php">กรอกข้อมูลประเมินผล</a></li>
- <li><a href="show_titlescore.php">ข้อมูลหัวข้อการประเมินผล</a></li>
- <li><a href="show_news.php">ข้อมูลข่าวประชาสัมพันธ์</a></li>
- <li><a href="show_webboard.php">ข้อมูลกระทู้</a></li>
- </ul>
- </li>
- <li><a href="#">จัดการข้อมูลการนิเทศ</a>
- <ul>
- <li><a href="show_supervision2.php">ตารางการนิเทศนักศึกษา</a></li>
- <li><a href="show_advice.php">ปัญหาที่พบและข้อเสนอแนะจากการนิเทศนักศึกษา</a></li>
- </ul>
- </li>
- <li><a href="confirmRQ.php">อนุมัติแหล่งฝึกงาน</a></li>
- <li><a href="company_comfirmRQ.php">เปลี่ยนสถานะตอบรับการฝึก</a></li>
- <li><a href="#">ดูรายงาน</a>
- <ul>
- <li><a href="show_std_mange.php">ดูรายชื่อนักศึกษา</a></li>
- <li><a href="report_std+company.php">รายชื่อแหล่งฝึกประสบการณ์
- พร้อมทั้งชื่อนักศึกษา</a></li>
- <li><a href="show_request.php">การแจ้งความจำนงขอรับนักศึกษาฝึกประสบการณ์วิชาชีพ
- </a></li>
- <li><a href="Report_Supervision.php">ตารางนิเทศนักศึกษา</a></li>
- <li><a href="report_diary.php">บันทึกประจำวันของนักศึกษา</a></li>
- <li><a href="report_advice.php">ปัญหาที่พบและ
- ข้อเสนอแนะจากหน่วยงาน</a></li>
- <li><a href="show_stdScore.php">ผลการประเมินจากหน่วยงาน</a></li>
- <li><a href="Report_Score.php">คะแนนของนักศึกษา</a></li>
- <li><a href="Report_ScoreSupervision.php">คะแนนการนิเทศ</a></li>
- <li><a href="Report_ScoreDocument.php">คะแนนการดำเนินงานเอกสาร</a></li>
- <li><a href="Report_ScoreActivity.php">คะแนนเข้าร่วมกิจกรรม</a></li>
- <li><a href="Report_ScoreSendDoc.php">คะแนนการส่งเอกสาร</a></li>
- <li><a href="report_grade.php">ผลการประเมิน</a></li>
- </ul>
- </li>
- <? } else { ?>
- <li><a href="index.php">หน้าหลัก</a></li>
- <li><a href="Webboard.php">เว็บบอร์ด</a></li>
- <?php if (!$_SESSION['username']) { ?>
- <li><a href="user_login.php">เข้าสู่ระบบ</a></li>
- <li><a href="submit3.php">สมัครสมาชิก</a></li>
- <?php } else { ?>
- <li><a href="user_logout.php">ออกจากระบบ</a></li>
- </li><?php } ?>
- <? } ?>
- </ul>
- </div>
- <div class="span3" style="height: 50px" align="right">
- <?php
- if($_SESSION['username']) {
- ?>
- <p style="margin-top: 16px;">ยินดีต้อนรับ คุณ <?= $_SESSION['username'] ?> </p>
- <?php
- }
- ?>
- </div>
-
- </div>
- <div class="clear"></div>
- </div>
- </div>
- <div class="wrapper row4">
- <div id="container" class="clear">
-
- <!-- InstanceBeginEditable name="center_body" -->
- <table width="15%" height="27" border="0" align="left" cellpadding="0" cellspacing="0">
- <tr class="bodyresome">
- <td><p class="headsubmit"> </p>
- <p class="headsubmit"><a href="NewQuestion.php">ตั้งกระทู้</a>
- <?
- include("connect2.php");
- $strSQL = "SELECT * FROM webboard ";
- $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
- $Num_Rows = mysql_num_rows($objQuery);
- $Per_Page = 10; // Per Page
- $Page = $_GET["Page"];
- if(!$_GET["Page"])
- {
- $Page=1;
- }
- $Prev_Page = $Page-1;
- $Next_Page = $Page+1;
- $Page_Start = (($Per_Page*$Page)-$Per_Page);
- if($Num_Rows<=$Per_Page)
- {
- $Num_Pages =1;
- }
- else if(($Num_Rows % $Per_Page)==0)
- {
- $Num_Pages =($Num_Rows/$Per_Page) ;
- }
- else
- {
- $Num_Pages =($Num_Rows/$Per_Page)+1;
- $Num_Pages = (int)$Num_Pages;
- }
- $strSQL .=" order by QuestionID DESC LIMIT $Page_Start , $Per_Page";
- $objQuery = mysql_query($strSQL);
- ?>
- </p></td>
- </tr>
- </table>
- <p><br>
- </p>
- <p> </p>
- <table width="620" height="105" border="1" bordercolor="#66CCCC">
- <tr class="headsubmit">
- <th width="61" bgcolor="#66CCCC"> <div align="center">รหัสกระทู้</div></th>
- <th width="166" bgcolor="#66CCCC"> <div align="center">กระทู้</div></th>
- <th width="80" bgcolor="#66CCCC"> <div align="center">ชื่อ</div></th>
- <th width="112" bgcolor="#66CCCC"> <div align="center">วันที่ตั้งกระทู้</div></th>
- <th width="60" bgcolor="#66CCCC"> <div align="center">มุมมอง</div></th>
- <th width="52" bgcolor="#66CCCC"> <div align="center">ตอบ</div></th>
- </tr>
- <?
- while($objResult = mysql_fetch_array($objQuery))
- {
- ?>
- <tr class="bodyresome">
- <td ><div align="center" class="bodyresome">
- <?=$objResult["QuestionID"];?>
- </div></td>
- <td class="bodyresome"><a href="ViewWebboard.php?QuestionID=<?=$objResult["QuestionID"];?>">
- <?=$objResult["Question"];?>
- </a></td>
- <td align="center" class="bodyresome">
- <?=$objResult["Name"];?>
- </td>
- <td><div align="center" class="bodyresome">
- <?=$objResult["CreateDate"];?>
- </div></td>
- <td align="center" class="bodyresome">
- <?=$objResult["View"];?>
- </td>
- <td align="center" class="bodyresome">
- <?=$objResult["Reply"];?>
- </td>
- </tr>
- <?
- }
- ?>
- </table>
- <table width="42%" height="45" border="0" align="left" cellpadding="0" cellspacing="0">
- <tr class="bodyresome">
- <td width="30%" valign="middle"><span class="bodyresome">ผลรวม :
- <?= $Num_Rows;?>
- </span></td>
- <td width="30%" valign="middle"><span class="bodyresome">เอกสาร :
- <?=$Num_Pages;?>
- </span></td>
- <td width="30%" valign="middle"><span class="bodyresome">หน้า :
- <?
- if($Prev_Page)
- {
- echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< ย้อนกลับ</a> ";
- }
- for($i=1; $i<=$Num_Pages; $i++){
- if($i != $Page)
- {
- echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
- }
- else
- {
- echo "<b> $i </b>";
- }
- }
- if($Page!=$Num_Pages)
- {
- echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>ถัดไป>></a> ";
- }
- mysql_close($conn);
- ?>
- </span></td>
- </tr>
- </table>
- <span class="bodyresome"><br>
- </span>
- <link href="css/submit.css" rel="stylesheet" type="text/css" />
- <link href="css/c_bodyrs.css" rel="stylesheet" type="text/css" />
-
-
- <!-- InstanceEndEditable --></div>
- </div>
- <div class="wrapper">
- <div id="copyright" class="clear">
- <div style="width:960px;margin:0 auto; ">
- <p class="fl_left">Copyright (c) 2012 <a href = "http://webhosting.udru.ac.th/~std52040249439" target="_blank">http://www.gen-dev-soft.com/experience-csit/</a> All rights reserved.
- <br>
- Design by Nittaya Kakulphin & Benjawan Sriralat @ Udonthani Rajabhat University.</p>
- </div>
- </div>
- </div>
- </body>
- <!-- InstanceEnd --></html>