User can klik on menu-item [inloggen] in my startscript "tt.php".
Now "ttlogin.php" is called. It shows a webpage containing a login-form.
User can enter login-name.
The login-form calls itself (ttlogin.php) again and now login-verification is done.
After verification I want to show startscript "tt.php" again.
Because now $loginid is set, different menu-links will be shown and a different text in the content-part will be shown.
However ! I keep getting the message: Headers already sent.
How can I avoid this ???
There are no leading spaces before the "session_start()".
Incuded are: tt.php, ttlogin.php, ttmenu.php, tt.ccs
****** tt.php ******
CODE
<?php session_start() ?>
<?php
$pagina_id="Startpagina";
?>
<html>
<head>
<title><?php echo $pagina_id; ?></title>
<link href="tt.css" rel="stylesheet" type="text/css">
</head>
<body>
<table>
<tr>
<?php
if(isset($_SESSION["loginid"]))
{ ?>
<td ><?php echo $_SESSION["loginid"] ?> </td>
<?php
} ?>
</tr>
</table>
<div class="menu">
<?php include("ttmenu.php");?>
</div>
<div class="content">
<?php if (!isset($_SESSION["loginid"])){ ?>
<h2>Welkom op FinoFix webserver <?php include(".version")?></h2>
<?php } else { ?>
<h2>U bent ingelogd op de FinoFix webserver.</h2>
<?php } ?>
</div>
</body>
</html>
**** ttlogin.php ****
CODE
<?session_start()?>
<?php $pagina_id="Inloggen"; ?>
<html>
<head>
<title><?php echo $pagina_id; ?></title>
<link href="tt.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Als ingelogd, dan de loginnaam in de header tonen -->
<table>
<tr>
<?php
if(isset($_SESSION["loginid"]))
{ ?>
<td ><?php echo $_SESSION["loginid"] ?> </td>
<?php
} ?>
</tr>
</table>
<div class="menu">
<?php include("ttmenu.php");?>
</div>
<div class="content">
<?php
if (!empty($_POST)){
//
// STAP 2 Inlognaam checken en daarna nieuwe menuopties tonen
//
$loginid=$_POST["loginid"];
// Hier wachtwoordcontrole doen ...
$_SESSION['loginid']=$loginid;
header("Location:tt.php");
} else {
//
// STAP 1 Inlog-variabelen nog niet gezet: dus inloggen via inlog-scherm
//
?>
<h2>Inloggen</h2>
<hr>
<form name="form1" method="post" action="<?php echo($_SERVER["PHP_SELF"]);?>">
<br>Gebruikersnaam (demo)<br>
<input name="loginid" type="text"><br><br>
<input type="submit" name="Submit" value="Inloggen">
</form>
<?php
}
?>
</div>
</body>
</html>
**** ttmenu.php ****
CODE
<div id="list-menu">
<ul>
<li>
<a href="tt.php">Welkom</a><br> </li>
<?php
if (!isset($_SESSION["loginid"]))
{ ?>
<li><a href="ttlogin.php">Inloggen</a><br>
<?php
} else { ?>
<li><br><a class="n" href="ttlogin.php">Opnieuw inloggen</a></li>
<?php
} ?>
</ul>
</div>
**** tt.css ****
CODE
.header {
position: absolute;
left: 10px;
width: 94%;
padding: 0px;
height: 80px;
background:#FF9900;
font-family:arial;
}
.header td {
font-family:arial;
font-size: 12;
}
.menu {
position: absolute;
left: 10px;
top: 82px;
height: 82%;
width: 150px;
background:#FF9900;
font-family:arial;
font-size:12;
}
body {
font-family:arial;
color: black;
background-color: #FFCC33;
font-size:12;
}
.content {
position: absolute;
top: 82px;
margin-left: 150px;
width: 100%;
height: 70%;
padding-top: 3em;
padding-left: 2em;
}
.footer{
position:absolute;
left:10px;
width:94%;
padding: 0px;
bottom:20;
background:#FF9900;
font-family:arial;
font-size:0.8em;
}
table {
font-family:arial;
font-size:12;
}
/* in test.htm: <div id=list-menu> ..ul.. </div> */
#list-menu ul {
margin: 10;
padding: 0;
list-style-type: none;
font-family: arial, arial, sanf-serif;
font-size: 12;
}
#list-menu li {
margin: 10px 0 0;
}
#list-menu a {
color: #fff;
background: #fff;
display: block;
width:120px;
padding: 2px 2px 2px 10px;
border: 1px solid #000000;
text-decoration: none; /*lets remove the link underlines*/
}
#list-menu a:link, #list-menu a:active, #list-menu a:visited {
color: #000000;
}
#list-menu a:hover {
border: 1px solid #000000;
background: #333333;
color: #ffffff;
}
#rechts a
{ color: $blue;}
h1 {
font-family: Helvetica, Geneva, Arial,
SunSans-Regular, sans-serif }
h2 {
font-family: Helvetica, Geneva, Arial,
SunSans-Regular, sans-serif }
a:link {
color: blue }
a:visited {
color: purple
}
address {
margin-top: 1em;
padding-top: 1em;
border-top: thin dotted;
font-size: 12px;
}