hey guys,
this seems to work.but only on manually refreshing the page.
any hints?
cheers vamps
its here :-
http://onstageshirts.com.au/newcookie.php
<?
// creating a cookie
// set initial cookie
// checks if logged out..
if ($logged == "out")
{
setcookie("setname", '', time()-3000);
Print("Thankyou, you have now been logged out.");
$logged =="bah"; // this means you can only logout once
}
// checks if cookie is already set if so prints out welcome message
else if (isset($_COOKIE["setname"]))
{
Print("Welcome Back ".$_COOKIE["setname"]);
}
// checks if data has just been input if so creates a cookie with the given data
else if ($form == "sent")
{
setcookie("setname", '', time()-3000); // unset any existing cookie (just to be sure)
setcookie("setname", $name, time()+3000);
}
// otherwise sends message to user
else
{
Print("sorry, you are not logged in");
}
?>
<html>
<form name="input" method="post" action="newcookie.php">
<table>
<tr>
<td colspan="2" align="center">Please Enter Your Name Below
</td>
</tr>
<td>
<input type="text" name="name">
</td>
<td>
<input type="submit" value="go">
</td>
<input type="hidden" name="form" value="sent">
</form>
</td>
</tr>
<tr>
<form name="logout" method="post" action="newcookie.php">
<td colspan="2" align="center">
<input type="submit" value="Logout">
<input type="hidden" name="logged" value="out">
</td>
</tr>
</table>
</html>
<?
?>