i can"t set a cookie? Or is it a Windows problem?

i can"t set a cookie? Or is it a Windows problem?

am 08.11.2007 06:02:23 von Jake Barnes

This site was working:

http://www.thesecondroad.org/

Now I'm told people are unable to create new accounts or log in.

One theory: It seems that cookies are not being set. Our beta testers
missed this bug, because the code was working at some point, and so
cookies got set to the computers of the beta testers. I have no
problem logging in, nor does anyone on my team have any trouble.

Another theory: the above theory can't be right, because if I erase
all my cookies and start over, I still have no trouble going to the
site and logging in. Tonight I'm using FireFox on a Mac, but I've
tested the site on Windows, Linux and Macs, using FireFox, IE 6 and 7,
Safari and Opera. Everything works for me. The people who can't log
seem to all be on Windows machines. Could there be a problem specific
to Windows?

Another theory: there is white space at the top of some pages, which
keeps cookies from being set. I've told the graphic designers that
this is good:


and this is bad:


that first white space, at the top of the page, will kill the
possibility of setting a cookie. However, like I said, it seems
cookies are being set on my machine. And we've looked for white space
at the top of the pages and we have not found any.

Here is the code where I set the cookie:

$machineId = $_COOKIE["machineId"];
if (!$machineId) {
if (!headers_sent()) {
$machineId = md5(uniqid(rand()));
$success = setcookie("machineId", $machineId,
time() + 10000000);
} else {
$controller->error("In logPageVisit() we
wanted to set a machine id but the headers were already sent.");
}
}


Anyone see any problem with that?

As to the folks running Windows, I've asked them to turn off
firewalls, and lower their security settings to the lowest possible
levels. They still can't log in. The problem effects both IE and
FireFox.

Any thoughts about where I should look for trouble?

Re: i can"t set a cookie? Or is it a Windows problem?

am 08.11.2007 08:12:37 von jamesgoode

On Nov 8, 5:02 am, lawrence k wrote:
> This site was working:
>
> http://www.thesecondroad.org/
>
> Now I'm told people are unable to create new accounts or log in.
>
> One theory: It seems that cookies are not being set. Our beta testers
> missed this bug, because the code was working at some point, and so
> cookies got set to the computers of the beta testers. I have no
> problem logging in, nor does anyone on my team have any trouble.
>
> Another theory: the above theory can't be right, because if I erase
> all my cookies and start over, I still have no trouble going to the
> site and logging in. Tonight I'm using FireFox on a Mac, but I've
> tested the site on Windows, Linux and Macs, using FireFox, IE 6 and 7,
> Safari and Opera. Everything works for me. The people who can't log
> seem to all be on Windows machines. Could there be a problem specific
> to Windows?
>
> Another theory: there is white space at the top of some pages, which
> keeps cookies from being set. I've told the graphic designers that
> this is good:
>
> >
> and this is bad:
>
> >
> that first white space, at the top of the page, will kill the
> possibility of setting a cookie. However, like I said, it seems
> cookies are being set on my machine. And we've looked for white space
> at the top of the pages and we have not found any.
>
> Here is the code where I set the cookie:
>
> $machineId = $_COOKIE["machineId"];
> if (!$machineId) {
> if (!headers_sent()) {
> $machineId = md5(uniqid(rand()));
> $success = setcookie("machineId", $machineId,
> time() + 10000000);
> } else {
> $controller->error("In logPageVisit() we
> wanted to set a machine id but the headers were already sent.");
> }
> }
>
> Anyone see any problem with that?
>
> As to the folks running Windows, I've asked them to turn off
> firewalls, and lower their security settings to the lowest possible
> levels. They still can't log in. The problem effects both IE and
> FireFox.
>
> Any thoughts about where I should look for trouble?

Hi Lawrence,

I'd check that the PHP files are all ANSI - there are some problems
with other formats that stop cookies working.

Hope this helps,

--James.

Re: i can"t set a cookie? Or is it a Windows problem?

am 08.11.2007 21:30:19 von Jake Barnes

On Nov 8, 2:12 am, jamesgoode wrote:
> On Nov 8, 5:02 am, lawrence k wrote:
>
>
>
> > This site was working:
>
> >http://www.thesecondroad.org/
>
> > Now I'm told people are unable to create new accounts or log in.
>
> > One theory: It seems that cookies are not being set. Our beta testers
> > missed this bug, because the code was working at some point, and so
> > cookies got set to the computers of the beta testers. I have no
> > problem logging in, nor does anyone on my team have any trouble.
>
> > Another theory: the above theory can't be right, because if I erase
> > all my cookies and start over, I still have no trouble going to the
> > site and logging in. Tonight I'm using FireFox on a Mac, but I've
> > tested the site on Windows, Linux and Macs, using FireFox, IE 6 and 7,
> > Safari and Opera. Everything works for me. The people who can't log
> > seem to all be on Windows machines. Could there be a problem specific
> > to Windows?
>
> > Another theory: there is white space at the top of some pages, which
> > keeps cookies from being set. I've told the graphic designers that
> > this is good:
>
> > >
> > and this is bad:
>
> > >
> > that first white space, at the top of the page, will kill the
> > possibility of setting a cookie. However, like I said, it seems
> > cookies are being set on my machine. And we've looked for white space
> > at the top of the pages and we have not found any.
>
> > Here is the code where I set the cookie:
>
> > $machineId = $_COOKIE["machineId"];
> > if (!$machineId) {
> > if (!headers_sent()) {
> > $machineId = md5(uniqid(rand()));
> > $success = setcookie("machineId", $machineId,
> > time() + 10000000);
> > } else {
> > $controller->error("In logPageVisit() we
> > wanted to set a machine id but the headers were already sent.");
> > }
> > }
>
> > Anyone see any problem with that?
>
> > As to the folks running Windows, I've asked them to turn off
> > firewalls, and lower their security settings to the lowest possible
> > levels. They still can't log in. The problem effects both IE and
> > FireFox.
>
> > Any thoughts about where I should look for trouble?
>
> Hi Lawrence,
>
> I'd check that the PHP files are all ANSI - there are some problems
> with other formats that stop cookies working.


Huh. Wasn't sure what you meant, but found a meaningful comment about
ANSI here:

http://us2.php.net/str_replace

That is good to be aware of. I've saved the files as plain text, on
Windows, Macs and Linux. Probably the last time they were edited I was
working in emacs directly on the server (through ssh). But sometimes
the graphic designers download these files and edit them in
Dreamweaver on their Macs and PCs. How do we ensure that they are
being saved as ANSI?

Re: i can"t set a cookie? Or is it a Windows problem?

am 08.11.2007 21:33:23 von Jake Barnes

On Nov 8, 2:12 am, jamesgoode wrote:
> On Nov 8, 5:02 am, lawrence k wrote:
>
>
>
> > This site was working:
>
> >http://www.thesecondroad.org/
>
> > Now I'm told people are unable to create new accounts or log in.
>
> > One theory: It seems that cookies are not being set. Our beta testers
> > missed this bug, because the code was working at some point, and so
> > cookies got set to the computers of the beta testers. I have no
> > problem logging in, nor does anyone on my team have any trouble.
>
> > Another theory: the above theory can't be right, because if I erase
> > all my cookies and start over, I still have no trouble going to the
> > site and logging in. Tonight I'm using FireFox on a Mac, but I've
> > tested the site on Windows, Linux and Macs, using FireFox, IE 6 and 7,
> > Safari and Opera. Everything works for me. The people who can't log
> > seem to all be on Windows machines. Could there be a problem specific
> > to Windows?
>
> > Another theory: there is white space at the top of some pages, which
> > keeps cookies from being set. I've told the graphic designers that
> > this is good:
>
> > >
> > and this is bad:
>
> > >
> > that first white space, at the top of the page, will kill the
> > possibility of setting a cookie. However, like I said, it seems
> > cookies are being set on my machine. And we've looked for white space
> > at the top of the pages and we have not found any.
>
> > Here is the code where I set the cookie:
>
> > $machineId = $_COOKIE["machineId"];
> > if (!$machineId) {
> > if (!headers_sent()) {
> > $machineId = md5(uniqid(rand()));
> > $success = setcookie("machineId", $machineId,
> > time() + 10000000);
> > } else {
> > $controller->error("In logPageVisit() we
> > wanted to set a machine id but the headers were already sent.");
> > }
> > }
>
> > Anyone see any problem with that?
>
> > As to the folks running Windows, I've asked them to turn off
> > firewalls, and lower their security settings to the lowest possible
> > levels. They still can't log in. The problem effects both IE and
> > FireFox.
>
> > Any thoughts about where I should look for trouble?
>
> Hi Lawrence,
>
> I'd check that the PHP files are all ANSI - there are some problems
> with other formats that stop cookies working.


Actually, the few times I've needed to put in some character encoding,
I've chossen UTF-8. But that should work fine, yes?