PHP考勤登录系统

使用方法更新在PHP考勤登录系统使用方法&演示 – 开发者技术分享点击即可获取

一、作业要求

电计算机实验室考勤登记系统(三张表,班级信息表,考勤表,请假表)可变动(小于等于三个表)

1 admin管理员用户

1.能对班级人员进增、添、删改、查看

2.请假审批(上课前1小时审批有效)

3.设置上课和下课时间。

2 普通用户

    1.查看全部用户迟到、旷课、早退、请假信息,可选择相关主题查询(分页)

2.请假

3.修改用户个人信息

4.上下课签到光控电路

二、实现方法及简单功能介绍

1、建立三张表

1)用户表user,用于记录用户信息,并提前几个信息,用于之后的测试以及DEBUG使用

2)请假审核表qingjia,用于管理请假,其中包含了admin用户信息,同上提前设置

3)时间表shijian,用于设置上下课时间,同上提前设置

2、用户登录

              1)区分普通用户和管理员登录,分别连接不一样的数据库

              2)普通用户账号密码分别是stuxx和stu,xx是号数(01、02、、、22)

              3)管理员登录账号密码都是admin

3、用户操作

1)可退出登录,退出时删除想除session信息

2)上课时间签到,晚签记录迟到,晚签超过15分钟记为旷课,检测重复见到

3)下课时间签离,早签记录早退,检测签到后才能签离

4)可以在上课一个小时前请假,超过时间无效,并可以查询请假进度

5)可以修改个人信息

6)连接用户数据库可查询相关所有用户信息

7)可分主题查询相关信息

4、管理员操作

1)可退出登录,退出时删除想除session信息

 2)可修改用户所有信息

 3)添加删除普通用户

 4)管理请假,连接qianjia表进行相关管理

5)设置上下课时间

6)连接用户数据库可查询相关所有用户信息

7)可分主题查询相关信息

三、登录界面

<? php
    session_start();  
    if($_POST['submit'])  
    {  
        $con = mysql_connect("localhost", "root", "111");  
        mysql_query("set names 'utf-8'");  
        mysql_select_db("du", $con);  
        $name = $_POST['user'];  
        $password = $_POST['password'];  
        if($_POST["radio"] == "radio1")  
        {  
            $sql = "select * from user where name ='$name' and password ='$password'" ;  
            $resultSet = mysql_query($sql);  
            mysql_close($con);  
            if(mysql_num_rows($resultSet)>0)  
            {  
                $_SESSION["user"] =  $name;  
                if(isset($_SESSION['user']))  
                    echo "<script>location.href='user.php';</script>";  
            }  
            else  
                echo "<script>alert('登录失败!如果忘记密码请联系管理员!')</script>";  
        }  
        else if($_POST["radio"] == "radio2")  
        {  
            $sql = "select * from qingjia where name ='$name' and shenpi ='$password'" ;  
            $resultSet = mysql_query($sql);  
            mysql_close($con);  
            if(mysql_num_rows($resultSet)>0)  
            {  
                $_SESSION["admin"] =  $name;  
                if(isset($_SESSION['admin']))  
                    echo "<script>location.href='admin.php';</script>";  
            }  
            else  
                echo "<script>alert('登录失败!如果忘记密码请联系管理员!')</script>";  
        }  
          
    }  
?>  
<!doctype html>  
<html>  
<head>  
<meta charset = "utf-8" >
< title > shaynerain学生考勤系统 </ title >
</ head >

<body style = "text-align: center; background-color: rgba(176,235,240,1.00);" >
< form id="form1" name="form1" method="post">  
<br><br><br><br>  
    <h1 >用户登录</h1><br>  
  <p>  
    <label for="user" >  
    用户名:</label>  
    <input type = "text" name="user" id="user">  
    <label for="password"><br><br>  
      密码:</label>  
     <input type = "password" name="password" id="password"><br><br>  
    <input name = "radio" type="radio" id="radio" value="radio1" checked="checked">  
    <label for="radio">普通用户</label>  
    <input type = "radio" name="radio" id="radio" value="radio2">  
    <label for="radio">管理员</label><br><br>  
    <input type = "submit" name="submit" id="submit" value="登录" >  
</form>  
   
<form>  
  Copyright © 2016-2018, Shaynerain Du, All Rights Reserved
</form>  
   
</body>  
</html>  

四、普通用户相关操作

1、主界面

