CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
COOKIE SCRIPT - HELP ASAP

 



TRPlace
Deleted

Mar 8, 2000, 2:22 AM

Post #1 of 5 (1025 views)
COOKIE SCRIPT - HELP ASAP Can't Post

I have a cookie script. http://www.therealplace.com/searchit/
You click customize fill out the info and select a couple of different kinds of
newses. Then click customize. You see tabs on the page. Then close off the page
and go back it to, the tabs are gone. How can I make it so it stays? (its part
of the cookie script


Admin
Deleted

Mar 8, 2000, 12:56 PM

Post #2 of 5 (1025 views)
Re: COOKIE SCRIPT - HELP ASAP [In reply to] Can't Post

It seems like the cookies are set to expire as soon as the browser session closes, which is the default behaviour for not setting a cookie expiration date.

You'll need to add the expiration date when you set the cookie by adding:

expires=Sun, 31-Dec-2000 00:00:00 GMT

to your cookies, along with the cookie key/values.


TRPlace
Deleted

Mar 8, 2000, 1:48 PM

Post #3 of 5 (1025 views)
Re: COOKIE SCRIPT - HELP ASAP [In reply to] Can't Post

Can you go to www.therealplace.com/searchit/
And see where I have to put it? And make sure to see the customize link.


Thanks


TJ


Admin
Deleted

Mar 9, 2000, 10:09 AM

Post #4 of 5 (1025 views)
Re: COOKIE SCRIPT - HELP ASAP [In reply to] Can't Post

TJ -- I checked earlier and it looks like Javascript cookies. Sorry, but I don't know enough Javascript to set and retrieve cookies using them.

I went back, and the cookies remembered my name, but didn't set the tabs (apparently you changed them to links).

I tried again, and closed the browser -- this time it remembered the links. All's well now?


Cure
User

Mar 9, 2000, 2:05 PM

Post #5 of 5 (1025 views)
Re: COOKIE SCRIPT - HELP ASAP [In reply to] Can't Post

Hi
Heres a JAVASCRIPT that will set and retreive cookies and the experiation date as well::

This should do everything your asking for:


function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "")
if ((name + "=" + escape(value)).length <= 4000)
document.cookie = curCookie
else
if (confirm("Cookie exceeds 4KB and will be cut!"))
document.cookie = curCookie
}

function getCookie(name) {
var prefix = name + "="
var cookieStartIndex = document.cookie.indexOf(prefix)
if (cookieStartIndex == -1)
return null
var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex +
prefix.length)
if (cookieEndIndex == -1)
cookieEndIndex = document.cookie.length
return unescape(document.cookie.substring(cookieStartIndex +
prefix.length,
cookieEndIndex))
}

function deleteCookie(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT"
}
}

function fixDate(date) {
var base = new Date(0)
var skew = base.getTime()
if (skew > 0)
date.setTime(date.getTime() - skew)
}


Cure

[This message has been edited by Cure (edited 03-09-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives