【php】7、學生管理系統-管理員查看用戶
來源:程序員人生 發布時間:2015-05-07 09:56:17 閱讀次數:2761次
<?php
include_once '../stuService.class.php';
session_start();
$name = $_SESSION['admin_name'];
if($name == "")
{
header("Location: admin_login.php?error=1");
exit();
}
$pagesize = 12;
$pagenow = 1;
$pagecount = 0;
$service = new stuservice();
$pagecount = $service->getpagecount($pagesize);
if(!empty($_GET['pagenow']))
{
$pagenow=$_GET['pagenow'];
}
$stulist = $service->getstulist($pagesize, $pagenow);
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf⑻" />
<title>學生成績管理系統</title>
</head>
<body background="../pic/bg.gif">
<form action="adminstudentlist.php" method="get">
<table width="767" height="644" border="0" align="center">
<tr>
<td height="228" colspan="5" background="../pic/top.gif" />
</tr>
<tr>
<td height="22" colspan="5" background="../pic/in_01.gif" />
</tr>
<tr>
<td height="28" background="../pic/in_20.gif" />
<td background="../pic/in_20.gif">學生ID號</td>
<td background="../pic/in_20.gif">學生姓名</td>
<td background="../pic/in_20.gif">學生密碼</td>
<td background="../pic/in_20.gif">修改用戶</td>
<td background="../pic/in_20.gif">刪除用戶</td>
</tr>
<?php
for($i = 0; $i < count($stulist); ++$i)
{
$row=$stulist[$i]; //取出第i行數據,顯示出來
$id = $row['stu_id'];
$passwd = $row['stu_password']; //學生進來不能看到密碼
?>
<tr>
<td background="../pic/in_20.gif"></td>
<td background="../pic/in_20.gif"><?php echo stripslashes($row['stu_id']);?></td>
<td background="../pic/in_20.gif"><?php echo stripslashes($row['stu_name']);?></td>
<td background="../pic/in_20.gif"><?php echo stripslashes($passwd); ?></td>
<td background="../pic/in_20.gif"><a href="<?php echo "updateuser.php?id=".$id; ?>">修改用戶</a></td>
<td background="../pic/in_20.gif"><a href="<?php echo "deleteuser.php?id=".$id; ?>">刪除用戶</a></td>
</tr>
<?php
}
echo "<tr>";
echo "<td background='../pic/in_20.gif' />";
echo "<td background='../pic/in_20.gif'>";
//顯示上1頁和下1頁
if($pagenow > 1)
{
$prePage=$pagenow - 1;
echo "<a href='adminstudentlist.php?pagenow=$prePage'>上1頁</a> ";
echo "<a href='adminstudentlist.php?pagenow=$prePage'>《《</a> ";
}
echo "</td>";
echo "<td background='../pic/in_20.gif'>";
//中間打印10頁選擇
for($i=$pagenow; $i < $pagenow+10; ++$i)
{
if($i <= $pagecount)
{
echo "<a href='adminstudentlist.php?pagenow=$i'>$i</a> ";
}
}
echo "</td>";
echo "<td background='../pic/in_20.gif'>";
//下1頁
if($pagenow < $pagecount)
{
$nextPage=$pagenow+1;
echo "<a href='adminstudentlist.php?pagenow=$nextPage'>》》</a> ";
echo "<a href='adminstudentlist.php?pagenow=$nextPage'>下1頁</a> ";
}
echo "</td>";
echo "<td background='../pic/in_20.gif'>";
echo "當前頁$pagenow/共{$pagecount}頁面";
echo "</td>";
echo "<td background='../pic/in_20.gif'>";
echo "</td>";
echo "</tr>";
?>
<tr>
<td background="../pic/in_20.gif"></td>
<td background='../pic/in_20.gif'> 跳轉到:<input type="text" name="pagenow" /></td>
<td background='../pic/in_20.gif'><input type="submit" value="GO" /></td>
<td background="../pic/in_20.gif"></td>
<td background="../pic/in_20.gif"></td>
<td background="../pic/in_20.gif"></td>
</tr>
</table>
</form>
</body>
</html>
預覽:

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