<? php
    session_start();  
    //获取上课时间用于判断迟到早退  
    $con = mysql_connect("localhost", "root", "111");  
    mysql_query("set names 'utf-8'");  
    mysql_select_db("du", $con);  
    $stime = mysql_query("select * from shijian where id='1'",$con);  
    $stime=mysql_fetch_assoc($stime);  
    mysql_close($con);  
    //退出登录      flag 1退出    2修改 3签到 4签离 5请假 6查询  
    if($_GET["flag"] == 1){  
        session_unset();  
    }  
    //链接数据库  
    if(isset($_SESSION['user']))  
    {  
        $con = mysql_connect("localhost", "root", "111");  
        mysql_query("set names 'utf-8'");  
        mysql_select_db("du", $con);  
        if(isset($_GET['page']) && (int)$_GET['page']>0)  
            $Page=$_GET['page'];  
        else      
            $Page=1;  
        $resultSet = mysql_query("select * from user",$con);  
        $RecordCount=mysql_num_rows($resultSet);  
        $PageCount =ceil($RecordCount/10);  
        $sql = "select name,phone,email,chidao,zaotui,kuangke,qingjia from user";  
        $resultSet = mysql_query($sql);  
    }  
    else  
    {  
        echo "<script>location.href='login.php';</script>";  
    }  
    //修改个人信息  
    if($_GET['flag'] == 2)  
    {  
        echo "<script>location.href='xinxi.php';</script>";  
    }  
    //签到        user中qiandao   1为签到  2为签离    
    if($_GET['flag'] == 3)  
    {  
        $name = $_SESSION['user'];  
        $sql = "select qiandao from user where name='$name'";  
        $result = mysql_query($sql);  
        $row=mysql_fetch_assoc($result);   
        $qiandao = $row['qiandao'];  
        if($qiandao  == '1')  
        {  
            echo "<script>alert('您已经签到过了')</script>";  
            echo "<script>location.href='user.php';</script>";  
        }  
        mysql_query("UPDATE user SET qiandao=1 WHERE name='$name'");  
        //得到数据库的上下课时间  
        $uptime = $stime['shangke'];  
        $dowmtime = $stime['xiake'];  
        //获取当前时间  
        date_default_timezone_set('Asia/Shanghai');  
        $time = getdate();  
        //以下判断迟到事件,上课十五分钟之内  
        if(($uptime<=($time[hours].$time[minutes].$time[seconds]))&&($uptime>($time[hours].$time[minutes].$time[seconds])-1500))  
        {  
            $sql = "select chidao from user where name='$name'";  
   
            $result = mysql_query($sql);  
            $row=mysql_fetch_assoc($result);  
            $chidao = $row["chidao"];  
            $chidao++;  
            mysql_query("UPDATE user SET chidao='$chidao' WHERE name='$name'");  
            echo "<script>location.href='user.php';</script>";  
        }  
        //以下是判断旷课事件,上课15之后还未到  
        else if(($dowmtime>=($time[hours].$time[minutes].$time[seconds]))&&($uptime<($time[hours].$time[minutes].$time[seconds])-1500))  
        {  
            $sql = "select kuangke from user where name='$name'";  
   
            $result = mysql_query($sql);  
            $row=mysql_fetch_assoc($result);  
            $kuangke = $row["kuangke"];  
            $kuangke++;  
            mysql_query("UPDATE user SET kuangke='$kuangke' WHERE name='$name'");  
            echo "<script>location.href='user.php';</script>";  
        }  
          
    }  
    //签离  
    if($_GET['flag'] == 4)  
    {  
        $name = $_SESSION['user'];  
        $sql = "select qiandao from user where name='$name'";  
        $result = mysql_query($sql);  
        $row=@mysql_fetch_assoc($result);  
        $qiandao = $row['qiandao'];  
        if($qiandao  == '0')  
        {  
            echo "<script>alert('您已经签离过了')</script>";  
            echo "<script>location.href='user.php';</script>";  
        }  
        mysql_query("UPDATE user SET qiandao=0 WHERE name='$name'");  
        //得到数据库的上下课时间  
	        $uptime = $stime['shangke'];  
	        $dowmtime = $stime['xiake'];  
	        //获取当前时间  
	        date_default_timezone_set('Asia/Shanghai');  
	        $time = getdate();  
	        //判断早退事件  
	        if(($uptime<($time[hours].$time[minutes].$time[seconds]))&&($dowmtime>=($time[hours].$time[minutes].$time[seconds])))  
	        {  
	            $sql = "select zaotui from user where name='$name'";  
	   
	            $result = mysql_query($sql);  
	            $row=mysql_fetch_assoc($result);  
	            $zaotui = $row["zaotui"];  
	            $zaotui++;  
	            mysql_query("UPDATE user SET zaotui='$zaotui' WHERE name='$name'");  
	              
	            echo "<script>location.href='user.php';</script>";  
	        }  
	    }  
	    //请假  
	    if($_GET['flag'] == 5)  
	    {  
	        echo "<script>location.href='qingjia.php';</script>";  
	    }  
	    //请假进度  
	    if($_GET['flag'] == 6)  
	    {  
	        $name = $_SESSION['user'];  
	        $sql = "select shenpi from qingjia where name='$name'";  
	        $result = mysql_query($sql);  
	        $row=@mysql_fetch_assoc($result);  
	        $jindu = $row['shenpi'];  
	        if($jindu == '')  
	            echo "<script>alert('用户没有请假')</script>";  
	        else  
	        {  
	            echo "<script>alert('$jindu')</script>";  
	            echo "<script>location.href='user.php';</script>";  
	        }  
	          
	    }  
	?>  
	<!doctype html>  
	<html>  
	<head>  
	<meta charset="utf-8">  
	<title>shaynerain学生考勤系统</title>  
	</head>  
	<body style="text-align: center; background-color: rgba(176,235,240,1.00);">  
	<h1>欢迎登陆shaynerain考勤系统</h1>  
	<p>用户名:<a style="color:rgba(45,5,251,1.00)"><?= $_SESSION['user'] ?></a>  <a  href="user.php?flag=1">退出登录</a></p>  
	<p>请选择你的操作:   
	<!--flag 1退出 2修改 3签到 4签离 5请假 6查询-->  
	<a href="user.php?flag=3" >签到</a>    
	<a href="user.php?flag=4" >签离</a>    
	<a href="user.php?flag=5" >请假</a>    
	<a href="user.php?flag=6" >查询请假进度</a>    
	<a href="user.php?flag=2">修改个人信息</a></p><br>  
	<form id="form1" name="form1" method="post" action="chaxun.php">  
	    <tr colspan="10">  
	    查询:  <input type="text" name="chaxun" id="chaxun " />  
	    <select name="xuanze" id="选择">  
	                        <option value="name">姓名</option>  
	                        <option value="phone">电话</option>  
	                        <option value="email">email</option>  
	                        <option value="chidao">迟到</option>  
	                        <option value="zaotui">早退</option>  
	                        <option value="kuangke">旷课</option>  
	                        <option value="qingjia">请假</option>  
	                   </select>  
	        <input type="submit" name="submit" id="submit" value="确认" />  
	    <tr>  
	</form>  
	<br>  
	 <table width="100%" border="2">  
	  <tbody>  
	    <tr>  
	      <th scope="col" width="15%">姓名</th>  
	      <th scope="col" width="15%">电话</th>  
	      <th scope="col" width="14%">email</th>  
	      <th scope="col" width="14%">迟到</th>  
	      <th scope="col" width="14%">早退</th>  
	      <th scope="col" width="14%">旷课</th>  
	      <th scope="col" width="14%">请假</th>  
	    </tr>  
	    <?  
	        @mysql_data_seek($resultSet,($Page-1)*10);//将结果集的指针移动指定的行数  
	        for($i=0;$i<10;$i++)  
	        {  
	            $row=@mysql_fetch_assoc($resultSet);   
	            if($row){  
	    ?>  
	    <tr>  
	      <th scope="col" width="15%"><?=$row['name'] ?></th>  
	      <th scope="col" width="15%"><?=$row['phone'] ?></th>  
	      <th scope="col" width="14%"><?=$row['email'] ?></th>  
	      <th scope="col" width="14%"><?=$row['chidao'] ?></th>  
	      <th scope="col" width="14%"><?=$row['zaotui'] ?></th>  
	      <th scope="col" width="14%"><?=$row['kuangke'] ?></th>  
	      <th scope="col" width="14%"><?=$row['qingjia'] ?></th>  
	    </tr>  
	    <? }   
	        }   
	  @mysql_free_result($resultSet);  ?>  
	  </tbody>  
	   
	</table>  
	   <p><?   // 显示分页链接的代码  
	if($Page== 1)               //如果是第1页,则不显示第1页的链接  
	        echo  "第一页  上一页 ";    
	else echo " <a href='?page=1'>第一页</a> <a href='?page=". ($Page-1)."'>上一页</a> ";  
	for($i=1;$i<= $PageCount;$i++)   {        //设置数字页码的链接  
	        if ($i==$Page) echo "$i  ";     //如果是某页,则不显示某页的链接  
	        else echo " <a href='?page=$i'>$i</a> ";}   
	if($Page== $PageCount)           // 设置“下一页”链接  
	        echo  " 下一页  末页 ";  
	else echo " <a href='?page=" . ($Page+1) . "'>下一页</a>   
	 <a href='?page=" . $PageCount . "'>末页</a> ";  
	echo "   共".$RecordCount. "条记录 ";  //共多少条记录  
	 echo " $Page / $PageCount 页";  //当前页的位置?>  
	</p>  
	<br><br>  
	<form>  
	  Copyright © 2016-2018, Shaynerain Du, All Rights Reserved  
	</form>  
	</body>  
	</html>  

