Create Form Login:
Source Code : login.html
<HTML>
<form action="LoginAction.php" method="post" name="loginform">


<!--
- Text box -> User Name : txtuser
- Text box -> Password : txtpwd
-->
</form>
</HTML>

<SCRIPT>
loginform.txtuser.focus();
</SCRIPT>

Download

Create PHP file :

Source code : LoginAction.php

<?php
   require("connect_db.inc");
require("user.inc");
?>
Download

PHP Connect with Database

Source Code : connect_db.inc

<?php
$con=mysql_connect("localhost","root","123")
or die("Could not connect!");
$select=mysql_select_db("dbinfo") or
die("Could not select!");
function exec_query($query){
$result=mysql_query($query) or
die("Could not query!:$query");
return $result;
}
?>

PHP Function User Exit (Select)

Source Code : user.inc

<?php
function UserExist($txtuser,$txtpwd){
$query = "select * from tuser where
username='$txtuser' and password='$txtpwd'";
$result = exec_query($query);
$line = mysql_fetch_array($result);
return $line;
}
?>

Finish......!

 
Top