This is a simple user login verification code Oh, more suitable for beginners in PHP tutorial Oh,
Let's take a look at the HTML code
<form action=111cnnet.php >
<input Type=text name=username>
<input Type=text name=password>
<input type=submit name=password value= ' Submit ' >
</form>
<?php
$uname =$_post["username"];
$pwd =$_post["Password"];
$link = MySQL tutorial _connect (' localhost ', ' root ', ' 123456 ')
Or Die (' could not connect: '. Mysql_error ());
mysql_select_db (' Ruida ') or die (' could not select database ');
Execute SQL Query
$query = "SELECT * from user where uid= ' $uname '";
$result = mysql_query ($query) or Die (' Query failed: '. mysql_error ());
while ($row =mysql_fetch_array ($result)) {
if ($pwd = = $row [' Password '])
{
Header ("location:http://www.jzread.com");
}
Else
Echo ' error! ';
Releasing the result set
Mysql_free_result ($result);
Close connection
Mysql_close ($link);
?>