PDA

View Full Version : Help with cookies?


Jacob Stetser
01-20-1999, 02:49 PM
Hi http://www.aota.net/ubb/smile.gif

I need to write a little PHP scriptlet on my index page that will let me test for the existence of a certain cookie and-

if it exists: redirect the user to another page.

if it doesn't: set the cookie for the user.

How do I go about doing this?

I know how to set the cookie, but I'm not very familiar with PHP.. learning.. and I don't know how to check for the value.. hmm

nor do I know how to redirect...

and I don't know how to structure it http://www.aota.net/ubb/smile.gif

Help! http://www.aota.net/ubb/smile.gif

Justin
01-20-1999, 03:37 PM
http://www.php.net

Great place to learn. There's a lot of stuff there. Just do a search for "http cookie". I saw it there somewhere, and there's also something on "http redirect". It's all listed under "http headers".

Justin
-- Still trying to figure out http uploading --

Jacob Stetser
01-20-1999, 03:53 PM
Figured it out! http://www.aota.net/ubb/smile.gif

It's fun to accomplish something you didn't know you could do:

Here's the code...

<?php
if(isset($testcookie))
{
//Gotosuccess-page
Header( "Location:http://www.somewhere.com");
}
else
{
// Set a cookie so next time they go to the right page
SetCookie("testcookie","test",time()+36000000);
}

//Goodbye
?>

Yay http://www.aota.net/ubb/smile.gif