The administrator login page is in the admin.php file
##Use a <form> form to create a login front-end page<form action="" method="post"> <table width="" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#C2C2C2"> <tr> <td height="30" align="right" bgcolor="#FFFFFF"><label>输入密码:</label></td> <td align="left" bgcolor="#FFFFFF"><input name="pwd" type="text" id="pwd" /></td> </tr> <tr> <td height="30" colspan="2" align="center" bgcolor="#FFFFFF"><label> <input name="Submit10" type="submit" id="Submit10" value="登陆" /> </label> <label> <input type="reset" name="Submit5" value="重置" /> </label></td> </tr> <tr> <td height="30" colspan="2" align="center" bgcolor="#FFFFFF"> </td> </tr> </table> </form>give Login<input> an id value
id="Submit10", here we set a login password$pwd = admin,
Friends enter admin directly You can log in to theadministrator operation page.
The password pwd value obtained using POST method matches the pwd value of SESSION. If the password entered in the <input> text box is admin, the login is successful and you will jump to Operation page; otherwise it will prompt login failure.
<?php if(isset($_POST['Submit10'])){ if($_POST['pwd']=='admin'){ $_SESSION['pwd']=2; echo "<script language=javascript>alert('登陆成功!');window.location='admin.php'</script>"; }else{ echo "<script language=javascript>alert('登陆失败,请检查您的密码!');window.location='admin.php'</script>"; } } ?>Next Section