Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Differance Between Session Cookies And Persistent Cookies


Can anybody knows the differance between Session cookies and persistent
cookies.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Persistent Logins With Cookies
I am trying to make a persistent login like you find at yahoo and livejournal.

i have basic knowledge about cookies. i am thinking to store the username and password as a cookie, with setcookie(). the problem is that there is an expiration date on the cookie.

what is a way that i can work around the expiration date so that it is forever? i know some sites do something with ip's? what if the ip is not static?

PHP 4 Session Without Cookies
I need to use php sessions without cookies, my session registers works perfect, but I really don't know how to use an expiration time as it is used with cookies. Do you know what can I do to use an expiration time of 15 minutes??. I've tried using mysql to save the session ID's and check there if the sessoin is already registered and how long it has been inactive to see if it's an accepted time, but it really uses a lot of resources just to check. And if you have a lot of visitors at your page your machine almost die.

Other thing is that the session Id's keeps saved in my /tmp and are never deleted if you don't do a logout where I use the destroy code.

Set Cookies And Session Id
I have a big problem with a login page using cookies.
The most of registered members can access and login, instead someone else, with the same pc configuration and browser can't access!

Why?
I debugged the page when the member was online and i noticed the following:
- i verified the SID and it miss
- he can't create the session id and the cookie...

Of course i ask the members to check their cookies config but it's the same!

Into the login page i wrote this code to create teh cookie:

setcookie("pippo", $datichemiservono, time()+72000);
header("Location: fc_news.php");

then the page does a redirect on the autentication page. In $datichemiservono i got all needed info which have to be written into the cookie.

Into the autentication page, as far as some members couldn't login, i tried to wrote some executive code with the same result at the end-

This is the code:

if (isset ($HTTP_COOKIE_VARS) )
{
while (list ($nome, $valore) = each ( $HTTP_COOKIE_VARS ) )
{
$arryvalore = explode("#", $valore);
$session_nome = $arryvalore[0];
$session_cognome = $arryvalore[1];
if ($session_cognome!= "") {

$session_mail = $arryvalore[2];
$session_username = $arryvalore[3];
$session_id = $arryvalore[4];
$session_tessera = $arryvalore[5];
$session_lingua = $arryvalore[6];

}
//echo "$valore<br>U: $session_nome<br>------------------";
break;
}
}

if ($pippo)
{
//echo "Ciao: $pippo";
$arryKylieFC = explode("#", $pippo);

$session_cognome = $arryKylieFC[1];
$session_mail = $arryKylieFC[2];
$session_username = $arryKylieFC[3];
$session_id = $arryKylieFC[4];
$session_tessera = $arryKylieFC[5];
$session_lingua = $arryKylieFC[6];
}

as u can see there's 2 ECHO debug annoted but if activate them i can see both, instead some of the other members can't see any of them!Now i can't see what else i can do.

Session Cookies
I wanted to ask if it's possible to set a cookie so that it expires as soon as the user closes the browser. I know how to set cookies that for a while like

setcookie("user", "asuzuki", time()+864000);

for ten days. Is this possible?

Session Ids Without Cookies
i have just been to see my system administrator about why the cookies arent being set when im trying to use them in php. he said he cant change the ways its configured as other things depend on it, is there a way do use sessions without using cookies?

Which Is Better, Session Or Cookies?
which is better process for user login in a website, Session or Cookies. If Cookies is better, then please give any link where I can find easy and vivid knowledge for implementing cookies login system in my site. Btw, at present I am using Session for login system in my site.

How Do I Use Cookies With Session Functions?
I have learned fairly well the basic mechanics of how "cookies" and PHP "session" functions work. I'm now trying to figure out the best way to apply cookies and sessions to my web site.

If you would, please consider the following:

The visitor's $UserName variable is stored in the web hosting database. After a visitor logs in to my web site his $UserName variable is inserted into the PHP "session" (after using session_register( ), of course) and the visitor's $UserName variable is moved from session-enabled page to session-enabled page. Clear enough.

Also, I have learned to append the ".SID." constant to the end of the URL's in case the person has the "cookies" enablement turned off in their browser. The PHPSESSID is conveyed to the next page by way of the URL string.

