Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > JavaScript cookies (in subdirectories) and PHP file

Reply
Thread Tools

JavaScript cookies (in subdirectories) and PHP file

 
 
duane
Guest
Posts: n/a
 
      09-16-2003
Dear Experts:

I have a problem with my JS cookies. I am setting cookies in files
located in two different directories, e.g. one in ROOT, one in
ROOT/dir1/dir2. The cookies are then sent to PHP file (server-side)
which writes their values to a textfile, e.g. OUT.txt.

The cookies that are in ROOT are working perfectly. No problem. The
cookies set in ROOT/dir1/dir2, however, "seemed" to be set and read
correctly, although
they are never written into OUT.txt in the server. I have used:

javascript.alert(document.cookie);

to make sure that all the cookies are set and read properly. They are
displaying correct cookie values. I have also set the path of cookies
in ROOT/dir1/dir2 to ROOT directory, e.g. path=/, making sure the
cookies are accessible from anywhere in the domain.

I am running out of ideas what may cause the problem and hope you
could help me.

Any help would be greatly appreciated.

Duane
 
Reply With Quote
 
 
 
 
Janwillem Borleffs
Guest
Posts: n/a
 
      09-18-2003

"duane" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed) om...
>
> I have a problem with my JS cookies. I am setting cookies in files
> located in two different directories, e.g. one in ROOT, one in
> ROOT/dir1/dir2. The cookies are then sent to PHP file (server-side)
> which writes their values to a textfile, e.g. OUT.txt.
>


How do you write the cookies to the text file?

> The cookies that are in ROOT are working perfectly. No problem. The
> cookies set in ROOT/dir1/dir2, however, "seemed" to be set and read
> correctly, although
> they are never written into OUT.txt in the server. I have used:
>
> javascript.alert(document.cookie);
>


Be aware that when testing cookies this way, they will be available before
the cookie header is send. This is because in JavaScript, 'document' is an
object and 'cookie' a property of this object.

In PHP, the cookie is available not sooner then after a reload of the page.


JW



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cookies set in php, read in javascript Paul.Lee.1971@gmail.com Javascript 5 11-02-2009 04:50 PM
PHP Training Institute In Delhi, Live Projects on PHP. Short TermPHP Courses, PHP Scripts, PHP Training with Live Projects. Rajive Narain Java 0 09-18-2009 10:47 AM
Give Request.Cookies and Response.Cookies is there any reason to use another method to use cookies? _Who ASP .Net 7 09-18-2008 07:49 PM
Validate your html forms with javascript and php with a simple php class __ Javascript 1 10-02-2007 11:06 AM
Writing a PHP and Javascript generated page to a PHP variable... jonnyblazed@gmail.com Javascript 3 09-04-2006 12:45 PM



Advertisments