2、签到

    签到功能已经在主界面中包含

3、签离

签离功能已经在主界面中包含

4、请假

5、查询进度

         已在主界面中包含

6、退出登录

         已在主界面中包含

7、主题查询

<?  
    @session_start();  
    if(isset($_SESSION['user'])||isset($_SESSION['admin'])){  
   
    }  
    else{  
        echo "<script>location.href='login.php';</script>";  
    }  
    //连接数据库  
    $con = mysql_connect("localhost", "root", "111");  
        mysql_query("set names 'utf-8'");  
        mysql_select_db("du", $con);  
          
          
    if($_POST["submit"]){  
          
        $chaxun = $_POST["chaxun"];  
        $xuanze = $_POST["xuanze"];  
          
        if(isset($_GET['page']) && (int)$_GET['page']>0)  
            $Page=$_GET['page'];  
        else      
            $Page=1;  
              
        $sql = "select * from user where $xuanze='$chaxun'";  
        $resultSet = mysql_query($sql);  
        $RecordCount=mysql_num_rows($resultSet);  
        $PageCount =ceil($RecordCount/10);  
        $sql = "select * from user where $xuanze='$chaxun'";  
        $resultSet = mysql_query($sql);  
    }  
   
   
?>  
<!doctype html>  
<html>  
<head>  
<meta charset = "utf-8" >
< title > shaynerain学生考勤系统 </ title >
</ head >
< body style="text-align: center; background-color: rgba(176,235,240,1.00);">  
<h1>查询结果</h1>  
<a<? if(isset($_SESSION['admin'])){  
            echo "href=" ; echo "admin.php"; }  
            else {echo "href=" ; echo "user.php";}?>>返回主页</a></p>  
<br>  
 <table width = "100%" border="2">  
  <tbody>  
    <tr>  
      <th scope = "col" width="15%">姓名</th>  
      <th scope = "col" width="15%">电话</th>  
      <th scope = "col" width="14%">email</th>  
      <th scope = "col" width="14%">迟到</th>  
      <th scope = "col" width="14%">早退</th>  
      <th scope = "col" width="14%">旷课</th>  
      <th scope = "col" width="14%">请假</th>  
    </tr>  
    <?  
        @mysql_data_seek($resultSet, ($Page-1)*10);//将结果集的指针移动指定的行数  
        for($i=0;$i<10;$i++)  
        {  
            $row=@mysql_fetch_assoc($resultSet);   
            if($row){  
    ?>  
    <tr>  
      <th scope = "col" width="15%"><?=$row['name']?></th>  
      <th scope = "col" width="15%"><?=$row['phone']?></th>  
      <th scope = "col" width="14%"><?=$row['email']?></th>  
      <th scope = "col" width="14%"><?=$row['chidao']?></th>  
      <th scope = "col" width="14%"><?=$row['zaotui']?></th>  
      <th scope = "col" width="14%"><?=$row['kuangke']?></th>  
      <th scope = "col" width="14%"><?=$row['qingjia']?></th>  
    </tr>  
    <? }   
        }   
  @mysql_free_result($resultSet);  ?>  
  </tbody>  
   
</table>  
   <p><?   // 显示分页链接的代码  
if($Page== 1)               //如果是第1页,则不显示第1页的链接  
        echo  "第一页  上一页 ";    
