Login Screen Settings:
<?php
/**
* Created by XX.
* User:msi
* DATE:2017/10/26
* Time:18:12
*/
The session must be enabled before each use!! , with start!
Session_Start ();
Var_dump ($_session);
?>
<! DOCTYPEHtml>
lang="EN">
<metacharset="UTF-8">
<title>title</title>
<body>
<formaction="Login_post.php"Method="POST">
<table>
<tr>
<td> User name:</td>
<td><inputType="Text"Name="Uname"Placeholder="Please enter your account"></td>
</tr>
<tr>
<td> Password:</td>
<td><input type="password" name="Pwod" placeholder="Please enter password"></td>
</tr>
</table>
<input type="Submit" value="Login">
</form>
</body>
Login Processing Interface Setup code:
<?php
/**
* Created by XX.
* User:msi
* DATE:2017/10/26
* TIME:18:15
*/
Session_Start ();
Header"Content-type:text/html; Charset=utf-8 ");
Require_once".. /public/dbda.class.php ";
$db=NewDbda ();
First check the user name entered, and then according to the user name entered to the database to check the password, and finally verify that the password and MySQL inside the password match!
$sql="SELECT * from t_user WHERE uname = '{$_post["Uname"]}' And Pwod = '{$_post["Pwod"]}‘";
As long as it's not 1.
$result=$db-Strquery($sql);
If($result!="0"){
Echo"Successful Landing";
$_session[' User '] =Array(
' Uname '=' User1 ',
);
Var_dump ($_session);
}else {
echo }
//detects session information->
If session information is empty, then jump to login interface
if (empty ( $_session [ ' user ' ]) {
header ( Span style= "COLOR: #6a8759" > "location:login.php" ) ;
}
//log out and destroy the account information;
unset ($_session ) ;
This is done!
/span>
< Span style= "COLOR: #e8bf6a" > < Span style= "COLOR: #bababa" > < Span style= "COLOR: #e8bf6a" > < Span style= "COLOR: #e8bf6a" >&NBSP;
Php+mysql Page Login code