[PHP] cookies problem

2005-09-15 Thread Ross
I am very close to getting this sorted.Thanks for all the help on 
'variable variables' and var_dump. Two useful techniques.

My function works but throws up a cookie problem

if (isset($add)){


${$add} = intval($_COOKIE['cookie'][$add]);
$new= $$add+1;
setcookie(cookie[$add], $new $add);
echo var_dump($_COOKIE['cookie'][$add]);

}

At the beginining of my page I have...

session_start();
require_once('init_cookies.php');

Init_cookies is jus a for loop to initialise the cookies...

$dishes= array (pakora, haggis_fritter);
for ($i=0; $i  2; $i++){
setcookie(cookie[$dishes[$i]], 0 $dishes[$i]);

when I leave it in it resets the cookies when they are sent to the page. 
When I take it out the headers already sent error occurs. I do not know if 
this is my lack of undertanding of require_once/include_once.

I need a way to initialise the cookies one time only. I have tried an 'if 
(isset)' but that doesn't work.


thanks again


Ross 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookies problem

2003-01-23 Thread Sabina A. Schneider
PHP general list
I don't want to take much time, but I'm still having
problems with cookies and I want to know if somebody could help my solve
them. First of all I tried to put the cookie Path to the different pages,
but didin't function. What's more I don't know what to put in
cookieDomain... it should be my server name, no? But doesn't function...
I want to do the following: first the user enters a page and if
he/ she doesn't have a cookie so I can recognize him/ her, I display a form
so the user can complete it with his/ her data. In that page I put the
cookie in his/ her computer, so the other time he/ she comes to the page, I
can recognize him/ her. The problem is that the variable $_COOKIE is not set
in the page after the page that has the setcookie function and niether the
first page of the site where I check if there is the cookie in the client. I
have a directory structure with the pages:

page1/ -- here is the first page, where I check if the client has the
cookie.
page2/ --- here is the page with the form, in case is the first time the
user enter the site.
page3/  --- here is a page where I put the users data in the database and
the cookie in the client.

The question is what sould I put in the $cookiePath variable? which
directory??
Another problem is that when I set the domain to the cookie, in the page
appears a window message that asks me if I accept the cookie or not, because
is from an unknown domain
What sould I put in the cookie expiration time if I want it the last for
ever (until the user delets it...)?

Thanks a lot for the help I've allways recieved from the list and I hope
you can help me a bit,
because it's a complete day I'm with this cookies and I'm going desespperate
without a solution :-( Thank you very much for your time and help once
again.

Sabina Alejandra Schneider.
[EMAIL PROTECTED]







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Cookies problem

2003-01-23 Thread Chris Shiflett
--- Sabina A. Schneider [EMAIL PROTECTED]
wrote:
 I don't want to take much time, but I'm
 still having problems with cookies

Sabina,

First, to answer your question of path, you should start
with / as it is the least restrictive. You can always try
restricting cookies per directory later, but it is best to
just use that until you get things working.

As for date, there is no way to make a cookie last forever.
In fact, I am pretty sure (but don't feel like looking it
up) that there is a maximum lifetime of a cookie in the
specification - two years comes to mind, but it might be
shorter. The only three options you have are:

1. No date - this makes it a session cookies that expires
as soon as the browser session ends (all instances of the
browser terminate).
2. Set a date to the current date or a date in the past -
This effectively deletes a cookie.
3. Set a date in the future - This indicates the lifetime
of the cookie.

As a really simple test, try this:

page1.php:
--
? header(Set-Cookie: foo=bar); ?
a href=page2.php

page2.php:
--
pre
? print_r($_COOKIE); ?
/pre

If you don't see anything on page 2, either your browser
did not supply the cookie, or your version of PHP is too
old to have the $_COOKIE superglobal.

Hope that helps.

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Cookies problem

2003-01-22 Thread Sabina Alejandr Schneider
 Hello people!!! This time I have a problem with cookies. 
I
 tried to send a cookie from one page with the function
 sendcookie(chat,$mail) to a page in another directory,
 but when I tried to prine echo($chat) or
 echo($_COOKIE[chat]) I got notheing. So I put the 
second
 page where it was the page that sent the cookie and 
tried
 again. This last time I got the cookie in the 
echo($chat)
 but not in the echo($_COOKIE[chat]) I need to send a
 cookie to a page in another path and I need that the
 cookie stays in the client browser so I can see if I can
 recognize him/ her next time he/she enters the chat. Was 
I
 clear? Thank you very much for all of your help and
 time!!! I really appreciate your help in times I'm
 desesperated like this time :-)






_

Tutopia - Acceso a Internet rápido, fácil y a los mejores precios.
http://www.tutopia.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Cookies problem

2003-01-22 Thread Sabina Alejandr Schneider
  Hello people!!! This time I have a problem with 
cookies. 
I
  tried to send a cookie from one page with the function
  sendcookie(chat,$mail) to a page in another 
directory,
  but when I tried to prine echo($chat) or
  echo($_COOKIE[chat]) I got notheing. So I put the 
second
  page where it was the page that sent the cookie and 
tried
  again. This last time I got the cookie in the 
echo($chat)
  but not in the echo($_COOKIE[chat]) I need to send a
  cookie to a page in another path and I need that the
  cookie stays in the client browser so I can see if I 
can
  recognize him/ her next time he/she enters the chat. 
Was 
I
  clear? Thank you very much for all of your help and
  time!!! I really appreciate your help in times I'm
  desesperated like this time :-)