else echo " <a href='?page=1'>第一页</a> <a href='?page=". ($Page-1)."'>上一页</a> ";  
for($i=1;$i<= $PageCount;$i++)   {        //设置数字页码的链接  
        if ($i==$Page) echo "$i  ";     //如果是某页,则不显示某页的链接  
        else echo " <a href='?page=$i'>$i</a> ";}   
if($Page== $PageCount)           // 设置“下一页”链接  
        echo  " 下一页  末页 ";  
else echo " <a href='?page=" . ($Page+1) . "'>下一页</a>   
 <a href = '?page=" . $PageCount . "' > 末页 </ a > ";  
echo "   共".$RecordCount. "条记录 ";  //共多少条记录  
 echo " $Page / $PageCount 页";      //当前页的位置?>  
</p>  
<br><br>  
<form>  
  Copyright © 2016-2018, Shaynerain Du, All Rights Reserved
</form>  
</body>  
</html>  

五、管理员相关操作

1、主界面

<?  
    @session_start();     
    // 1退出      2增加 3删除 4修改 5查看信息   6请假管理   7设置上下课时间  
    if(isset($_SESSION['admin'])){  
        if($_GET["flag"] == 1)  
        {  
            session_unset();  
            echo "<script>location.href='login.php';</script>";  
        }  
        else if($_GET["flag"] == 2)  
        {  
            echo "<script>location.href='add.php';</script>";  
        }  
        else if($_GET["flag"] == 3)  
        {  
            echo "<script>location.href='del.php';</script>";  
        }  
        else if($_GET["flag"] == 4)  
        {  
            echo "<script>location.href='xiugai.php';</script>";  
        }  
        else if($_GET["flag"] == 6)  
        {  
            echo "<script>location.href='guanli.php';</script>";  
        }  
        else if($_GET["flag"] == 7)  
        {  
            echo "<script>location.href='shijian.php';</script>";  
        }  
          
            $con = mysql_connect("localhost", "root", "111");  
            mysql_query("set names 'utf-8'");  
            mysql_select_db("du", $con);  
            if(isset($_GET['page']) && (int)$_GET['page']>0)  
                $Page=$_GET['page'];  
                  
            else      
                $Page=1;  
            $resultSet = mysql_query("select * from user",$con);  
            $RecordCount=mysql_num_rows($resultSet);  
            $PageCount =ceil($RecordCount/10);  
            $sql = "select name,phone,email,chidao,zaotui,kuangke,qingjia from user";  
            $resultSet = mysql_query($sql);  
          
   
    }  
    else  
    {  
        echo "<script>location.href='login.php';</script>";  
    }  
      
?>  
<!doctype html>  
<html>  
<head>  
<meta charset = "utf-8" >
< title > shaynerain学生考勤系统 </ title >
</ head >
< body style="text-align: center; background-color: rgba(176,235,240,1.00);">  
<h1>管理员登陆</h1>  
<p>用户名:<a style = "color:rgba(45,5,251,1.00)" ><?= $_SESSION['admin']?></a>  <a href = "admin.php?flag=1" > 退出登录 </ a ></ p >

<p>请选择你的操作:   
<!--flag     1退出     2增加 3删除 4修改 5查看信息   6请假管理   7设置上下课时间-->  
<a href = "admin.php?flag=2" > 增加学生信息 </ a >
< a href="admin.php?flag=3" >删除学生信息</a>    
<a href = "admin.php?flag=4" > 修改学生信息 </ a >
< a href="admin.php?flag=6" >管理学生请假</a>    
<a href = "admin.php?flag=7" > 设置上课时间 </ a ></ p >< br >

<form id = "form1" name="form1" method="post" action="chaxun.php">  
    <tr colspan = "10" >
查询:  <input type = "text" name="chaxun" id="chaxun " />  
    <select name = "xuanze" id="选择">  
                        <option value = "name" > 姓名 </ option >
                        < option value="phone">电话</option>  
                        <option value = "email" > email </ option >
                        < option value="chidao">迟到</option>  
                        <option value = "zaotui" > 早退 </ option >
                        < option value="kuangke">旷课</option>  
                        <option value = "qingjia" > 请假 </ option >
                   </ select >
        < input type="submit" name="submit" id="submit" value="确认" />  
    <tr>  
</form>  
 <table width = "100%" border="2">  
  <tbody>  
    <tr>  
      <th scope = "col" width="15%">姓名</th>  
      <th scope = "col" width="15%">电话</th>  
      <th scope = "col" width="14%">email</th>  
      <th scope = "col" width="14%">迟到</th>  
      <th scope = "col" width="14%">早退</th>  
      <th scope = "col" width="14%">旷课</th>  
      <th scope = "col" width="14%">请假</th>  
    </tr>  
    <?  
        @mysql_data_seek($resultSet, ($Page-1)*10);//将结果集的指针移动指定的行数  
        for($i=0;$i<10;$i++)  
	        {  
	            $row=@mysql_fetch_assoc($resultSet);   
	            if($row){  
	    ?>  
	    <tr>  
	      <th scope = "col" width="15%"><?=$row['name']?></th>  
	      <th scope = "col" width="15%"><?=$row['phone']?></th>  
	      <th scope = "col" width="14%"><?=$row['email']?></th>  
	      <th scope = "col" width="14%"><?=$row['chidao']?></th>  
	      <th scope = "col" width="14%"><?=$row['zaotui']?></th>  
	      <th scope = "col" width="14%"><?=$row['kuangke']?></th>  
	      <th scope = "col" width="14%"><?=$row['qingjia']?></th>  
	    </tr>  
	    <? }   
	        }   
	  @mysql_free_result($resultSet);  ?>  
	  </tbody>  
	   
	</table>  
	   <p><?   // 显示分页链接的代码  
	if($Page== 1)               //如果是第1页,则不显示第1页的链接  
	        echo  "第一页  上一页 ";    
	else echo " <a href='?page=1'>第一页</a> <a href='?page=". ($Page-1)."'>上一页</a> ";  
	for($i=1;$i<= $PageCount;$i++)   {        //设置数字页码的链接  
	        if ($i==$Page) echo "$i  ";     //如果是某页,则不显示某页的链接  
	        else echo " <a href='?page=$i'>$i</a> ";}   
	if($Page== $PageCount)           // 设置“下一页”链接  
	        echo  " 下一页  末页 ";  
	else echo " <a href='?page=" . ($Page+1) . "'>下一页</a>   
	 <a href = '?page=" . $PageCount . "' > 末页 </ a > ";  
	echo "   共".$RecordCount. "条记录 ";  //共多少条记录  
	 echo " $Page / $PageCount 页";  //当前页的位置?>  
	</p>  
	<br><br>  
	   
	<form>  
	  Copyright © 2016-2018, Shaynerain Du, All Rights Reserved
	</form>  
	</body>  
	</html>  

