【php】2、学生管理系统-登陆进去

<?php
    include_once 'mysql.class.php';
    include_once 'confing.php';
    include_once 'stuService.class.php';
    //吧用户登陆放到session中,一直检测
    session_start();
    $name = $_POST['name'];
    $password = $_POST['password'];
    
//     if(!empty($_GET['error']))
//     {
//         //接收错误编号
    
//         $error=$_GET['error'];
//         if($error==1)
//         {
//             echo "<br/><font color='red' size='3'>你的用户名或者密码错误</font>";
//         }
    
//     }
    //首先不能用户名为空
    if(($name == "") || ($password == ""))
    {
        echo "少年!请先<a href='index.html'>登陆</a>!";
    }
    else
    {
//         $mysql = new mysql(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
        
//         if(!$mysql) //连接失败
//         {
//             echo "连接数据库失败";
//             exit;
//         }
//         $selected = $mysql->select_db(DB_NAME);
//         if(!$selected)
//         {
//             echo "查无此人";
//             exit;
//         }
        
//         $query = "select count(*) from customer where name = ? and password = ?";
        $stuservice1 = new stuservice();
        if(($stuservice1->checkstunum($name, $password)) > 0)
        {
            $url = "studentmanage.php";
            $_SESSION['student_name'] = $name;
            echo $_SESSION['student_name'];
            echo "<script type='text/javascript'>"."location.href='".$url."'"."</script>";
        }
       
    }
   ?>


管理界面:

<!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">
		<table width="767" height="644" border="0" align="center">
			<tr>
                <td height="228" colspan="5" background="pic/top.gif">    </td>
            </tr>
            <tr>
              <td height="22" colspan="5" background="pic/in_01.gif"></td>
            </tr>
		    <tr>
		     <td background="pic/in_20.gif" ><a href="studentlist.php">查看用户</a></td>
		     <td background="pic/in_20.gif" ><a href="studentchange.php">修改用户</a></td>
		     <td background="pic/in_20.gif" ><a href="index.html">退出系统</a></td>
		    </tr>
	    </table>
    </body>
</html>




预览:

技术分享





郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。