ホームページ  >  記事  >  バックエンド開発  >  [php] 8. 学生管理システム - 管理者を表示

[php] 8. 学生管理システム - 管理者を表示

WBOY
WBOYオリジナル
2016-06-13 12:18:501411ブラウズ

[php] 8. 学生管理システム - 管理者を表示

<?php    include_once &#39;adminService.class.php&#39;;    include_once &#39;admin.class.php&#39;;        session_start();    $name = $_SESSION[&#39;admin_name&#39;];        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-8" />	<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[&#39;admin_id&#39;];		             $passwd = md5($row[&#39;admin_password&#39;]); //学生进来不能看到密码		      ?>                <tr>                     <td background="../pic/in_20.gif"></td>                    <td background="../pic/in_20.gif"><?php echo stripslashes($row[&#39;admin_id&#39;]);?></td>                    <td background="../pic/in_20.gif"><?php echo stripslashes($row[&#39;admin_name&#39;]);?></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=&#39;../pic/in_20.gif&#39; />";		         echo "<td background=&#39;../pic/in_20.gif&#39;>";		         //显示上一页和下一页		         if($pagenow > 1)		         {		             $prePage=$pagenow - 1;		             echo "<a href=&#39;adminlist.php?pagenow=$prePage&#39;>上一页</a>   ";		             echo "<a href=&#39;adminlist.php?pagenow=$prePage&#39;>《《</a>   ";		         }		         echo "</td>";		         echo "<td background=&#39;../pic/in_20.gif&#39;>";		         //中间打印10页选择		         for($i=$pagenow; $i < $pagenow+10; ++$i)		         {		             if($i <= $pagecount)		             {		                 echo "<a href=&#39;adminlist.php?pagenow=$i&#39;>$i</a>   ";		             }		         }		         echo "</td>";		         echo "<td background=&#39;../pic/in_20.gif&#39;>";		         //下一页		         if($pagenow < $pagecount)		         {		             $nextPage=$pagenow+1;		             echo "<a href=&#39;adminlist.php?pagenow=$nextPage&#39;>》》</a>   ";		             echo "<a href=&#39;adminlist.php?pagenow=$nextPage&#39;>下一页</a>   ";		         		         }		         echo "</td>";		         echo "<td background=&#39;../pic/in_20.gif&#39;>";		         echo "当前页$pagenow/共{$pagecount}页面";		         echo "</td>";		         echo "<td background=&#39;../pic/in_20.gif&#39;>";		         echo "</td>";		         echo "</tr>";             ?>             <tr>                <td background="../pic/in_20.gif"></td>                <td background=&#39;../pic/in_20.gif&#39;> 跳转到:<input type="text" name="pagenow" /></td>                <td background=&#39;../pic/in_20.gif&#39;><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 &#39;adminService.class.php&#39;;        session_start();    $name = $_SESSION[&#39;admin_name&#39;];        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-8" />	<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[&#39;admin_id&#39;];		             $passwd = $row[&#39;admin_password&#39;]; //学生进来不能看到密码		      ?>                <tr>                     <td background="../pic/in_20.gif"></td>                    <td background="../pic/in_20.gif"><?php echo stripslashes($row[&#39;admin_id&#39;]);?></td>                    <td background="../pic/in_20.gif"><?php echo stripslashes($row[&#39;admin_name&#39;]);?></td>                    <td background="../pic/in_20.gif"><?php echo stripslashes($passwd); ?></td>                    <td background="../pic/in_20.gif"><?php echo stripslashes($row[&#39;power&#39;]); ?></td>                    <td background="../pic/in_20.gif"><a href="<?php echo "updateadmin.php?id=".$id; ?>">修改用户</a></td>	           </tr>	           <?php 		         }		         echo "<tr>";		         echo "<td background=&#39;../pic/in_20.gif&#39; />";		         echo "<td background=&#39;../pic/in_20.gif&#39;>";		         //显示上一页和下一页		         if($pagenow > 1)		         {		             $prePage=$pagenow - 1;		             echo "<a href=&#39;adminlist.php?pagenow=$prePage&#39;>上一页</a>   ";		             echo "<a href=&#39;adminlist.php?pagenow=$prePage&#39;>《《</a>   ";		         }		         echo "</td>";		         echo "<td background=&#39;../pic/in_20.gif&#39;>";		         //中间打印10页选择		         for($i=$pagenow; $i < $pagenow+10; ++$i)		         {		             if($i <= $pagecount)		             {		                 echo "<a href=&#39;adminlist.php?pagenow=$i&#39;>$i</a>   ";		             }		         }		         echo "</td>";		         echo "<td background=&#39;../pic/in_20.gif&#39;>";		         //下一页		         if($pagenow < $pagecount)		         {		             $nextPage=$pagenow+1;		             echo "<a href=&#39;adminlist.php?pagenow=$nextPage&#39;>》》</a>   ";		             echo "<a href=&#39;adminlist.php?pagenow=$nextPage&#39;>下一页</a>   ";		         		         }		         echo "</td>";		         echo "<td background=&#39;../pic/in_20.gif&#39;>";		         echo "当前页$pagenow/共{$pagecount}页面";		         echo "</td>";		         echo "<td background=&#39;../pic/in_20.gif&#39;>";		         echo "</td>";		         echo "</tr>";             ?>             <tr>                <td background="../pic/in_20.gif"></td>                <td background=&#39;../pic/in_20.gif&#39;> 跳转到:<input type="text" name="pagenow" /></td>                <td background=&#39;../pic/in_20.gif&#39;><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>

プレビュー:






声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。