2、增加学生信息

<? php
     $tip = array("","","",);    
    $err = 0;    
    if($_POST['submit'])    
    {    
        $name = $_POST['user'];    
        $password = $_POST['password'];     
        $email = $_POST['email'];    
        $phone = $_POST['phone'];    
	        //检测为空    
	        if($name == "")    
	        {    
	            $err++;   
	        }    
	        if($password == "")    
	        {    
	            $err++;    
	        }  
	        if($err == 0){    
	              
	            $conn=mysql_connect("localhost","root","111");            //连接数据库服务器    
	            mysql_query("set names 'utf-8'");              //设置字符集    
	            mysql_select_db("du",$conn);                 //选择数据库    
	            $resultSet = mysql_query("select * from user where name='$name'");//查找是否有相同的    
	            if(mysql_num_rows($resultSet)>0){    
	                echo "<script>alert('用户名已存在!')</script>";    
	                echo "<script>location.href='add.php';</script>";    
	                mysql_close($conn) or die(mysql_error());    
	                exit;    
	            }        
	            $registersql = "INSERT INTO user (name,password,email,phone) VALUES    
	                    ('$name','$password','$email','$phone')";//注意空格敏感,被坑了好久,总是插不进去    
	            $resultSet = mysql_query($registersql,$conn);//插入    
	            echo "<script>alert('用户已经成功注册!')</script>";    
	            mysql_close($conn) or die(mysql_error());   
	        }   
	        else {  
	         echo "<script>alert('用户名和密码不能为空!')</script>";}  
	    }  
	?>  
	<!doctype html>  
	<html>  
	<head>  
	<title>shaynerain学生考勤系统</title>  
	</head>  
	<meta charset = "utf-8" >
 < body style="text-align: center; background-color: rgba(176,235,240,1.00);">  
	<h1>添加学生信息</h1><br><br>  
	<form id = "form1" name="form1" method="post">  
	    <label for="user" >  
	    用户名:</label>  
	    <input type = "text" name="user" id="user"><br><br>  
	     
	    <label for="user" >  
	    phone:</label>  
	    <input type = "text" name="phone" id="phone"><br><br>  
	    <label for="user" >  
	    email:</label>  
	    <input type = "text" name="email" id="email"><br><br>  
	      
	     <label for="password">  
	      密码:</label>  
	     <input type = "password" name="password" id="password"><br><br>  
	     <input type = "submit" name="submit" id="submit" value="添加" >  
	     <a href = "admin.php" >< input type="button" value="返回" ></a>  
	</form>  
	   
	<form><br><br><br><br>  
	  Copyright © 2016-2018, Shaynerain Du, All Rights Reserved
	</form>  
	</body>  
	</html>  

3、删除学生信息

<?  
    @session_start();  
    if($_POST['submit'])    
    {    
            $name = $_POST['user'];   
            $conn=mysql_connect("localhost","root","111");            //连接数据库服务器    
            mysql_query("set names 'utf-8'");              //设置字符集    
            mysql_select_db("du",$conn);                 //选择数据库    
            $resultSet = mysql_query("select * from user where name='$name'");//查找是否有相同的    
            if(mysql_num_rows($resultSet)>0){    
                  
            }   
            else  
            {  
                echo "<script>alert('没有该用户!')</script>";    
                echo "<script>location.href='del.php';</script>";    
                mysql_close($conn) or die(mysql_error());    
                exit;    
                  
            }       
            $registersql = "delete from user where name='$name'";//注意空格敏感,被坑了好久,总是插不进去    
            $del = mysql_query($registersql,$conn);//删除    
            echo "<script>alert('用户已经成功删除!')</script>";   
           
    }     
    if(isset($_SESSION['admin'])){  
            $con = mysql_connect("localhost", "root", "111");  
            mysql_query("set names 'utf-8'");  
            mysql_select_db("du", $con);  
            if(isset($_GET['page']) && (int)$_GET['page']>0)  
                $Page=$_GET['page'];  
                  
            else      
                $Page=1;  
            $resultSet = mysql_query("select * from user",$con);  
            $RecordCount=mysql_num_rows($resultSet);  
            $PageCount =ceil($RecordCount/10);  
            $sql = "select name,phone,email,chidao,zaotui,kuangke,qingjia from user";  
            $resultSet = mysql_query($sql);   
          
   
    }  
    else  
    {  
        echo "<script>location.href='login.php';</script>";  
    }  
      
?>  
<!doctype html>  
<html>  
<head>  
<title>shaynerain学生考勤系统</title>  
</head>  
<meta charset = "utf-8" >
< body style="text-align: center; background-color: rgba(176,235,240,1.00);">  
<h1>删除学生信息</h1><br><br>  
   
