mohsenshahab
Active Member
من اين كد رونوشتم كه 3 صفحه است صفحه ورود صفحه رابط و صفحه main.
اما مشكل اينه كه وقتي user name ,pass رو وارد ميكنم به صفحه رابط ميره و نميتونه خودش رو به صفحه main برسونه اينم كدها
vorood.php
a.php
)صفحه رابط
main.php
اما مشكل اينه كه وقتي user name ,pass رو وارد ميكنم به صفحه رابط ميره و نميتونه خودش رو به صفحه main برسونه اينم كدها
vorood.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="a.php">
<label>
Username:
<input name="user" type="text" id="user" />
</label>
<p> </p>
<p>
<label>Password:
<input name="pass" type="text" id="pass" />
</label>
</p>
<p>
<label></label>
<input type="submit" name="Submit" value="Submit" />
</p>
</form>
</body>
</html>
a.php
)صفحه رابط
<?php session_start();
$u=$_POST["user"];
$p=$_POST["pass"];
if(($u=="admin")&&($p=="123"))
{
$session["mys"]=$u;
print ("<script language='javascript'>window.navigator('main.php');</script>");
}
else
{
print ("<script language='javascript'>window.navigator('vorood.php');</script>");
}
?>
main.php
<?php session_start();
if(!isset($_SESSION["mys"]))
print ("<script language='javascript'>window.navigator('vorood.php');</script>");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
Hello
</body>
</html>