These tutorials are very useful for beginners, oh, this is a little bit of code on the following OH.
<center>
<p> </p>
<p> </p>
<form name= "Form1" method= "Post" action= "login_cl.php" >
<table width= "height=" 241 "border=" 0 "cellpadding=" 0 "cellspacing=" 0 ">
<TR align= "center" >
<TD colspan= "2" bgcolor= "#999999" > Member Login Interface (login.php) |<a href= "index.php" > Back </a> </td>
</tr>
<tr bgcolor= "#CCCCCC" >
<TD width= "137" align= "center" > User:</td>
<TD width= "363" ><input name= "Yd631_name" type= "text" id= "Yd631_name" ></td>
</tr>
<tr bgcolor= "#D9D9D9" >
<TD align= "center" > Password:</td>
<td><input name= "YD631_PWS" type= "password" id= "YD631_PWS" ></td>
</tr>
<TR align= "center" bgcolor= "#CCCCCC" >
<TD colspan= "2" ><input type= "Submission" name= "submit" value= "submitted" >
<input type= "reset" name= "submit" value= "reset" >
</td>
</tr>
</table>
</form>
<p> </p>
</center>
Log in PHP processing code
Include ("config.php");
?>
<?php
if (Empty ($_post["Yd631_name"])) {
Echo ("<script type= ' Text/javascript ' > Alert (') how can the user name be empty?" '); History.go ( -1);</script> ");
}
if (Empty ($_post["YD631_PWS"])) {
Echo ("<script type= ' Text/javascript" > alert (' Password cannot be empty!) '); History.go ( -1);</script> ");
}
$yd 631_name= $_post["Yd631_name"]; User name has been logged
$yd 631_pws= $_post["YD631_PWS"]; The password has been recorded.
$db =mysql_connect ($servername, $sqlservername, $SQLSERVERPWS);
mysql_select_db ($sqlname, $db);
$sql = "SELECT * from $sqltable where yd631_name= ' $yd 631_name ' and yd631_pws= ' $yd 631_pws '";
$result =mysql_fetch_array (mysql_query ($sql));
if (! $result) {
Echo (' <script type= ' text/javascript ' > Alert (' Username or password is incorrect! '); History.go ( -1);</script> ");
Mysql_close ();
Exit
}
if ($result ["Yd631_pass"]== "no") {
Verify that the member is approved
Echo ("<script type= ' Text/javascript" > Alert (' You haven't been audited yet!) '); History.go ( -1);</script> ");
}
Session_Start ();
$_session["name"]= "$yd 631_name";
echo "<script>location.href= ' yd631.php ';</script>";
?>
Config file.
<?php
General parameter settings
$servername = "localhost"; Host Name
$sqlservername = "root"; MySQL Database user name
$SQLSERVERPWS = "yd631"; MySQL Database password
$sqlname = "Yd631_user"; Database name
$sqltable = "Yd631_users"; Username Table name
$admin _name= "yd631"; Administrator user Name
$admin _pws= "yd631"; Administrator password
?>