473,395 Members | 1,539 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,395 software developers and data experts.

Writing cookie to disk

I am using setcookie() to put a cookie on the visitor's machine. When I do
so, the cookie is set for that browser session, but not written to disk.
What am I missing to write it to the disk? Code snippet:

$cookset = setcookie("origpbx", $_POST['pbx'], 0)

Thanks,

Mike
Jul 17 '05 #1
3 2220
Mike Wilcox wrote:
I am using setcookie() to put a cookie on the visitor's machine. When I do
so, the cookie is set for that browser session, but not written to disk.
What am I missing to write it to the disk?
You're missing a review of the setcookie() function, namely its third
parameter.

http://www.php.met/setcookie

Code snippet:

$cookset = setcookie("origpbx", $_POST['pbx'], 0)


Some browsers can be configured to only allow session cookies (or
convert cookies that expire in the year 2038 to be transformed into
session cookies).
--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #2
Pedro Graca <he****@dodgeit.com> wrote in
news:sl*******************@ID-203069.user.uni-berlin.de:
Mike Wilcox wrote:
I am using setcookie() to put a cookie on the visitor's machine. When
I do so, the cookie is set for that browser session, but not written
to disk. What am I missing to write it to the disk?


You're missing a review of the setcookie() function, namely its third
parameter.

http://www.php.met/setcookie

Code snippet:

$cookset = setcookie("origpbx", $_POST['pbx'], 0)


Some browsers can be configured to only allow session cookies (or
convert cookies that expire in the year 2038 to be transformed into
session cookies).


That would seem to be the case. Setting it to expire in 120 days has
done the trick.

Thanks for the info.

Mike
Jul 17 '05 #3
Hi
IUf you don't specify an expiry period and cookie domain it will revert
to a session cookie.

Put this in the header and it will write a cookie to disk that expires
after 1 week
$days=7;
$cook_expiry = time()+(60*60*24*$days);
setcookie("cookie_name",
"cookie_value",
$cook_expiry,
"/",
".your_cookie_domain.com");
Mike Wilcox wrote:
I am using setcookie() to put a cookie on the visitor's machine. When I do
so, the cookie is set for that browser session, but not written to disk.
What am I missing to write it to the disk? Code snippet:

$cookset = setcookie("origpbx", $_POST['pbx'], 0)

Thanks,

Mike

Jul 17 '05 #4

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

Similar topics

7
by: Phil Powell | last post by:
I am having this problem: My PHP script will set a cookie, it's there in my /Cookies folder. I delete the cookie (I have to for testing purposes, the PHP script I run behaves according to this...
5
by: AHN | last post by:
Please tell me somebody what causes the cookie set with <% Response.Cookies("blah") = "Blah blah" Response.Cookies("blah").Expires = DateAdd( "h", 1, Now() ) %> work as supposed on my local...
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
4
by: Shannon Jacobs | last post by:
I'm doing some trivial surveys, and I want to know if the same user answers twice. Can't really know that, but at least I thought I could check for the same browser/computer combination by using a...
7
by: Christoph Pieper | last post by:
Hi, we've the following problem : We have an asp-application which sets the cookie on first login. The cookie will never be touched during user access. The user can work the whole day, but...
0
by: Nicolas Joly | last post by:
Hello, I have this (a cookie writer) <script runat="server"> void WriteClicked(Object Sender, EventArgs e) { //Create a new cookie, passing the name into the constructor HttpCookie cookie =...
2
by: BH | last post by:
I developed a small web app using the FormsAuthentication class to set a cookie (FormsAuthentication.SetAuthCookie(value, isPersist)). The cookie persists fine on my local PC when "isPersist" is...
29
by: Jerim79 | last post by:
I did try to find the answer to this before posting, so this isn't a knee jerk reaction. What I am trying to accomplish is to have a script that opens a cookie, reads a value, and then use a...
7
by: monomaniac21 | last post by:
hi i have a php site which allows users to save a cookie on their computer which stores their user id details and allows them to auto- login. i'm wondering whether this is safe, is it...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...

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.