I have noticed that web sites like eBay, Yahoo!, and others require that cookies be enabled for $UserName access. Since the leading web sites require cookies I'm thinking that I will do the same.

My question is this: What are good ways to use the "cookies" concept in conjunction with the PHP "session" functions?

Cookies And Session Variables
To find out were session variables are stored I included this
instruction in my program:

echo ini_get("session.save_path");

The reply was /home/7604/data/tmp which is a folder on my server.
I look at /home/7604/data/tmp and it is full of session files for
today....

Cleaning Up Session Cookies
I have a problem where session cookies get left inside
the temporary folder. Is this a common problem or is
there perhaps something I've over looked - there a
way to make sure the session variables get cleaned up?

Where Does Php Session Cookies Stored
Where does the cookies stored in the client machine that php
creates after calling session_start() function.

I am using IE... I checked in the following folders but no
cookies are stored.

1)C:Documents and SettingsAdministratorLocal SettingsTemporary
Internet Files
2)C:Documents and SettingsAdministratorCookies
3)C:Documents and SettingsAdministratorCookiesindex.dat

Using Session Timeout Without Cookies
I am working on a PHP project where the client is telling me to make a session timeout after 1 hour. I am not using cookies in my site. But as per the php.ini file on the server the timeout had been set to 180 secs (by default), hence the page expires after 3 minutes. Now I need to make this work by setting the session timeout upto 1 hour.

Cookies And Session Variables
I need to save values typed into forms across several scripts, before
the user actually 'submits' the form to update the mysql db.

I have been exploring ways to do this, and looking for some guidance as
to whether to use
cookies or PHP session variables.

Should my use of either be conservative due to performance reasons?
What are the advantages of either?

To briefly describe what I am trying to do:
I have 3 forms : formA, formB and formC
each has about 15 entry fields (from the same mysql table).
formA has fieldA1, fieldA2, etc
formB has fieldB1, fieldB2, etc
formC has fieldC1, fieldC2, etc

The user can navigate from formA to formB, etc with a button click.

Right now, I am populating each form from the mysql db value. But I
need to save values typed in while the user navigates from page to
page. Eventually, the user submits and I update the db from all forms.
The easiest way for me to incorporate this into my existing logic is
to, before going into formA, set a cookie (or session variable) for
each field. If they go to formA and change a value, reset the cookie
(I am doing this with an onblur call to javascript function.) Seems
inefficient for me to set a cookie for every field...they may only
change 1 field...or none.
But I am having trouble grasping any other way to do it....Thus, my
question about efficiencies, performance, etc.

Session+cookies Expiration
I just started to use/learn php session and cookies. Everything looks fine,
I took a quick look at the php session man pages but there's two little
things that I can't figure out completely.

1- A simple page to see what happens behind the scene:
<?
session_start();
$_SESSION['TEST'] = "This is a test";
phpinfo();
?>

Session config looks like this:
session.cache_expire = 30
session.cookie_lifetime = 1800
session.gc_maxlifetime = 1440

phpinfo() show the following HTTP Response Headers :
Set-Cookie: PHPSESSID=sgkddlmuepiksd48pq1tmj38s0; expires=Sat, 21-May-2005
10:38:41 GMT; path=/
[Which is ok ... cookie will expire in 30 minutes (1800 seconds)]
EXPIRES: Thu, 19 Nov 1981 08:52:00 GMT
This is the one I don't understand, what is it, where does this value come
from? And it's always the same exact date/time. ?!?