<table width = "100%" border="2">  
  <tbody>  
    <tr>  
      <th scope = "col" width="15%">姓名</th>  
      <th scope = "col" width="15%">电话</th>  
      <th scope = "col" width="14%">email</th>  
      <th scope = "col" width="14%">迟到</th>  
      <th scope = "col" width="14%">早退</th>  
      <th scope = "col" width="14%">旷课</th>  
      <th scope = "col" width="14%">请假</th>  
    </tr>  
    <?  
        @mysql_data_seek($resultSet, ($Page-1)*10);//将结果集的指针移动指定的行数  
        for($i=0;$i<10;$i++)  
        {  
            $row=@mysql_fetch_assoc($resultSet);   
            if($row){  
    ?>  
    <tr>  
      <th scope = "col" width="15%"><?=$row['name']?></th>  
      <th scope = "col" width="15%"><?=$row['phone']?></th>  
      <th scope = "col" width="14%"><?=$row['email']?></th>  
      <th scope = "col" width="14%"><?=$row['chidao']?></th>  
      <th scope = "col" width="14%"><?=$row['zaotui']?></th>  
      <th scope = "col" width="14%"><?=$row['kuangke']?></th>  
      <th scope = "col" width="14%"><?=$row['qingjia']?></th>  
    </tr>  
    <? }   
        }   
  @mysql_free_result($resultSet);  ?>  
  </tbody>  
   
</table>  
   <p><?   // 显示分页链接的代码  
if($Page== 1)               //如果是第1页,则不显示第1页的链接  
        echo  "第一页  上一页 ";    
else echo " <a href='?page=1'>第一页</a> <a href='?page=". ($Page-1)."'>上一页</a> ";  
for($i=1;$i<= $PageCount;$i++)   {        //设置数字页码的链接  
        if ($i==$Page) echo "$i  ";     //如果是某页,则不显示某页的链接  
        else echo " <a href='?page=$i'>$i</a> ";}   
if($Page== $PageCount)           // 设置“下一页”链接  
        echo  " 下一页  末页 ";  
	else echo " <a href='?page=" . ($Page+1) . "'>下一页</a>   
	 <a href = '?page=" . $PageCount . "' > 末页 </ a > ";  
	echo "   共".$RecordCount. "条记录 ";  //共多少条记录  
	 echo " $Page / $PageCount 页";  //当前页的位置?>  
	</p>  
	<br><br>  
	<form id = "form1" name="form1" method="post">  
	   
	   
	    <label for="user" >  
	    删除学生姓名:</label>  
	    <input type = "text" name="user" id="user">  
	    <input type = "submit" name="submit" id="submit" value="删除" >  
	     <a href = "admin.php" >< input type="button" value="返回" ></a>  
	</form>  
	   
	<form><br><br><br><br>  
	  Copyright © 2016-2018, Shaynerain Du, All Rights Reserved
	</form>  
	</body>  
	</html>  

4、修改学生信息

<?  
    @session_start();  
    if($_POST['submit'])    
    {    
            $name = $_POST['user'];   
            $conn=mysql_connect("localhost","root","111");            //连接数据库服务器    
            mysql_query("set names 'utf-8'");              //设置字符集    
            mysql_select_db("du",$conn);                 //选择数据库    
            $resultSet = mysql_query("select * from user where name='$name'");//查找是否有相同的    
            if(mysql_num_rows($resultSet)>0){    
                  
            }   
            else  
            {  
                echo "<script>alert('没有该用户!')</script>";    
                echo "<script>location.href='del.php';</script>";    
                mysql_close($conn) or die(mysql_error());    
                exit;    
                  
            }  
            $password=$_POST['password'];  
            $email=$_POST['email'];  
        $phone=$_POST['phone'];  
        $chidao=$_POST['chidao'];  
        $kuangke=$_POST['kuangke'];  
        $zaotui=$_POST['zaotui'];  
        $qingjia=$_POST['qingjia'];  
           $sql = "UPDATE user SET name='$name',password='$password',email='$email',   
            phone='$phone',chidao='$chidao',kuangke='$kuangke',zaotui='$zaotui',qingjia='$qingjia' WHERE name = '$name'";  
        mysql_query($sql,$conn);   
            echo "<script>alert('已经成功修改!')</script>";   
         echo "<script>location.href='xiugai.php';</script>";  
    }     
    if(isset($_SESSION['admin'])){  
            $con = mysql_connect("localhost", "root", "111");  
            mysql_query("set names 'utf-8'");  
            mysql_select_db("du", $con);  
            if(isset($_GET['page']) && (int)$_GET['page']>0)  
                $Page=$_GET['page'];  
                  
            else      
                $Page=1;  
            $resultSet = mysql_query("select * from user",$con);  
            $RecordCount=mysql_num_rows($resultSet);  
            $PageCount =ceil($RecordCount/10);  
            $sql = "select name,phone,email,chidao,zaotui,kuangke,qingjia from user";  
            $resultSet = mysql_query($sql);   
          
   
    }  
    else  
    {  
        echo "<script>location.href='login.php';</script>";  
    }  
      
?>  
<!doctype html>  
<html>  
<head>  
<title>shaynerain学生考勤系统</title>  
</head>  
<meta charset = "utf-8" >
< body style="text-align: center; background-color: rgba(176,235,240,1.00);">  
<h1>修改学生信息</h1><br><br>  
   
