<head>
<?php
$db=mysql_connect("localhost","root","") or die ('Connection error'. mysql_error());
echo "ajay<br/>";
mysql_select_db("chat") or die ('Error connecting to database'. mysql_error());
echo "connected to database";
$fr_username=$_POST["txt_username"];
$fr_password=$_POST["txt_password"];
$result = mysql_query("SELECT username,password FROM login WHERE username='$fr_username' AND password='$fr_password' ");
while($row = mysql_fetch_assoc($result))
{
if($result!="")
{
echo "good";
}
else
{
if ($result="")
{
echo "bad";
}
}
}
mysql_close($db);
$date = date("a");
if ($date=="am")
{
$title="Good Morning";
}
else
{
$title="Good Afternoon";
}
?>
</head>
<title>met-ene-dialogue</title>
<?php echo $title ?>
<style type="text/css">
<!--
body {
background-image: url();
}
.style1 {color: #C13167}
.style2 {font-size: large}
-->
</style></head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="16%" bgcolor="#FFFFFF" scope="col"><img src="images/queascopf4.gif" width="124" height="145"/></th>
<th width="77%" bgcolor="#FFCCFF" scope="col"><p class="style1">WELCOME</p>
<p class="style1">TO </p>
<p class="style1">METE-ENE-DIALOGUE DOT COM </p></th>
<th width="7%" background="Drag to a file to choose it." bgcolor="#FFFFFF" scope="col"><img src="images/queascopf4.gif" width="124" height="145" /></th>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF"><table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<th width="50%" bordercolor="#330033" scope="col" border = "5">MEMBERS LOGIN </th>
<th width="50%" bordercolor="#330033" scope="col">NEW USER? SIGN IN </th>
</tr>
<tr>
<td height="139">
<form action = "<?php $page?>" method ="post">
<p>Username:
<input type = "text" name = "txt_username"/>
</p>
<p>Password:
<input type = "password" name = "txt_password"/>
</p>
<p>
<input name="Submit" type = "submit" value="Submit"/>
</p>
</form></td>
<td height="139" align="center" valign="middle"><span class="style2">Sign in as new user </span></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
hi! i need help! i created a code and sql db for store usere name and password, but i only doest the $result wen if found the username and password. help plz and also i want to open anothe page wen the username and password is ok! i used header, but it sent erorr that "cant modify header, already sent" plz help