Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] ughh HELP WITH COOKIES PLEASE!!!!


  • From: javascript@xxxxxxxxxx (Terry)
  • Subject: [Javascript] ughh HELP WITH COOKIES PLEASE!!!!
  • Date: Mon, 25 Nov 2002 12:58:49 -0500

This is a multi-part message in MIME format.

------=_NextPart_000_0108_01C29482.65ADE630
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Please show us how you are calling the function...

~ Terry
757 581-5981
AIM/Yahoo: lv2bounce
  ----- Original Message -----=20
  From: Podlesny, Michael=20
  To: 'javascript@xxxxxxxxxx'=20
  Sent: Monday, November 25, 2002 12:52 PM
  Subject: [Javascript] ughh HELP WITH COOKIES PLEASE!!!!


  ughh HELP WITH COOKIES PLEASE!!!!
  The code below only saves my cookie for the page in which it is set.  =
Does anyone have any ideas as to why my cookie is deleted when I access =
the another page on my sitter?

  here is the code


  function set_cookie(name, value, expires, path, domain, secure) {
    var curCookie =3D name + "=3D" + escape(value) +
        ((expires) ? "; expires=3D" + expires.toGMTString() : "") +
        ((path) ? "; path=3D" + path : "") +
        ((domain) ? "; domain=3D" + domain : "") +
        ((secure) ? "; secure" : "");
    document.cookie =3D curCookie;
  }

  // name - name of the desired cookie
  // * return string containing value of specified cookie or null if =
cookie does not exist
  function get_cookie(name) {
    var dc =3D document.cookie;
    var prefix =3D name + "=3D";
    var begin =3D dc.indexOf("; " + prefix);
    if (begin =3D=3D -1) {
      begin =3D dc.indexOf(prefix);
      if (begin !=3D 0) return null;
    } else
      begin +=3D 2;
    var end =3D document.cookie.indexOf(";", begin);
    if (end =3D=3D -1)
      end =3D dc.length;
    return unescape(dc.substring(begin + prefix.length, end));
  }



------=_NextPart_000_0108_01C29482.65ADE630
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2722.900" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Please show us how you are calling the=20
function...</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>~ Terry<BR>757 581-5981<BR>AIM/Yahoo:=20
lv2bounce</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3DMPodlesny@xxxxxxxxxxxx =
href=3D"mailto:MPodlesny@xxxxxxxxxxxx";>Podlesny,=20
  Michael</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Djavascript@xxxxxxxxxx=20
  href=3D"mailto:'javascript@xxxxxxxxxx'">'javascript@xxxxxxxxxx'</A> =
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Monday, November 25, 2002 =
12:52=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [Javascript] ughh HELP =
WITH=20
  COOKIES PLEASE!!!!</DIV>
  <DIV><BR></DIV>
  <DIV><SPAN class=3D522445017-25112002><FONT face=3DArial size=3D2>ughh =
HELP WITH=20
  COOKIES PLEASE!!!!</FONT></SPAN></DIV>
  <DIV><SPAN class=3D522445017-25112002><FONT face=3DArial size=3D2>The =
code below=20
  only saves my cookie for the page in which it is set.&nbsp; Does =
anyone have=20
  any ideas as to why my cookie is deleted when I access the another =
page on my=20
  sitter?</FONT></SPAN></DIV>
  <DIV><SPAN class=3D522445017-25112002><FONT face=3DArial =
color=3D#0000ff=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D522445017-25112002><FONT face=3DArial =
color=3D#0000ff size=3D2>here=20
  is the code</DIV>
  <DIV><BR></DIV></FONT></SPAN>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2>function =
set_cookie(name, value,=20
  expires, path, domain, secure) {<BR>&nbsp; var curCookie =3D name + =
"=3D" +=20
  escape(value) +<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((expires) ? "; =
expires=3D" +=20
  expires.toGMTString() : "") +<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
((path) ? ";=20
  path=3D" +<SPAN class=3D522445017-25112002>&nbsp;path&nbsp;</SPAN>: =
"")=20
  +<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((domain) ? "; domain=3D" + domain =
: "")=20
  +<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((secure) ? "; secure" : =
"");<BR>&nbsp;=20
  document.cookie =3D curCookie;<BR>}</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2>// name - =
name of the=20
  desired cookie<BR>// * return string containing value of specified =
cookie or=20
  null if cookie does not exist<BR>function get_cookie(name) {<BR>&nbsp; =
var dc=20
  =3D document.cookie;<BR>&nbsp; var prefix =3D name + "=3D";<BR>&nbsp; =
var begin =3D=20
  dc.indexOf("; " + prefix);<BR>&nbsp; if (begin =3D=3D -1) =
{<BR>&nbsp;&nbsp;&nbsp;=20
  begin =3D dc.indexOf(prefix);<BR>&nbsp;&nbsp;&nbsp; if (begin !=3D 0) =
return=20
  null;<BR>&nbsp; } else<BR>&nbsp;&nbsp;&nbsp; begin +=3D 2;<BR>&nbsp; =
var end =3D=20
  document.cookie.indexOf(";", begin);<BR>&nbsp; if (end =3D=3D=20
  -1)<BR>&nbsp;&nbsp;&nbsp; end =3D dc.length;<BR>&nbsp; return=20
  unescape(dc.substring(begin + prefix.length, end));<BR>}<BR><SPAN=20
  class=3D522445017-25112002></SPAN></FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
  =
class=3D522445017-25112002></SPAN></FONT></FONT></FONT>&nbsp;</DIV></BLOC=
KQUOTE></BODY></HTML>

------=_NextPart_000_0108_01C29482.65ADE630--