<table width = "100%" border="2">  
  <tbody>  
    <tr>  
      <th scope = "col" width="15%">姓名</th>  
      <th scope = "col" width="15%">电话</th>  
      <th scope = "col" width="14%">email</th>  
      <th scope = "col" width="14%">迟到</th>  
      <th scope = "col" width="14%">早退</th>  
      <th scope = "col" width="14%">旷课</th>  
      <th scope = "col" width="14%">请假</th>  
    </tr>  
    <?  
        @mysql_data_seek($resultSet, ($Page-1)*10);//将结果集的指针移动指定的行数  
        for($i=0;$i<10;$i++)  
        {  
            $row=@mysql_fetch_assoc($resultSet);   
            if($row){  
    ?>  
    <tr>  
      <th scope = "col" width="15%"><?=$row['name']?></th>  
      <th scope = "col" width="15%"><?=$row['phone']?></th>  
      <th scope = "col" width="14%"><?=$row['email']?></th>  
      <th scope = "col" width="14%"><?=$row['chidao']?></th>  
      <th scope = "col" width="14%"><?=$row['zaotui']?></th>  
      <th scope = "col" width="14%"><?=$row['kuangke']?></th>  
      <th scope = "col" width="14%"><?=$row['qingjia']?></th>  
    </tr>  
    <? }   
        }   
  @mysql_free_result($resultSet);  ?>  
  </tbody>  
   
</table>  
   <p><?   // 显示分页链接的代码  
	if($Page== 1)               //如果是第1页,则不显示第1页的链接  
	        echo  "第一页  上一页 ";    
	else echo " <a href='?page=1'>第一页</a> <a href='?page=". ($Page-1)."'>上一页</a> ";  
	for($i=1;$i<= $PageCount;$i++)   {        //设置数字页码的链接  
	        if ($i==$Page) echo "$i  ";     //如果是某页,则不显示某页的链接  
	        else echo " <a href='?page=$i'>$i</a> ";}   
	if($Page== $PageCount)           // 设置“下一页”链接  
	        echo  " 下一页  末页 ";  
	else echo " <a href='?page=" . ($Page+1) . "'>下一页</a>   
	 <a href = '?page=" . $PageCount . "' > 末页 </ a > ";  
	echo "   共".$RecordCount. "条记录 ";  //共多少条记录  
	 echo " $Page / $PageCount 页";  //当前页的位置?>  
	</p>  
	<br><br>  
	<form id = "form1" name="form1" method="post">  
	   
	   
	    <label for="user" >  
	    姓名:</label>  
	    <input type = "text" name="user" id="user">  
	    <label for="password"><br><br>  
	      密码:</label>  
	     <input type = "password" name="password" id="password">  
	    <label for="phone"><br><br>  
	      电话:</label>  
	     <input type = "text" name="phone" id="phone" >  
	     <label for="email"><br><br>  
	      邮箱:</label>  
	     <input type = "text" name="email" id="email" >  
	     <label for="chidao"><br><br>  
	      迟到:</label>  
	     <input type = "text" name="chidao" id="chidao" >  
	     <label for="zaotui"><br><br>  
	      早退:</label>  
	     <input type = "text" name="zaotui" id="zaotui">  
	     <label for="kuangke"><br><br>  
	      旷课:</label>  
	     <input type = "text" name="kuangke" id="kuangke">  
	     <label for="qingjia"><br><br>  
	      请假:</label>  
	     <input type = "text" name="qingjia" id="qingjia">  
	     <br><br>  
	       
	    <input type = "submit" name="submit" id="submit" value="修改" >  
	     <a href = "admin.php" >< input type="button" value="返回" ></a>  
	</form>  
	   
	<form><br><br><br><br>  

5、管理学生请假

<?  
    @session_start();  
    //获取上课时间用于请假审批时间段设置  
    $con = mysql_connect("localhost", "root", "111");  
    mysql_query("set names 'utf-8'");  
    mysql_select_db("du", $con);  
    $stime = mysql_query("select * from shijian where id='1'",$con);  
    $stime=mysql_fetch_assoc($stime);  
    mysql_close($con);  
	    if(isset($_SESSION['admin'])){  
	          
	          
	        $con = mysql_connect("localhost", "root", "111");  
	        mysql_query("set names 'utf-8'");  
	        mysql_select_db("du", $con);  
	        $sql = "select * from qingjia where shenpi ='please wait'";   
	        //$sql = "select * from qingjia";  
	        $resultSet = mysql_query($sql);  
	    }else{  
	        echo "<script>location.href='login.php';</script>";  
	    }  
	    if($_GET['shenpi'])  
	    {         
	        $uptime = $stime['shangke'];  
	        $dowmtime = $stime['xiake'];  
	        //获取当前时间  
	        date_default_timezone_set('Asia/Shanghai');  
	        $time = getdate();  
	        if(($uptime>($time[hours].$time[minutes].$time[seconds])+10000))  
	        {  
	            if($_GET['shenpi'] == 1)  
	            {  
	                $name = $_GET['name'];  
	                mysql_query("UPDATE qingjia SET shenpi='pass' WHERE name='$name'");  
	                $result = mysql_query("select * from user where name='$name'",$con);  
	                $row = @mysql_fetch_assoc($result);  
	                $qingjia = $row['qingjia'];  
	                $qingjia++;  
	                mysql_query("UPDATE user SET qingjia='$qingjia' WHERE name='$name'");  
	                echo "<script>location.href='guanli.php';</script>";  
	            }else if($_GET['shenpi'] == 2){  
	                $name = $_GET['name'];  
	                mysql_query("UPDATE qingjia SET shenpi='no pass' WHERE name='$name'");  
	                echo "<script>location.href='guanli.php';</script>";  
	            }  
	        }else  
	        {  
	            echo "<script>alert(\"已经过了审批时间!\");</script>";  
	        }  
	    }  
	      
	?>  
	   
	<!doctype html>  
	<html>  
	<head>  
	<meta charset = "utf-8" >
 < title > shaynerain学生考勤系 </ title >
 </ head >

	<body style = "text-align: center; background-color: rgba(176,235,240,1.00);" >
 < form id="form1" name="form1" method="post">  
	<br><br><br><br>  
	    <h1 >请假系统</h1><br>  
	  <p>  
	     
	 <table width = "100%" border="2">  
	  <tbody>  
	    <tr>  
	      <th scope = "col" width="10%">姓名</th>  
	      <th scope = "col" width="60%">理由</th>  
	      <th scope = "col" width="10%">状态</th>  
	      <th scope = "col" width="20%">操作</th>  
	    </tr>  
	    <?  
	        while($row = @mysql_fetch_assoc($resultSet)){  
	    ?>  
	    <tr>  
	      <th scope = "col" width="10%"><?=$row['name']?></th>  
	      <th scope = "col" width="60%"><?=$row['yuanyin']?></th>  
	      <th scope = "col" width="10%"><?=$row['shenpi']?></th>  
	      <th scope = "col" width="20%"><a href = "guanli.php?name=<?=$row['name']?>&shenpi=1" > 通过 </ a >/< a href="guanli.php?name=<?=$row['name']?>&shenpi=2">驳回</a></th>  
	    </tr>  
	    <? }  ?>  
	  </tbody>  
	   
	</table>  
	   
	    <br>  
	    <a href = "admin.php" >< input type="button" value="返回" ></a>  
	</form>  
	<br><br><br><br>  
	<form>  
	  Copyright © 2016-2018, Shaynerain Du, All Rights Reserved;  
	</form>  
	   
	</body>  
	</html>  

