Here are the codes that I used for login.
As u said I made php files for the needed html files
| Code: |
<?php
session_start();
include 'connect.php';
$sql=mysql_query("select * from user where user_id='$userid'");
$login_check=mysql_num_rows($sql);
if($login_check==0)
// html code with login link
include 'home.html';
else
// html code with logout link
include 'home.html';
?>
|
member_registratioin.html
| Code: |
<form method='post' action='http://localhost/login.php'>
<table style="border:1px solid #000000" width="554" height="89">
<tr colspan="2">
<td width="202" bgcolor="#B5C3DE" height="26">
<font face="Haettenschweiler">
Member ID</font></td>
<td height="26" bgcolor="#B5C3DE" width="340">
<input type="text" name="uid" size="16"> </td>
</tr>
<tr>
<td width="202" bgcolor="#B5C3DE" height="23">
<font face="Haettenschweiler"> Current Password
</font> </td>
<td height="23" bgcolor="#B5C3DE" width="340">
<input type="password" name="passwd" size="13">
</td>
</tr>
<tr>
<td colspan="2" align="center" width="546">
<input type="submit" name="submit" value="SUBMIT">
<input type="reset" name="reset" value="RESET" ></td>
</tr>
</table>
</form>
|
login.php:-
| Code: |
<?php
session_start();
include 'connect.php';
$userid=$_POST['uid'];
$password=$_POST['passwd'];
$sql=mysql_query("select * from user where user_id='$userid' and passwd='$password'");
$login_check=mysql_num_rows($sql);
if($login_check==0)
echo " You have not uccessfully logged in ";
else
{
$_SESSION['userid']=$userid;
echo $userid;
echo '<a href="login_success.php">Login_success</a>';
}
?>
|
login_succees.php
| Code: |
<?php
session_start();
echo "$_SESSION[userid]";
echo "Want To go to Home Page <a href='index.html'> home </a>";
?>
|