473,224 Members | 1,618 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

TCL, PHP and cookies - AUGH!

Ok now it has turned to the bizarre.

In /cma/index.php, which sets the cookie:

setcookie('username', $username, time() + 600);
....
header("Location...");

It redirects to the TCL CGI /cma_main.cgi which in turns does NOT see the
cookie name "username" ever set. I go to my /Phil/Cookies folder for the
cookie under the "valsignalandet.com" domain and, sure enough, "username" is
not set. However, $HTTP_COOKIE_VARS["username"] DOES exist every time I go
to /cma/index.php thereafter, in spite of nothing else showing a cookie
exists.

So, in short, "setcookie()" in PHP is setting a nonexistent cookie.

Phil
----- Original Message -----
From: "Chris Snyder" <cs*****@chxo.com>
To: "NYPHP Talk" <ta**@lists.nyphp.org>
Sent: Thursday, July 31, 2003 1:36 PM
Subject: Re: [nyphp-talk] TCL, PHP and cookies - AUGH!

In fact, if $env(SERVER_NAME) works, I'd try $env(HTTP_COOKIE) and see
what it comes up with.

Chris Snyder wrote:
The key to finding the cookie in TCL might be the $env list?


_______________________________________________
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk


_______________________________________________
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
Jul 16 '05 #1
4 2637
"Phil Powell" <so*****@erols.com> wrote in message
news:<tydWa.36$cf.33@lakeread04>...

In /cma/index.php, which sets the cookie:

setcookie('username', $username, time() + 600);
...
header("Location...");

It redirects to the TCL CGI /cma_main.cgi which in turns does NOT
see the cookie name "username" ever set.


Which is exactly what should be happening. Since you omitted
the optional 'path' argument, the cookie is set for the current
directory (in your case, /cma). When you try to read the cookie
from the root directory, nothing happens, because your cookie
is not set for the root directory...

It's all in the docs, read 'em:

http://php.net/setcookie

Cheers,
NC
Jul 16 '05 #2
Well, I added the path '/' to setcookie, to no avail. Same problem; Cookie
did not appear in the browser cookie file nor anywhere else, yet
$HTTP_COOKIE_VARS["username"] exists...

The PHP script is on a Linux server too BTW..

Phil

"Nikolai Chuvakhin" <nc@iname.com> wrote in message
news:32**************************@posting.google.c om...
"Phil Powell" <so*****@erols.com> wrote in message
news:<tydWa.36$cf.33@lakeread04>...

In /cma/index.php, which sets the cookie:

setcookie('username', $username, time() + 600);
...
header("Location...");

It redirects to the TCL CGI /cma_main.cgi which in turns does NOT
see the cookie name "username" ever set.


Which is exactly what should be happening. Since you omitted
the optional 'path' argument, the cookie is set for the current
directory (in your case, /cma). When you try to read the cookie
from the root directory, nothing happens, because your cookie
is not set for the root directory...

It's all in the docs, read 'em:

http://php.net/setcookie

Cheers,
NC

Jul 16 '05 #3
Try setting your browser to ask for confirmation before setting the
cookie (Mozilla is good for cookie management) and see if setcookie
really is working.

Additionally, confirm that your system clock is the same as the server
clock. Cookies will only be returned by the browser back to the script
if it thinks its not expired, so a system clock 10 minutes faster than a
server clock (or the other way round) will cause problems... :)

Phil Powell wrote:
Ok now it has turned to the bizarre.

In /cma/index.php, which sets the cookie:

setcookie('username', $username, time() + 600);
...
header("Location...");

It redirects to the TCL CGI /cma_main.cgi which in turns does NOT see the
cookie name "username" ever set. I go to my /Phil/Cookies folder for the
cookie under the "valsignalandet.com" domain and, sure enough, "username" is
not set. However, $HTTP_COOKIE_VARS["username"] DOES exist every time I go
to /cma/index.php thereafter, in spite of nothing else showing a cookie
exists.

So, in short, "setcookie()" in PHP is setting a nonexistent cookie.

