Trouble Setting Cookies

Gregory Lypny gregory.lypny at videotron.ca
Fri Aug 13 17:08:50 EDT 2010


Hi Andre,

Thanks for responding.

I'm afraid I'm not familiar with curl.  I installed FireBug but I'm not clear on how to use it.  I'm not an experienced web developer.  My server is On-Rev.  

This afternoon I tried something even simpler than before and that is a Submit button that executes this script:

<?rev
put new header "Set-Cookie: " & "myCookie" & "=" & 666 & ";path=/"
put "Done."  && the long date && the long time into thePage
put thePage
?>

On a page called "test.irev", I have an HTML object that executes the following (via "include") when the page is loaded:

<?rev
put $_SERVER["HTTP_COOKIE"] into theCookies
put theCookies
?>

Once again "myCookie" is not among the cookies shown on "test.irev" when that page is visited after setting the cookie.

I checked my error log at On_Rev and found the following.  I don't understand why is says that the file "test.irev" does not exist when the page was, in fact, loaded!

[Fri Aug 13 15:54:14 2010] [error] [client myIP] File does not exist: /home/myDomain/public_html/404.shtml, referer: http://myDomain.on-rev.com/test.irev
[Fri Aug 13 15:54:14 2010] [error] [client myIP] File does not exist: /home/myDomain/public_html/favicon.ico, referer: http://myDomain.on-rev.com/test.irev

I'm getting the sinking feeling that I should be looking at alternatives to cookies for managing sessions with my users.

Regards,

Gregory




On Fri, Aug 13, 2010, at 1:00 PM, Andre wrote:

> Gregory,
> 
> Can you do a curl to your host and glue the answer? We need to check if the
> Set-Cookies headers are actually comming thru.
> 
> Andre
> PS: Using firebug to inspect the request is also ok.
> 
> On Thu, Aug 12, 2010 at 5:59 PM, Gregory Lypny
> <gregory.lypny at videotron.ca>wrote:
> 
>> Hello everyone,
>> 
>> Having trouble setting my first cookies at On-Rev.  My iRev script pulls in
>> a page template and puts it into a variable called thePage.  thePage starts
>> with the usual stuff, such as
>> 
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
>> http://www.w3.org/TR/html4/loose.dtd">
>> <html>
>> <head>
>> <meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
>> <title>Sign In</title>
>> 
>> My feeble understanding of setting cookies is that I must send off the
>> request before I load the page, so I created a simple cookie like this
>> 
>>       put "myCookie=" into theCookie
>>       put 6666 after theCookie
>> 
>> I then sent if off with
>> 
>>       put new header ("Set-Cookie:" && theCookie)
>> 
>> and then immediately followed with
>> 
>>       put thePage
>> 
>> But the cookie does not appear in Safari's cookie listing or by checking
>> $_SERVER["HTTP_COOKIE"].  The latter, however, gives me two cookies set by .
>> revolutionss.com, which presumably has something to do with my On-Rev
>> account.
>> 
>> I also tried Andre Garzia's function
>> 
>>       setCookie "myCookie",6666
>> 
>> but struck out there too.  What am I doing wrong?
>> 
>> Regards,
>> 
>> Gregory




More information about the use-livecode mailing list