setcookie() header issues
Posted: Thu Sep 11, 2003 10:06 am
[Admin Edit: Moved from the headers sticky: viewtopic.php?t=1157]
ok the below code works fine on its own page loginbox.php
but I need it as an include on other pages, but I get the header error unless I remove the set cookie line (third line)
How can I go about this? any ideas?
ok the below code works fine on its own page loginbox.php
but I need it as an include on other pages, but I get the header error unless I remove the set cookie line (third line)
How can I go about this? any ideas?
Code: Select all
<?php
include("config.php");
setcookie("page","$PHP_SELF",time()+155555);
if($loged=='yes')
{
?>
<table width="100%" border="0">
<tr><td>
<?php echo $lang[hello] ?> <?php echo $name ?>.
<?php echo "$lang[logedas] $username"; ?>
</td><td>
<?php include("new_messages.php"); ?><BR>
<a href="editaccount.php"><?php echo $lang[editaccount] ?></a><BR>
<a href="changepass.php"><?php echo $lang[changepass] ?></a><BR>
<a href="logout.php"><?php echo $lang[logout] ?></a>
</td></tr></table>
<?
}
else
{
?>
<table width="100%" border="0">
<tr><td>
<form action="login.php" method="post">
<?php echo $lang[username] ?> : <input type="text" name="username"> <BR>
<?php echo $lang[password] ?> : <input type="password" name="password">
<BR><input type="submit" value="<?php echo $lang[loginbutton] ?>">
</td><td><a href="register.php"><?php echo $lang[register] ?></a> | <a href="lostpass.php"><?php echo $lang[forgottenpassword] ?></a>
</form>
</td></tr></table>
<?
}
?>