oh oh no: single login sign-in

A

Anonymous

Guest
i have database for login to store username and password
how do ....to create a single login?

here is my coding FORM
Code:
<!doctype html public "-//W3C//DTD HTML 4.0 //EN"> 


<html>
<head>
       <title>Login Page!</title>
</head>
<body bgcolor=#FFGHFF">
<center><?php echo $errmsg;

?></center>
<form method="post" action="loginsession1.php">
<table width="50%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>username</td>
<td>
<input type="text" name="username">
</td>
 </tr>
 <td>Password</td>
 <td>
 <input type="password" name="password">
 </td>
 </tr>
 <tr>
 <td>&</td>
 <td>
 <input type="submit" name="submit" value="submit">
 </td>
 </tr>
 </table>
 </form>
 </body>
 </html>
 
loginsession1.php
Code:
<?php 
if(isset($HTTP_POST_VARS["username"])){
$server="localhost";
$login="mi_login";
$pass="***********";
$bbdd="database_name";
$table="mi_table";

$user = $HTTP_POST_VARS["user"];
$passwrd = $HTTP_POST_VARS["password"];

$db=mysql_connect($server,$login,$pass); 	  
mysql_select_db($bbdd,$db);
$sql = "SELECT user_id, username, user_password FROM ".$table." where username='$user' and user_password='$passwrd'";
$sql_result= mysql_query($sql,$db); 
if ($row = mysql_fetch_array($sql_result)){
	do{
		echo "You are logged in ".$user."!!";
	}while	($row = mysql_fetch_array($sql_result));
}else{
	echo "You are not logged in....";
} 
mysql_close($db); 
?>
 
Back
Top