Implementation of PHP Student management system

Source: Internet
Author: User

Recently the school opened a PHP course, by the way to write a homework, share it ...

It's a simple thing to do 、、、

Omit part of the front-end code 、、、

The first is the check for login:

<?PHPSession_Start(); $user=$_post[' UserName ']; $pass=$_post[' PassWord ']; $_session[' user '] =$user; /*$Enter = $_post[' Login_undo '); Check for administrator login*/    $flag=false; if($user= = "Admin" &&$pass= = "Root")    {        Setcookie("UserName",$user, Time() +1200); Setcookie("UserName",$pass, Time() +1200); $flag=true; Header(' location:adminpage.php?user= '.$user); }    Else        Header(' Location:login.php?login=relog '); /*//Student Login-free if ($Enter) header (' location:StuPage.php '); */            

Then is the registered checksum:

<?PHPSession_Start(); $s _id=$_post[' s_id ']; $Name=$_post[' Name ']; $IDcard=$_post[' Idcard ']; $Major=$_post[' Major ']; $sex=$_post[' Sex ']; $_session[' Student '] [$s _id[' s_id '] =$s _id; $_session[' Student '] [$s _id[' Name '] =$Name; $_session[' Student '] [$s _id[' idcard '] =$IDcard; $_session[' Student '] [$s _id[' Major '] =$Major; $_session[' Student '] [$s _id[' sex '] =$sex; Header(' location:tisi.html '); /*foreach ($_session[' student ') as $v) {if ($v = = $s _id) {header ("Location:stu_reg.php?actio n=look&msg= update &user=employee&empno= ". $empno. "&idcard=".        $idcard); } else Header ("location:stu_reg.php?action=look&msg= add &user=employee&empno=". $empno. "&idcard=".    $idcard); }*/

Graduation operation and accession history check:

<?PHPSession_Start(); $s _id=$_get[' s_id ']; $_session[' History '] [$s _id[' s_id ']=$s _id; $_session[' History '] [$s _id[' Name ']=$_session[' Student '] [$s _id[' Name ']; $_session[' History '] [$s _id[' Idcard ']=$_session[' Student '] [$s _id[' Idcard ']; $_session[' History '] [$s _id[' Sex ']=$_session[' Student '] [$s _id[' Sex ']; $_session[' History '] [$s _id[' Major ']=$_session[' Student '] [$s _id[' Major ']; unset($_session[' Student '] [$s _id]); Header(' Location:graduate.php?user=admin&action=delete ');

Any keyword query:

<?PHPSession_Start(); $search=$_post[' Search ']; unset($_session[' Search ']); /*echo ' <pre> ';    Var_dump ($_post[' search '); return;*/    foreach($_session[' Student '] as $k 1=$value) {        #code ...        if($search==$_session[' Student '] [$k 1[' s_id ']| |$search==$_session[' Student '] [$k 1[' Idcard ']| |$search==$_session[' Student '] [$k 1[' Name ']| |$search==$_session[' Student '] [$k 1[' Sex ']| |$search==$_session[' Student '] [$k 1[' Major ']){            $i= 1; $stu=$_session[' Student '] [$k 1[' s_id ']; $_session[' Search '] [$stu] =$stu; }    }    if(isset($i))        Header("Location:stu_query.php?user=admin&action=search"); Else         Header("Location:stu_query.php?user=admin&action=q_error");

Traverse Student Information:

<! DOCTYPE html>class= "Css_table" bgcolor= ' #E1E1E1 ' ><?PHPSession_Start(); $user=isset($_session[' User ']?$_session[' User ']: '; if($user= = ' Admin '){        if(isset($_session[' Student '])){            foreach($_session[' Student '] as $k 1) {             Echo"<tr>"; foreach($k 1  as $k 2=$k 3) {            Echo"<td>" ; if($k 2= = ' s_id ') {Echo"Study number:";}Else if($k 2= = ' Idcard ') {Echo"ID number:";}Else if($k 2= = ' sex ') {Echo"Sex:";}Else if($k 2= = ' Name ') {Echo"Name:";}Else if($k 2= = ' Major ') {Echo"Professional:";}; Echo"</td>"; Echo"<td>"; if($k 2= = ' s_id ')$s _id=$k 3;Echo"$k 3"; Echo"</td>"; }        }    }}?></table></body>

Update the page and verify the data:

<! DOCTYPE html><!--Use HTML5 specification, omit redundant part-->PHPSession_Start(); $user=isset($_session[' User ']?$_session[' User ']: '; $action=isset($_get[' Action ']?$_get[' Action ']: ';? ><link href= "File/style.css" rel= "stylesheet" type= "Text/css"/>if($user= = ' Admin ' &&$action= = ') {><table width= "100%" border= "0" cellpadding= "3" cellspacing= "1"class= "Css_table" bgcolor= ' #E1E1E1 ' > <trclass= "Css_menu" > <td colspan= "3" > <table width= "100%" border= "0" cellpadding= "4" cellspacing= "0"class= "Css_main_table" > <tr> <tdclass= "Css_main" > Note </td> </tr> </table> </td> </tr> <tr> <tdclass= "Css_col11" ><strong><font color=#50691b> Once determined cannot be changed </font></strong></td></tr><form name = "Check_stu" method= "post" action= "check_stu.php" ><td><lable> Please enter the student number to modify: <input name = "c_id" type= "text" ><input name = "Submit" type= "Submit" value= "OK" ></lable></td>& lt;/form></table><?php}Else if($action= = ' Change ') {? ><form name= "Login_f" method= "post" action= "update_check.php" > <divclass= "Login" align= "center" > <lable> can modify:</lable> <input name = "c_id" type= "hidden" value = "< ? PHP Echo$_get[' c_id '];? > > <li><p>Student Name:<input name = "name" type = "text" id = "name" ></p></li> <li><p> Professional: &nbsp;&nbs p;&nbsp;&nbsp; <input name = "Major" type = "text" id = "Major" ></p></li> <li> <p> Gender: &amp ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!--<input name = "Sex" type = "text" id = "Sex" ></p></li>-<input type= "Radio" Name= "Sex" value= "male"/> Male &nbsp;&nbsp;&nbsp;&nbsp; <input type= "Radio" name= "Sex" value= "women"/> Women &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</br> &lt ;/li> <li><p> Make sure to modify:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name = "Submit" type = "submit" value = "OK" >&nbsp;&nbsp;&nbsp;&nbsp; <inputclass= "Renew" value= "override" type= "reset"/>&nbsp;&nbsp;</p></li> </form> </div><?php}Else if($action= = ' Enchange ') {    #code ...    Echo";}?></body>
<?PHPSession_Start(); $s _id=$_post[' c_id ']; $Name=$_post[' Name ']; $Major=$_post[' Major ']; $sex=$_post[' Sex ']; $_session[' Student '] [$s _id[' s_id '] =$s _id; $_session[' Student '] [$s _id[' Name '] =$Name; $_session[' Student '] [$s _id[' Major '] =$Major; $_session[' Student '] [$s _id[' sex '] =$sex; Header("Location:stu_update.php?action=enchange");


(Note: I csdn blog This article is the same, but I do not write csdn http://blog.csdn.net/p641290710/article/details/41360205)

Implementation of PHP Student management system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.