I added that and it still doesn't work and I get this error
parse
error: syntax error, unexpected '<' in C:\Users\Gomes\Desktop\XAMPP\htdocs\index.php on line 74
I need them to be converted into a single file.
I cannot upload the files so I am going to paste the originals here
file 1 : index.php
<html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<!--USERID: webdeveloper PASSWORD: master -->
<title>LOGIN WEB SESSION</title>
<link rel="stylesheet" type="text/css" href="loginsession.css" />
</head>
<body>
<form action="logon.php" method="post">
<table>
<tr><td width="100">Username:</td><td width="200"><input type="text" name="username"></td></tr>
<tr><td width="100">Password:</td><td width="200"><input type="password" name="password"></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Login"></td></tr>
</table>
</form>
</body>
</html>
file 2 : logon.php
<?php
function clean($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$user = clean($_POST['username']);
$pass = clean($_POST['password']);
if ($user == "webdeveloper" && $pass == "master")
{
session_start();
$_SESSION['username'] = $user;
$_SESSION['password'] = $pass;
$_SESSION['ON']="TRUE";
$lifetime=600;
setcookie(session_name(),session_id(),time()+$lifetime);
header( 'Location: inside.php' ) ;
exit();
}
else
{
header( 'Location: index.php' );
session_destroy();
exit();
}
?>
file 3 : checker.php
<?php
session_start();
if ($_SESSION['ON'] =="FALSE" || $_SESSION['ON']==null) {
header( 'Location: index.php?error=invalid-login' );
session_unset();
session_destroy();
exit();
}
?>
file4: inside.php
<?php include "checker.php" ?>
<html><head><title>LOGIN WEB SESSION</title>
<link rel="stylesheet" type="text/css" href="loginsession.css" />
</head>
<body><div>LOGIN WELCOME</div>
<div>
HERE IS YOUR USER DATA:<br />
<label class="data">username:<?php echo $_SESSION['username'] ?><br>
password: <?php echo $_SESSION['password'] ?><br></label>
HERE IS YOUR SESSION DATA:<br />
<label class="data">
<?php echo (session_name().": ".session_id()) ?><br>
<?php echo ("SESSION DATA: ".session_encode() )?>
</label>
</div>
<div><a href="logoff.php">Logoff</a></div>
</body>
</html>
file5: logooff.php
<?php
header( 'Location: index.php' );
session_start();
session_unset();
session_destroy();
exit();
?>