6、设置上课时间

<?  
    @session_start();  
    if(isset($_SESSION['admin'])){  
        $con = mysql_connect("localhost", "root", "111");  
        mysql_query("set names 'utf-8'");  
        mysql_select_db("du", $con);  
        if($_POST["submit"])  
        {  
            $shangke = $_POST["shangke"];  
	            $xiake = $_POST["xiake"];  
	            $sql = "UPDATE shijian SET shangke='$shangke',xiake='$xiake' where id='1'";  
	            mysql_query($sql);  
	            echo "<script>alert('上课时间修改成功!');</script>";  
	        }  
	        $sql = "select shangke,xiake from shijian where id='1'";  
	        $resultSet = mysql_query($sql);  
	        $row=@mysql_fetch_assoc($resultSet);  
	    }else{  
	        echo "<script>location.href='login.php';</script>";  
	    }  
	   
	?>  
	<!doctype html>  
	<html>  
	<head>  
	<meta charset = "utf-8" >
 < title > shaynerain学生考勤系统 </ title >
 </ head >

	<body style = "text-align: center; background-color: rgba(176,235,240,1.00);" >
 < form id="form1" name="form1" method="post">  
	<br><br><br><br>  
	    <h1 >修改上课时间</h1><br>  
	  <p>  
	    <label for="phone" >  
	    上课时间:</label>  
	    <input type = "text" name="shangke" id="shangke" value="<?= $row["shangke"]?>">  
	    <label for="email"><br><br>  
	      下课时间:</label>  
	     <input type = "text" name="xiake" id="xiake" value="<?= $row["xiake"]?>">  
	       
	     <br><br>  
	      
	    <input type = "submit" name="submit" id="submit" value="修改" >  
	    <a href = "admin.php" >< input type="button" value="返回" ></a>  
	</form>  
	<br><br><br><br><br><br>  
	<form>  
	  Copyright © 2016-2018, Shaynerain Du, All Rights Reserved
	</form>  
	   
	</body>  
	</html>  

实现功能如代码所示,主要是数据库的操作,还有一些分页,其余的就是跳跳跳

源码文件和数据库也就是三个表的下载链接:http://download.csdn.net/detail/shaynerain/9723667

数据库软件APP下载链接:http://download.csdn.net/detail/shaynerain/9707047

ThinkPHP公司员工考勤工资考核系统毕业源码案例设计 开发软件: PHPStorm或DW等 数据库:mysql 程序后台技术框架:ThinkPHP(一个MVC框架) 后台界面采用EasyUI框架,前台界面采用Bootstrap框架,用户浏览器和服务器全程几乎采用jquery异步加载技术! 本课题是公司成员管理系统的设计与实现,本系统采用以php作为开发基础,在充分进行业务调研的基础上,设计开发了一套适用于不同规模公司日常部门管理工作的公司成员管理系统。该公司成员管理系统有利于降低企业日常运转过程中产生的人力数据和部门数据管理的成本,提高企业管理部门尤其人力资源部门的工作效率和运作管理水平。 公司成员管理系统开发目的是完成企业人力管理工作的信息化、精简化,提高企业人力部门运转的的效率,从而使公司HR和公司领导、员工获得更加良好的部门信息管理发布和部门信息查询体验。让数据库管理技术在“互联网+部门管理”信息化建设过程中,成为企业部门日常事务管理高效化、无纸化的有力保障。 部门: 部门编号,部门名称,添加时间 员工: 员工编号,密码,姓名,性别,部门,担任职务,民族,出生日期,身份证号,籍贯,文化程度,政治面貌,婚姻状况,毕业院校,专业,毕业时间,手机号,基本工资,现住址,照片,备注,添加时间 员工调动: 调动id,姓名,部门名称,担任职务,原基本工资,调动职位,调动部门,调动日期,现基本工资,调动原因,添加时间 工资: 工资id,姓名,部门名称,担任职务,年份,月份,基本工资,全勤奖励,考核奖励,加班工资,津贴补助,惩罚金额,个人所得税,五险一金,应发工资,实发工资,备注,添加时间 员工考核: 考核id,姓名,部门,职务,年份,月份,考核结果,考核奖励,考核部门,考核人,考核内容,添加时间 员工考勤: 考勤id,姓名,性别,所属部门,担任职务,年份,月份,到勤天数,迟到天数,旷工天数,请假天数,备注,添加时间 公司培训: 培训id,培训名称,培训时间,培训清单,培训地点,添加时间 -------- 不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的毕设,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! <项目介绍> 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
评论 42
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值