首页  >  文章  >  后端开发  >  【php】7、学生管理系统-管理员查看用户

【php】7、学生管理系统-管理员查看用户

PHP中文网
PHP中文网原创
2016-08-08 09:25:161195浏览

【php】7、学生管理系统-管理员查看用户

<?php  
    include_once &#39;../stuService.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 stuservice();  
  
    $pagecount = $service->getpagecount($pagesize);  
  
    if(!empty($_GET[&#39;pagenow&#39;]))  
    {  
        $pagenow=$_GET[&#39;pagenow&#39;];  
    }  
  
    $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-8" />  
    <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[&#39;stu_id&#39;];  
                     $passwd = $row[&#39;stu_password&#39;]; //学生进来不能看到密码  
              ?>  
                <tr>   
                    <td background="../pic/in_20.gif"></td>  
                    <td background="../pic/in_20.gif"><?php echo stripslashes($row[&#39;stu_id&#39;]);?></td>  
                    <td background="../pic/in_20.gif"><?php echo stripslashes($row[&#39;stu_name&#39;]);?></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=&#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;adminstudentlist.php?pagenow=$prePage&#39;>上一页</a>   ";  
                     echo "<a href=&#39;adminstudentlist.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;adminstudentlist.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;adminstudentlist.php?pagenow=$nextPage&#39;>》》</a>   ";  
                     echo "<a href=&#39;adminstudentlist.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】7、学生管理系统-管理员查看用户,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助,更多相关内容请关注PHP中文网(www.php.cn)! 


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn