| View previous topic :: View next topic |
| Author |
Message |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Jul 17, 2002 7:06 pm Post subject: Set and Read Cookies? |
|
|
Not sure anyone has this info or not. But there was previously some info on setting and reading cookies via VDS some time ago, but now I can't find this info... Does anyone have this info?
Thanks,
-Garrett |
|
| Back to top |
|
 |
nick Contributor

Joined: 15 Aug 2000 Posts: 50 Location: hamburg,nj
|
Posted: Thu Jul 18, 2002 1:32 pm Post subject: cookies |
|
|
Hi Garrett:
Is this what you are looking for.
The html form:
| Code: |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>COOKIES</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<FORM Action="http://192.168.0.6/cgi-bin/cookies.exe" Method="POST">
Your Name: <INPUT Name="Myname" Size=35><br>
<INPUT Type="Submit" Value="Submit"><INPUT Type="Reset" Value="Clear">
</FORM>
</BODY>
</HTML>
|
The vds cgi exe:
| Code: |
EXTERNAL VDSinet.DLL,"your license code"
NET CGI, AUTOPARSE
rem reads previously set cookie**
%%cookie = @env(HTTP_COOKIE)
%%name = @NET(CGI, PARSE,myName)
net cgi,write,Content-type: text/html
rem sets new cookie**
net cgi,write,Set-Cookie: myname=%%name; expires=Fri"," 26-Jul-2002 18:12:10 GMT; Path=/;
net cgi,write,<HTML>
net cgi,write,<head>
net cgi,write,<TITLE>MY cookies</TITLE>
net cgi,write,<basefont size="3" face"arial">
net cgi,write,</HEAD>
net cgi,write,<body>
net cgi,write,This is your name %%name <br>
net cgi,write,Your last cookie was: %%cookie
net cgi,write,</BODY></HTML>
exit
|
I hope this helps.
Nick |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jul 18, 2002 6:47 pm Post subject: |
|
|
Hi Nick,
Thanks for the input and code... I had figured out how to read the cookies, but not set them yet.
Unfortunately, the set cookie method you have won't exactly work for what I need.
There should be a way to set the cookie without having to use the form.
What the info online shows is this:
Set-cookie: MeLove=Cookie%20Monster; expires=Thursday, 01-Jan-98 12:00:00 GMT
Somehow, we should be able to send this with our info to set the cookie, but so far, I can't seem to get it to work. It merely prints this info to the page when the SSI calls my cgi, or if I directly go to the cgi.
| Code: | | <!--#exec cgi="/cgi-bin/cookies.exe" --> |
| Code: | | net cgi,write,Set-cookie: Testing=TestEntry; Domain=sitesoup.com |
I now also have a bet going with ED. He seems to think that we can't set and read cookies via a vds cgi program. Somehow, he's got it in his mind that it can only be done on the client side using ASP. So if I prove him wrong, he must stand in the middle of the SADE Offices and jump and down like a monkey and scratch his arm pits. And! He must do this in front of a web cam for me to see.. heheheheheheheeee
What bums me out most, is that there was code for this already out there... But now can't seem to be found at all.
-Garrett
Last edited by Garrett on Thu Jul 18, 2002 7:06 pm; edited 2 times in total |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jul 18, 2002 6:55 pm Post subject: |
|
|
Hmmm.... Just realized you also used the Set-Cookie:
-Garrett |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jul 18, 2002 7:08 pm Post subject: |
|
|
Hi again Nick,
Just tried your code as-is and it sets the cookie. That's great!... Now if I can just find a way to get that to set using the SSI call that I'm using.
I think ED shall be jumping up and down like a monkey scratching his arm pits in the middle of the SADE Offices.
-Garrett |
|
| Back to top |
|
 |
nick Contributor

Joined: 15 Aug 2000 Posts: 50 Location: hamburg,nj
|
Posted: Thu Jul 18, 2002 7:09 pm Post subject: cookies |
|
|
Hi again:
I may be confused - ok - I am confused. You really only have to call the cgi to set the cookie. If I am reading your reply correctly you are getting the set cookie statement printing only to the browser. This is probably because the set cookie statement must be placed before the "<HTML>" and "<HEAD>" tags.
Nick _________________ nick |
|
| Back to top |
|
 |
nick Contributor

Joined: 15 Aug 2000 Posts: 50 Location: hamburg,nj
|
Posted: Thu Jul 18, 2002 7:10 pm Post subject: |
|
|
-oops you beat me to it. _________________ nick |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jul 18, 2002 7:17 pm Post subject: |
|
|
Ooooooo..... Ok, that may be the error of my ways then.. I've had the ssi tag after the HEAD tag.
BRB, let me try at the top of the page instead.
-Garrett |
|
| Back to top |
|
 |
nick Contributor

Joined: 15 Aug 2000 Posts: 50 Location: hamburg,nj
|
Posted: Thu Jul 18, 2002 7:27 pm Post subject: |
|
|
I'm not sure exactly what your doing -but I believe I use a redirect on the entry page to one of my reservation processing sites. The redirect points to the cookie exe. It gives me the opportunity retrieve the cookie and to see if the customer is in the database and if so I can send them current info.
When I get a chance I will take a look at my code for that site.
Nick |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jul 18, 2002 7:34 pm Post subject: |
|
|
No, no need to look any further.... My ssi tag was after the header info of the page... Putting it as the very first thing on the page resolves the problem completely... I can now read and or set the cookie from the ssi call now.
Nick, I thank you greatly for the help on this. I was about to bang my head on the desk had it not been for you stepping forward to help me.
-Garrett |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jul 18, 2002 7:37 pm Post subject: |
|
|
Now where's that Monkey Boy Emmanuel????
He's got a show to put on for me!
-Garrett
Last edited by Garrett on Thu Jul 18, 2002 7:48 pm; edited 1 time in total |
|
| Back to top |
|
 |
nick Contributor

Joined: 15 Aug 2000 Posts: 50 Location: hamburg,nj
|
Posted: Thu Jul 18, 2002 7:40 pm Post subject: |
|
|
Your very welcome -glad I could help.
Nick _________________ nick |
|
| Back to top |
|
 |
|