Aman Vashisht
New member
<html>
<head>
<?php
$userName = $_POST["userName"];
$password = $_POST["password"];
$gender = "";
$emailId = "";
$okay = FALSE;
mysql_connect('hostname', 'username', 'password');
mysql_select_db('Database name');
$result = mysql_query('SELECT * FROM Users');
if(!$result) echo mysql_error();
else
{while($row = mysql_fetch_row($result))
{if($row[0]==$userName)
{if($row[1]==$password)
{okay = TRUE;
$file = "users\Online";
$fh = fopen($file, "a") or die("ERROR");
fwrite($fh, "$userName;");
fclose($fh);
}
break;
}
}
}
if(!okay)
header( 'Location: index.php' ) ;
?>
<title>
<?php
echo "Welcome $userName";
?>
</title>
</head>
<body background = "pics\background.bmp">
<?php
echo "Details:<br>Name: $userName<br>Gender: $gender<br>Email id: $emailId<br><form name = chatForm action = UserChat.php method = post><input type = hidden value = $userName name = userName>Click <a onClick = chatForm.submit();><u><font color = \"blue\">here</font></u></a> to chat!</form>Online people:<br><iframe width = 40% height = 40% src = OnlinePeople.php></iframe><form name = signOutForm action = SignOut.php method = post><input type = hidden value = $userName name = userName><a onClick = signOutForm.submit();><u><font color = \"blue\">Sign out</font></u></a></form>";
?>
</body>
</html>
<head>
<?php
$userName = $_POST["userName"];
$password = $_POST["password"];
$gender = "";
$emailId = "";
$okay = FALSE;
mysql_connect('hostname', 'username', 'password');
mysql_select_db('Database name');
$result = mysql_query('SELECT * FROM Users');
if(!$result) echo mysql_error();
else
{while($row = mysql_fetch_row($result))
{if($row[0]==$userName)
{if($row[1]==$password)
{okay = TRUE;
$file = "users\Online";
$fh = fopen($file, "a") or die("ERROR");
fwrite($fh, "$userName;");
fclose($fh);
}
break;
}
}
}
if(!okay)
header( 'Location: index.php' ) ;
?>
<title>
<?php
echo "Welcome $userName";
?>
</title>
</head>
<body background = "pics\background.bmp">
<?php
echo "Details:<br>Name: $userName<br>Gender: $gender<br>Email id: $emailId<br><form name = chatForm action = UserChat.php method = post><input type = hidden value = $userName name = userName>Click <a onClick = chatForm.submit();><u><font color = \"blue\">here</font></u></a> to chat!</form>Online people:<br><iframe width = 40% height = 40% src = OnlinePeople.php></iframe><form name = signOutForm action = SignOut.php method = post><input type = hidden value = $userName name = userName><a onClick = signOutForm.submit();><u><font color = \"blue\">Sign out</font></u></a></form>";
?>
</body>
</html>