<?php session_start();
if($_SESSION['admin'] != null) { ?>
<!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"> <head>
<title>Xem điểm thi</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="style.css" rel="stylesheet" type="text/css" />
</head> <body> <div class="main"> <div class="header_resize"> <div class="header"> <?php include('menu.php'); ?> <div class="clr"></div> </div> </div> <div class="clr"></div> <div class="header_name"> <div class="header_name_resize"> <h2>Admin</h2> </div> </div> <div class="clr"></div> <div class="body">
<div class="body_resize box_radius"> <div class="right">
<h2>ThĂªm ID sinh viĂªn</h2>
<?php echo $_SESSION['errorp']; ?>
<form action="viewpoint.php?addpoint" method="post" id="contactform"> <ol>
<li>
<label >MĂ£ sinh viĂªn</label>
<input name="mssv" class="text" /> </li>
<li>
<label >ToĂ¡n</label> <select name="toan">
<option value="1" >1</option> <option value="2" >2</option> <option value="3" >3</option> <option value="4" >4</option> <option value="5" >5</option> <option value="6" >6</option> <option value="7" >7</option> <option value="8" >8</option> <option value="9" >9</option> <option value="10" >10</option> </select>
</li> <li>
<label >LĂ½</label> <select name="ly">
<option value="1" >1</option> <option value="2" >2</option> <option value="3" >3</option> <option value="4" >4</option> <option value="5" >5</option> <option value="6" >6</option> <option value="7" >7</option> <option value="8" >8</option> <option value="9" >9</option> <option value="10" >10</option> </select>
</li>
<li> <label >HĂ³a</label> <select name="hoa">
<option value="1" >1</option> <option value="2" >2</option> <option value="3" >3</option> <option value="4" >4</option> <option value="5" >5</option> <option value="6" >6</option> <option value="7" >7</option> <option value="8" >8</option>
<option value="10" >10</option> </select> </li> <li> <label >Văn</label> <select name="van">
<option value="1" >1</option> <option value="2" >2</option> <option value="3" >3</option> <option value="4" >4</option> <option value="5" >5</option> <option value="6" >6</option> <option value="7" >7</option> <option value="8" >8</option> <option value="9" >9</option> <option value="10" >10</option> </select>
</li>
<li class="buttons">
<input type="image" name="addsv" id="imageField" src="images/send.gif" class="send" /> <div class="clr"></div> </li> </ol> </form> </div> <div class="clr"></div> </div> </div> <div class="clr"></div> </div> <div class="clr"></div> <div class="footer"> <div class="footer_resize">
<p class="leftt">© Copyright . All Rights Reserved<br />
<p class="rightt"><span class="right"><strong>Website</strong></span></p> <div class="clr"></div>
</div> </div> </body>
</html> <?php } else{
header("Location:admincp.php"); } ?>
Sau khi người Quản trị thêm điểm số của Sinh viên vào hệ thống và hệ thống sẽ truy xuất ra được kết quả sau:
unset($_SESSION['sqlsv']); unset($_SESSION['errorp']); if($_REQUEST['mssv']){ $mssv = $_REQUEST['mssv'];
$sql = mysql_query("SELECT * FROM bang_diem WHERE mssv = '$mssv' "); $row = mysql_fetch_array($sql); $count = mysql_num_rows($sql); } if(isset($_GET['updatepoint'])){ $mssv = $_REQUEST['mssv']; $toan = $_POST['toan']; $ly = $_POST['ly']; $hoa = $_POST['hoa']; $van = $_POST['van'];
mysql_query("UPDATE bang_diem set toan = '$toan' , ly = '$ly' , hoa = '$hoa' , van = '$van' WHERE mssv = '$mssv' ");
$_SESSION['sqlp'] = "bạn Ä‘Ă£ cáºp nháºt thĂ nh cĂ´ng"; header("Location:viewpoint.php");
}
if(isset($_GET['delete'])){ $mssv = $_REQUEST['mssv'];
mysql_query("DELETE FROM bang_diem WHERE mssv = '$mssv' "); $_SESSION['sqlp'] = "bạn Ä‘Ă£ xĂ³a thĂ nh cĂ´ng";
header("Location:viewpoint.php"); } if(isset($_GET['addpoint'])){ $mssv = $_POST['mssv']; $toan = $_POST['toan']; $ly = $_POST['ly']; $hoa = $_POST['hoa']; $van = $_POST['van']; if($mssv!=null){
$sqlchecknull = mysql_query(" SELECT * FROM danhsach where mssv = '$mssv' limit 1 "); $countnull = mysql_num_rows($sqlchecknull);
if($countnull==1){
$sqlcheck = mysql_query("SELECT * FROM bang_diem where mssv = '$mssv' limit 1 "); $count = mysql_num_rows($sqlcheck);
$_SESSION['errorp'] = "MĂ£ SV Ä‘Ă£ bị trĂ¹ng" ; header("Location:addpoint.php");
} else {
$sql = mysql_query("INSERT INTO bang_diem( mssv , toan, ly , hoa, van )VALUES( '$mssv' , '$toan' , '$ly' , '$hoa' , '$van')");
$_SESSION['sqlp'] = "bạn Ä‘Ă£ thĂªm Ä‘iá»…m thĂ nh cĂ´ng"; header("Location:viewpoint.php");
} }else{ }else{
$_SESSION['errorp'] = "MĂ£ SV khĂ´ng chĂnh xĂ¡c" ; header("Location:addpoint.php");
} }else{ }else{
$_SESSION['errorp'] = "BỏĂn cha iỏằãn MÊ sinh viên" ; header("Location:addpoint.php");
} } } ?>
<?php if($_SESSION['admin'] != null) { ?>
<!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"> <head>
<title>Xem điểm thi</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="js/jquery.cycle.all.min.js"></script> <script type="text/javascript" src="js/custom.js"></script>
</head> <body> <div class="main"> <div class="header_resize"> <div class="header"> <?php include('menu.php'); ?> <div class="clr"></div> </div> </div>
<div class="header_name"> <div class="header_name_resize"> <h2>Admin</h2> </div> </div> <div class="clr"></div> <div class="body">
<div class="body_resize box_radius"> <div class="right">
<h2>ãiỏằm Sinh viên</h2>
<p><?php echo $_SESSION['sqlp']; ?></p> <table id="hor-minimalist-b" summary="Employee Pay Sheet"> <thead>
<tr>
<th scope="col">MĂ£ Sinh ViĂªn</th> <th scope="col">ToĂ¡n</th> <th scope="col">LĂ½</th> <th scope="col">HĂ³a</th> <th scope="col">Văn</th> <th scope="col">Thao tĂ¡c</th> </tr> </thead> <tbody>
<?php $sql = mysql_query("SELECT * FROM bang_diem"); while($rows = mysql_fetch_array($sql)){ ?> <tr> <td><?php echo $rows['mssv']; ?></td> <td><?php echo $rows['toan']; ?></td> <td><?php echo $rows['ly']; ?></td> <td><?php echo $rows['hoa']; ?></td> <td><?php echo $rows['van']; ?></td>
<td><a href="editpoint.php?mssv=<?php echo $rows['mssv']; ?>" >Sá»a | <a href="deletepoint.php?mssv=<?php echo $rows['mssv']; ?>" >XĂ³a </a></td> </tr>
<?php } ?> </tbody>
</table> </div> <div class="clr"></div> </div> </div> <div class="clr"></div> </div> <div class="clr"></div> <div class="footer"> <div class="footer_resize">
<p class="leftt">© Copyright . All Rights Reserved<br />
<p class="rightt"><span class="right">(DT) <a href="http://www.dreamtemplate.com"><strong>Website Templates</strong></a></span></p> <div class="clr"></div> </div> </div> </body> </html> <?php } else{ header("Location:admincp.php"); } ?> 5) Cơ sở dữ liệu CSDL – Danh sách SV
SELECT*
FROM`danhsach` LIMIT 0 , 30
SELECT*
FROM`bang_diem` LIMIT 0 , 30
SELECT*
FROM`user_pwd` LIMIT 0 , 30