bleachedtips
09-05-2002, 05:30 PM
I don't know what i'm doing wrong but my PHP scripts that work fine on Windows NT never work on Unix.
Like take this code for example:
<? if ($action == "setcookie") {
setcookie("chocolatechip", $alias, 3600);
header('Location: login.php');
} elseif ($action == "unsetcookie") {
setcookie("chocolatechip", $alias, -3600);
header('Location: login.php');
} ?>
<? if (isset ($chocolatechip)) { ?>
<html><body>
Welcome back, <? echo $_COOKIE["chocolatechip"]; ?> | <a href="login.php?action=unsetcookie">Forget Me</a>
</body></html>
<? } else { ?>
<html><body>
<form action="login.php?action=setcookie" method="post">
<input type="text" name="alias">
<input type="submit" name="setcookie" value="Remember Me">
</form>
</body></html>
<? } ?>
What it does it set a cookie with the users name in it, so it remembers them the next time they visit the page. And it works on my NT server, but when I put it on the Unix one, all I get is this:
Welcome back, | Forget Me
The cookie part doesn't work. I've had this problem with every script i've made so it must be something i'm just missing. I'm pretty new to PHP so can someone explain this to me?
Thanks a bunch
Like take this code for example:
<? if ($action == "setcookie") {
setcookie("chocolatechip", $alias, 3600);
header('Location: login.php');
} elseif ($action == "unsetcookie") {
setcookie("chocolatechip", $alias, -3600);
header('Location: login.php');
} ?>
<? if (isset ($chocolatechip)) { ?>
<html><body>
Welcome back, <? echo $_COOKIE["chocolatechip"]; ?> | <a href="login.php?action=unsetcookie">Forget Me</a>
</body></html>
<? } else { ?>
<html><body>
<form action="login.php?action=setcookie" method="post">
<input type="text" name="alias">
<input type="submit" name="setcookie" value="Remember Me">
</form>
</body></html>
<? } ?>
What it does it set a cookie with the users name in it, so it remembers them the next time they visit the page. And it works on my NT server, but when I put it on the Unix one, all I get is this:
Welcome back, | Forget Me
The cookie part doesn't work. I've had this problem with every script i've made so it must be something i'm just missing. I'm pretty new to PHP so can someone explain this to me?
Thanks a bunch