hi
all my login is working,but when my url of the third page is typed it is displaying .i want to autheticate using session but it is not working
z-login(1st page)
<form name="form1" method="get" action="z_login1.php">
User Name<input type="text" name="myusername" style="width: 10em;">
Password</strong></td><td><input type="password" name="mypassword" style="width:10em;">
<input type="submit" name="submit" value="Login">
</form>
z_login1(2nd page)
<body>
<?php
$hostname = "localhost";
$username = "l";
$password = "";
$dbid = "";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$myusername=$_REQUEST['myusername'];
$mypassword=$_REQUEST['mypassword'];
$sql="SELECT username,password FROM login WHERE username='$myusername' and password='$mypassword' and type='0'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{
$line = mysql_fetch_row($result);
$_SESSION["un"] = $line[0];
}
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
print "<script>";
print " window.location='http://www.web.com/z_login2.php'";
print "</script>";
}
else
{
print "<script>";
print " window.location='http://www.web.com/z_login.html'";
print "</script>";
}
>
</body>
z_login2(3rdpage)
<? session_start();
if (!isset($_SESSION['un'])){
exit(); header("Location: z_login.html");
}
else
{
?>
<html>
<head></head>
<body>
<?
print "Thank visiting";
}
?>
</table>
</body>
</html>
please do tell the error in the code