_

Tutopia - Acceso a Internet rápido, fácil y a los mejores precios.
http://www.tutopia.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookies problem

2003-01-22 Thread Jason Wong
On Thursday 23 January 2003 00:13, Sabina Alejandr Schneider wrote:

Please do not repeatedly repost the same question. Allow a reasonable period 
of time for people to reply. A reasonable period of time to allow would be 
one day.

Hello people!!! This time I have a problem with
 cookies.
 I
tried to send a cookie from one page with the function
sendcookie(chat,$mail) to a page in another
 directory,

sendcookie() doesn't seem to be a standard php function. Could you tell us 
where you got it from?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Novinson's Revolutionary Discovery:
When comes the revolution, things will be different --
not better, just different.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Cookies problem

2003-01-22 Thread Sabina Alejandr Schneider
Sorry for reposting the mail, I thought nobody had 
recieved it. Sorry. The function is setcookie, not send 
cookie what I meant,it was my typing mistake. Thank you 
for your time and help.

On Thu, 23 Jan 2003 00:23:35 +0800
 Jason Wong [EMAIL PROTECTED] wrote:
On Thursday 23 January 2003 00:13, Sabina Alejandr 
Schneider wrote:

Please do not repeatedly repost the same question. Allow 
a reasonable period 
of time for people to reply. A reasonable period of time 
to allow would be 
one day.

   Hello people!!! This time I have a problem with
cookies.
I
   tried to send a cookie from one page with the 
function
   sendcookie(chat,$mail) to a page in another
directory,

sendcookie() doesn't seem to be a standard php function. 
Could you tell us 
where you got it from?

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications 
Development *

/*
Novinson's Revolutionary Discovery:
	When comes the revolution, things will be different --
	not better, just different.
*/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php








_

Tutopia - Acceso a Internet rápido, fácil y a los mejores precios.
http://www.tutopia.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Please Help: PHP Cookies Problem on localhost

2002-11-05 Thread Mark Brown
Hi there, the php.net site said I should email you with problems.
The basic issue is that I have a user logon screen which works on a remote 
server but not when developing on the same machine that is a local server.
I hold the username and passwords on mysql and ask the user for their 
username and password which gets sent to another .php page which first of 
all sets the following cookies

setcookie(email,$email,time()+1800);
setcookie (password,$password,time()+1800);

Then verifies this against the database and if succesfull redirects to the 
'members area' where the cookies are set again otherwise it redirects to a 
logout page. [Which is where i get sent on the local machine]

I have tried the following formats for the setcookie and all combinations 
including setting the expiry time to 8000.

setcookie(email,$_POST[email],time()+1800);
setcookie (password,$_POST[password],time()+1800);

setcookie(email,$email,time()+1800);
setcookie (password,$password,time()+1800);

The database authentication is being succeful, it is just that the cookies 
are not being set on the local machine, as when I hit the members area I set 
the email value to another variable, set the cooies as before, then alert() 
the old value [before the $email was reset by the new setcookie() command.

I have the following lines set in my php.ini

register_globals = On
variables_order = EGPCS

Do you have any idea why my local machine is not setting the cookies???

Please help


_
Choose an Internet access plan right for you -- try MSN! 
http://resourcecenter.msn.com/access/plans/default.asp


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php