473,782 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TCL, PHP and cookies - AUGH!

Ok now it has turned to the bizarre.

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

setcookie('user name', $username, time() + 600);
....
header("Locatio n...");

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_VA RS["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.c om>
To: "NYPHP Talk" <ta**@lists.nyp hp.org>
Sent: Thursday, July 31, 2003 1:36 PM
Subject: Re: [nyphp-talk] TCL, PHP and cookies - AUGH!

In fact, if $env(SERVER_NAM E) works, I'd try $env(HTTP_COOKI E) 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.nyph p.org
http://lists.nyphp.org/mailman/listinfo/talk


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

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

setcookie('user name', $username, time() + 600);
...
header("Locatio n...");

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_VA RS["username"] exists...

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

Phil

"Nikolai Chuvakhin" <nc@iname.com > wrote in message
news:32******** *************** ***@posting.goo gle.com...
"Phil Powell" <so*****@erols. com> wrote in message
news:<tydWa.36$ cf.33@lakeread0 4>...

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

setcookie('user name', $username, time() + 600);
...
header("Locatio n...");

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('user name', $username, time() + 600);
...
header("Locatio n...");

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_VA RS["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.c om>
To: "NYPHP Talk" <ta**@lists.nyp hp.org>
Sent: Thursday, July 31, 2003 1:36 PM
Subject: Re: [nyphp-talk] TCL, PHP and cookies - AUGH!
In fact, if $env(SERVER_NAM E) works, I'd try $env(HTTP_COOKI E) 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.ny php.org
http://lists.nyphp.org/mailman/listinfo/talk

_______________ _______________ _______________ __
talk mailing list
ta**@lists.nyph p.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.blueyond er.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('user name', $username, time() + 600);
...
header("Locatio n...");

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_VA RS["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.c om>
To: "NYPHP Talk" <ta**@lists.nyp hp.org>
Sent: Thursday, July 31, 2003 1:36 PM
Subject: Re: [nyphp-talk] TCL, PHP and cookies - AUGH!
In fact, if $env(SERVER_NAM E) works, I'd try $env(HTTP_COOKI E) 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.ny php.org
http://lists.nyphp.org/mailman/listinfo/talk

_______________ _______________ _______________ __
talk mailing list
ta**@lists.nyph p.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
3884
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 new site I goto seems to prompt me to store their cookie. The other is Pocket IE on Pocket PC 2002, with the cookies set to 'enabled'. My problem is that the cookies dont seem to be being written with my ASP. I dont get the prompt to store...
20
3558
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
2537
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
3180
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 categor(ies) JavaScript cookies fall under, according to Internet Explorer's help.cfm. What I don't understand is where do JavaScript cookies fall under the help.cfm definition. Maybe I'm not reading "their" English properly? (See below.) "Persistent -...
6
3058
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 cookie (say Response.Cookies ("TEST")) and you have a query string variable &test=x or &Test=x and you get Request.QueryString to parse the query string, the cookie that gets dropped matches the case of the query string, not what your code says. ...
8
2342
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> Response.Cookies("test").value = Now.AddDays(10)
6
8853
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 all: if (Request.Cookies != null && Request.Cookies != null) { Response.Cookies.Value = null;
1
11455
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 cmdAddCookie.Click Dim strCookieName As String Dim objRandom As New Random() strCookieName = "MyCookie" & objRandom.Next(Integer.MaxValue).ToString
0
1601
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" Response.Cookies("UserName").Expires = "12/31/2008" Response.Cookies("UserDetails")("FirstName") = "Ronnie" Response.Cookies("UserDetails")("LastName") = "Nathan"
0
9479
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9942
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2874
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.