There are few errors in the codes below, I tried and run the code to find it out, and I think there is an error in the homwhile.php as it should have an output which displayed welcome username and this is the homepage right? they might be some errors down that, .. ( i ain't good in PHP), can someone check if there are any errors and any suggestion should be conducted? very appreciated :)
failure.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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
echo "AUTHENTICATION FAIL-WRONG ID & PASSWROD";
header("refresh:3;url=loginwhile.html");
?>
</body>
</html>
valid.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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
if ($_POST["user"]=="dani" && $_POST["pass"]=="123")
{
session_start();
$_SESSION["user"]=$_POST["user"];
header('Location:homewhile.php');
}
else
{
header('Location:failurewhile.php');
}
?>
</body>
</html>
home.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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
session_start();
if ($_SESSION["user"]==""){
header("Location:loginwhile.html");}
$myname=$_SESSION["user"];
echo "Welcome".$myname;
echo "THIS IS YOUR HOMEPAGE";
header("Location:while2.php");
?>
</body>
</html>
while.php
<html>
<body>
<p ><strong><center>THIS IS A PROGRAM TO DISPLAY INTEGER</center></strong></p>
<?php
$i="1";
echo "Input:".$i."--------------------------------->";
while ($i!=11)
{
if($i!=3){
echo "OUTPUT:".$i;
echo "<br>";
$i=$i+1;
echo "Input:".$i."--------------------------------->";
}
else
{
echo "NO OUTPUT TO BE DISPLAYED";
$i=$i+1;
echo "<br>";
echo "Input:".$i."--------------------------------->";
}
}
echo "PROGRAM TERMINATED!";
echo "<br>";
?>
<br><a href="logoutdwhile.php">SIGN OUT</a></br>
</body>
</html>
logout.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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
session_start();
session_destroy();
echo "<center><strong>You have logout sucessfully<center></strong>";
?>
<a href="loginwhile.html">Click here to go to login page</a>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire