程序员人生 网站导航

【php】8、学生管理系统-查看管理员

栏目:互联网时间:2015-06-06 08:51:43
<?php include_once 'adminService.class.php'; include_once 'admin.class.php'; session_start(); $name = $_SESSION['admin_name']; if($name == "") { header("Location: admin_login.php?error=1"); exit(); } $admin = new admin(); $service = new adminservice(); $admin = $service->getAdminByName($name); $ii = $admin->getPower(); if($ii > 1) { header("Location: godAdminlist.php"); exit(); } $pagesize = 12; $pagenow = 1; $pagecount = 0; $pagecount = $service->getpagecount($pagesize); if(!empty($_GET['pagenow'])) { $pagenow=$_GET['pagenow']; } $adminlist = $service->getadminlist($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="adminlist.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($adminlist); ++$i) { $row=$adminlist[$i]; //取出第i行数据,显示出来 $id = $row['admin_id']; $passwd = md5($row['admin_password']); //学生进来不能看到密码 ?> <tr> <td background="../pic/in_20.gif"></td> <td background="../pic/in_20.gif"><?php echo stripslashes($row['admin_id']);?></td> <td background="../pic/in_20.gif"><?php echo stripslashes($row['admin_name']);?></td> <td background="../pic/in_20.gif"><?php echo stripslashes($passwd); ?></td> <td background="../pic/in_20.gif"></td> <td background="../pic/in_20.gif"></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='adminlist.php?pagenow=$prePage'>上1页</a>   "; echo "<a href='adminlist.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='adminlist.php?pagenow=$i'>$i</a>   "; } } echo "</td>"; echo "<td background='../pic/in_20.gif'>"; //下1页 if($pagenow < $pagecount) { $nextPage=$pagenow+1; echo "<a href='adminlist.php?pagenow=$nextPage'>》》</a>   "; echo "<a href='adminlist.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>

如果登陆的是超级管理员的话:

<?php include_once 'adminService.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 adminservice(); $pagecount = $service->getpagecount($pagesize); if(!empty($_GET['pagenow'])) { $pagenow=$_GET['pagenow']; } $adminlist = $service->getadminlist($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="adminlist.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($adminlist); ++$i) { $row=$adminlist[$i]; //取出第i行数据,显示出来 $id = $row['admin_id']; $passwd = $row['admin_password']; //学生进来不能看到密码 ?> <tr> <td background="../pic/in_20.gif"></td> <td background="../pic/in_20.gif"><?php echo stripslashes($row['admin_id']);?></td> <td background="../pic/in_20.gif"><?php echo stripslashes($row['admin_name']);?></td> <td background="../pic/in_20.gif"><?php echo stripslashes($passwd); ?></td> <td background="../pic/in_20.gif"><?php echo stripslashes($row['power']); ?></td> <td background="../pic/in_20.gif"><a href="<?php echo "updateadmin.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='adminlist.php?pagenow=$prePage'>上1页</a>   "; echo "<a href='adminlist.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='adminlist.php?pagenow=$i'>$i</a>   "; } } echo "</td>"; echo "<td background='../pic/in_20.gif'>"; //下1页 if($pagenow < $pagecount) { $nextPage=$pagenow+1; echo "<a href='adminlist.php?pagenow=$nextPage'>》》</a>   "; echo "<a href='adminlist.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>

预览:






------分隔线----------------------------
------分隔线----------------------------

最新技术推荐