2- The session files in D:TEMP are not removed. I thought that those files
would be removed after some time (maybe I'm just not patient enough).

Session Interference With Cookies
I have this game, that has worked before, with no changes made, the script decides to time out saying

Quote from: firefoxThis problem can sometimes be caused by disabling or refusing to accept cookies. index.php [this is what holds the game] Code:

Login With Session & Cookies
i have modified my login script slighly, i put a check box saying remember me for:

1 week
2 weeks
Forever

code:

Session Cookies Timing Out (possibly)
I've built a login/access control system for an web app I'm developing, but I'm having a problem with timeouts on sessions.

I'm using a cookie to store a session id (generated when the user authenticates themselves during login) and then validating this against a record held in a database.

If the user is logged in to the system but inactive for a long period of time, when they try to continue there session the system is unable to validate them. This would happen if the session id in the db is different to that in the cookie, or if one or both are blank.

Before I start digging back through my code, I wondered if any one else had experienced this behaviour and if so did you find the cause and is there a solution?

The system uses session (non-dated) cookies, PHP 4.3.1, MySQL 3.23.55. The clients are accessing with IE 6.

Session Cookies In WINNT Folder?
Looked around on the net for an answer to a question and havent found it
yet. Im learning to use sessions for authentication. So far so good.
Learned how to set variables, session cookies, delete, and all that good
stuff. And after many stops and starts it all seems to work.

But while checking out my WINNT folder on another matter I found several
session cookie files (sess_f8fjf838 etc). I assume they are from tests when
I did not log out of the sessions properly, delete the stored information,
or set expiration dates properly. However are these small files supposed to
go into the NT folder? Should/could I change it.. somewhere in the ini file
I guess? I like w2k... the only ms os I do like... but I dont particularly
like having things put into the windows folder if they dont have to be
there. And... where would the cookies go in a UNIX system (which is what
the host uses)?

Session Cookies Expiring Unexpectedly
I've written a fairly straightforward session login system. And it works just great on all the computers I've tested. However, the person who is going to be using the system is experiencing a problem where once in a blue moon, seemingly without pattern or reason, after using the system successfully for awhile the session cookies expire unexpectedly and they consequently get logged out.

The code is dead simple. Stripped down, it essentially works like this.

Here's where the login page creates the auth:

session_start();
$_SESSION['auth']=TRUE;

...and on consequent pages I test for the existence of the token auth.

Apparently there were some old bugs in IE that sometimes resulted in session weirdness, but I have made certain that everyone is using the latest version of ie6. This is doubly frustrating because I have been completely unable to reproduce this bug on my end.

Has anyone ever encountered anything like this before? Can you think of anything in the configuration of a local system that would possibly cause the session cookies to expire without warning?

How To Pass Session Id In URL If And Only If Cookies Are Disabled?
I want to be able to have users use a site with cookies disabled, but it needs sessions. So I have been going over all of the session info in the manual trying to figure out how I add the session ID to the url when cookies are disabled.

<?php
ini_set('session.use_trans_sid', '1');
session_start();
print session_id();?>

It is my understanding that now when I click a link, the session id should be added to the URL. However, that does not happen, and the session_id is changed.
Also, if I refresh the page, a new session starts, with a new ID. None of my session data is being saved. For example if I have this:

<?php
if(isset($_SESSION['test'])){
print $_SESSION['test'];
}else{
$_SESSION['test'] = 'test';}?>

The first time it should show nothing, and the second time (refresh) it should show 'test'. It always shows nothing. how to accomplish this? I don't want to force users to enable cookies, but I don't want the session id in the URL unless it has to be.

Writing Session Variables To Cookies
I've written a logon page that has a remember function. When users log in they are authenticated against the DB, if authenticated the data taken from the query is used to initialize session variables.

There is an if statement at the top of my index.php page that sets cookies should the user wish to be remembered (check box). I use the session variables to write to the cookies which are then used to automatically log in the user next time. All pretty standard stuff.

Trouble is, the cookies are not being written, session variables do not seem to be accessible until after header information is sent. Is this correct? I always thought session data was available all the time at the server. This means that currently I have to refresh the logon page twice before the cookie is written.

Session Cookies Blocked By Latest Updates Of IE
I am using sessions for my applications and it was working perfectly
fine until IE came up with its latest security patch which disables
session cookies by default and increases the security level of the
browser. Since then people are receiving errors.

Track User Usage, Session Tracking Or Cookies?
I want to prevent non-registered users to view a page in my website,
For example, when a non-registered user clicks the history page, the
website site refuses to go there since he is not registered.

what is the best way to do it? And how to identify a user has already
logged in when he click the history page?

Only 20 Cookies? - Please Give Me More Cookies!
I am building a "custom links" feature on a web site. Currently, I am storing the url in a cookie and the name of the web site in another cookie. Having 10 custom links would mean 20 cookies. However, in the specifications of cookies (Netscape), there is a maximum limit of 20 on the number of cookies per domain.

My question is: I know of a site at http://www.hammervald.se/search-this/

which got around the problem by using a BIG cookie with all the information separated by a delimiter such as %. Would would be the code to parse this string in the cookie?

Suppose the contents of my cookie is:
CookieName = "URL1%site1.com%NAME1%site#1%URL2%site2.com%NAME2%site#2%URL3%site3.comNAME3%site#3..."

How would I parse this string to get the following variables?

$URL1 = "site1.com"
$NAME1 = "site#1"... etc

Also, what would be a good delimiter to use? Is % very compatible?

Different Cookies Value
my problem is when i set the cookie in IE and go to Netscape, the cookie that i set didn't exists and vice versa. may i know how to i set the cookie in IE and the cookie that i set can be detected when using Netscape and vice versa?

Using Cookies
I need some help maybe someone can help me. How can I check if some one has disable his cookies in the browser using PHP.

Cookies, Is It Right?
Here is what I use to set cookies:

Cookies
In short: How do cookies work?

In long:
I want to set a cookie as a user logs into the system, i want the cookie(or cookies) to hold his username and password, then i want him to be able to go where ever without having to re-enter his username/password either untill he logs out, or his cookie expires.

PSW (w2k) And Cookies?
Ok, I'm using PWS on my local machine to do development. This is PWS on windoze 2k.

I'm trying to set a cookie, and it works great on my server, but I can not get it to set on my local machine. I've tried putting 127.0.0.1 in the domain area of the cookie, but no luck.

Cookies
i want to make a user friendly site. I am working on a little searchengine. I want to make the site so a user can set up their own look and functions, like how much output after a query or if he wants the news on the index page and so on. I heard its a good thing to use cookies for that. I already studied the cooky func but there are a few things i dont get.

How many variables can I save to a cooky? How do I get the variables out of a cooky?
There is a time field to set up but i want it to be available forever, how can i do that?

Cookies ?
Anyone out there throw some light on why this works locally for testing , but not up on the real server ?

setcookie ("petname", $petname, time()+2592000);

we're on 4.04 locally & server is on 4.06. everything looks setup ok on a call to phpinfo() on the server.

Cookies
I have create an href to an html page where when you click a pop-up window appears.This window is used to login in a mysql database.I use a cookie to hold the login name.When the registration completes the window closes automatically.

Unfortunately after the window is closed the cookie disappears and so i cann't hold the login name in order to use it in other applications.Isn't it possible to hold a cookie after the pop up window is closed?If it is how can i do it?

Getting Cookies And SSL In PHP
I am trying to make a script that will extract info from a
protected
page on ebay, which you can view only by logging in, which requires
SSL 443.

1. get the url
2. get the login screen
3. make the user login to its account using SSL
4. taking cookies of that
5. show the secured page i want, by throwing back the cookies to the server
6. take info from the code
7. process it...

I would like to act as sort of a proxy. how do i do for steps 2 to 5?

Cookies
How do I know whether a clients browser has cookies activated, in both Netscape and IE.

Cookies
i have several login forms on my site that are identical and i want to store the user's username and password on their computer so they don't have to keep typing it in. How would i do this? if i just read the cookie from my script would this just generate the variables from the cookie for my scripts to use?

IE6 And Cookies?
I have used a php application that sets cookies and has worked fine in the past, but when the application is used in an Internet Explorer version 6 the cookies are not being set!

I heard IE6 has implemented a cookie filtering system.
http://www.microsoft.com/PressPass/...cyToolsIEfs.asp

Does anybody know anything about this and what do I have to do to become IE6 complaint?

Cookies
Can some one give me an idea on using cookies with php and mysql to make personalization for all my users. I am a newbie so I need some real life examples.

IE 5 Cookies?
Now that I know IE handles cookies in a somewhat strange way if at all, I need to know how to make IE work with my site URL . What would be involved to check for the browser the user is using and to make a workaround for IE. Maybe this could allow me to offer this solution to Netscapers also so they wouldn't be required to use cookies. The code that you asked for before was for the addpic function which is PHP Code:

Cookies
Can anyone tell me how to use cookies with php or where I can find info on this subject?
I want to store and retrieve the value of a variable. With a search form I want to store a variable, say $x. When I perform later a search query I want to retrieve the variable $x from the cookie. How can I do this?

PHP And Cookies
if you have $_COOKIE['nordicnet_registration'] that is a session cookie in
path '/'
you also have a cookie $_COOKIE['nordicnet_bestilling'] that is a 24-hour
timed cookie in path '/'
what is the behavior of BOTH cookies?

I need to know this because the scope of the "bestilling" cookie is to be a
24-hour timed cookie used in the shopping cart process. However, the scope
of the cookie has been erratic. If I as a user order an item, it adds it to
my cart db, however, the bestilling_id is not the correct value; it turns
out to be the value of the deleted cookie of the prior session!

PS: To give this more scope, I am located on the East Coast of the U.S. and
the server where the scripts are to reside live is in eastern Norway, 6
hours ahead of me.

Cookies
I have some code as follows:

setcookie("TestCode50", $dat, time()+345600)

1. When this is run, what is the name of the cookie that is stored on the surfers hard drive? Is it "TestCode50" or the url of the site concerned?

2. Can I delete this cookie and have a new one set or do I need to close down my PC or browser?

Php Cookies
I am having trouble managing cookies in php, could someone please have a look and sort this out or suggest a better way to do it.

I want to save an ID in the cookie on my site for 30 days. The Id comes in the URL when the user clicks the advert of my site displayed on an affiliate site. The problem is, If the user comes back on the site through a different affiliate and bring a different ID then the previous cookies should be deleted and a new cookie should be placed for 30 days again.

I can set the first cookie but i'm not able to delete it and place a new one. please see the code below....

Cookies
I am going to set a cookies to user browser, what i am going to "input" the value into cookies is something like "option1=yes,option2=yes,option3=no.."and so on.

The questions are, can i set the cookies with a very long "string", let say 20 options. If yes, will it need others function or object to pull the cookies? What function to use, so that i can split the value from the cookies value..

Cookies
i am facing probs with cookies,in the sense it gets set on many machines but misses out on few. The browser remaining the same,what i would like to know is, the problem behind it,can i add something to the code where in it gets set on and any computer.

Cookies
how to retrieve Javascript cookies with php when the javascript cookie was not written in the Root dir? or how to write a javascript cookie with out it putting in the path as .domain.com/directory but like .domain.com?

Cookies
I'm unable to set cookie! I have tried a lot of codes, but it doesn't work! I don't get any error message, but the script doesn't set cookie. Below is my code:

Cookies
I am just trying to learn how to use cookies. I have read a lot of documentation and haven't found the answer to my quesitons. Here is the code on the first page which just passes the "text1" name for use with the cookie on the next page:

<form method=post action=scot.php>
<input type=text size=10 name=text1 class=input><br>
<input type=submit name=submit value=submit class=input>
</form>

code on next page which sets the cookie: PHP Code:

Cookies
I would like to set a cookie and then to read it. Has anybody a example-script that shows how i can do this? I have seen in the Manual that cookies work different on various Browsers/Versions. Have anybody experience with this problem?

Cookies In PHP
I am attempting to get this cookie working for a website I
am running. The code to create the cookie is as follows, when I run it
on my localhost it works perfectly, however when uploaded it does not
work. I confirmed the variables ($username, $password) are fine, but
can't get it to work ! Someone please help me !

<?php
setcookie("sitedata_username", $username, time()+3600, "/",
".example.com", 0);
setcookie("sitedata_password", $password, time()+3600, "/",
".example.com", 0);
?>

PHP & Cookies
How, in PHP, can you detect whether a user is allowed to use cookies?
i.e. whether they've disabled them, they're being blocked by a
firewall etc ....?


Copyright © 2005-08 www.BigResource.com, All rights reserved