Phil
----- Original Message -----
From: "Chris Snyder" <cs*****@chxo.com>
To: "NYPHP Talk" <ta**@lists.nyphp.org>
Sent: Thursday, July 31, 2003 1:36 PM
Subject: Re: [nyphp-talk] TCL, PHP and cookies - AUGH!
In fact, if $env(SERVER_NAME) works, I'd try $env(HTTP_COOKIE) and see
what it comes up with.

Chris Snyder wrote:

The key to finding the cookie in TCL might be the $env list?


______________________________________________ _
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk

_______________________________________________
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk


--
MeerKat

Jul 16 '05 #4
Hi,

I've the same problem on my LAMP Server.

I set the cookie with setcookie and path "/" in a directore /Logon.
Everything works fine within that directory (the cookie is found). But when
trying to get the cookie in f.e. /Events/Wedding it's not there (but set in
the browser).

This seems to be a problem for PHP Session management as well because
session_start() is also not identifying the session created in the /Logon
folder.....

regs
Volkmar

"MeerKat" <li****************@blueyonder.co.uk> wrote in message
news:UR*************@news-binary.blueyonder.co.uk...
Try setting your browser to ask for confirmation before setting the
cookie (Mozilla is good for cookie management) and see if setcookie
really is working.

Additionally, confirm that your system clock is the same as the server
clock. Cookies will only be returned by the browser back to the script
if it thinks its not expired, so a system clock 10 minutes faster than a
server clock (or the other way round) will cause problems... :)

Phil Powell wrote:
Ok now it has turned to the bizarre.

In /cma/index.php, which sets the cookie:

setcookie('username', $username, time() + 600);
...
header("Location...");

It redirects to the TCL CGI /cma_main.cgi which in turns does NOT see the cookie name "username" ever set. I go to my /Phil/Cookies folder for the cookie under the "valsignalandet.com" domain and, sure enough, "username" is not set. However, $HTTP_COOKIE_VARS["username"] DOES exist every time I go to /cma/index.php thereafter, in spite of nothing else showing a cookie
exists.

So, in short, "setcookie()" in PHP is setting a nonexistent cookie.

Phil
----- Original Message -----
From: "Chris Snyder" <cs*****@chxo.com>
To: "NYPHP Talk" <ta**@lists.nyphp.org>
Sent: Thursday, July 31, 2003 1:36 PM
Subject: Re: [nyphp-talk] TCL, PHP and cookies - AUGH!
In fact, if $env(SERVER_NAME) works, I'd try $env(HTTP_COOKIE) and see
what it comes up with.

Chris Snyder wrote:
The key to finding the cookie in TCL might be the $env list?

______________________________________________ _
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk

_______________________________________________
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk


--
MeerKat

Jul 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with storing cookies with ASP? I'm trying this with two browsers: One is IE 6.0 with cookies set to 'prompt'. This has been working properly as any...
20
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
9
by: | last post by:
Is it possible for a user to enable permanent cookies but disable session cookies.....this seems like a contradition yet this is what I appear to be reading in online articles?
1
by: John Taylor-Johnston | last post by:
I'm a University academic looking for a proper definition of JavaScript Cookies. http://www.CollegeSherbrooke.qc.ca/languesmodernes/604-HAE_Grammar_Practice/ I'm trying to decipher what...
6
by: Mark | last post by:
Hi... I've come across some weird bug with Response.Cookies. Or maybe it will be called "by design" but for the life of me I can't figure out what purpose it would serve. If you're setting a...
8
by: CDARS | last post by:
Hi all, I have a confusing question on ASP.NET cookies usage: 1> Response.Cookies("test").value = Now 2> Response.Write(Request.Cookies("test").value) 3> 4> Response.write("<hr>") 5>...
6
by: Stephane | last post by:
Hi, I have a login page where if the user wants his access codes to be saved are set into a cookie. In the logout page, I want to delete those cookies. I tried this and this is not working at...
1
by: Alex Nitulescu | last post by:
I have the following very simple colde (while learning about cookies and session state): Private Sub cmdAddCookie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
0
by: rn5a | last post by:
This is how I am creating & then reading cookies: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) 'create cookies Response.Cookies("UserName").Value = "Ron"...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.