2024-04-20 12:37 BST

View Revisions: Issue #483

Summary 0000483: Session cookies not created for local website
Revision 2012-01-17 20:10 by Sourceforge Import placeholder
Description alan@adamshome.org.uk.
I am developing a website with a login script. That script uses
session_register("myusername");
$_SESSION['login_user']=$myusername;

A check later does
$login_session=$row['login_user'];
if (!isset($login_session)) { <report no login> }
This works in IE, Firefox, Safari and Chrome. In Netsurf (2.8 and latest dev build) it works IF I use http://192.168.0.1/nckc/login.php
but fails for http://laptop2/nckc/login.php
There is a cookie created in 192.168.0.1 called PHPSESSID. There is nothing created when connecting to the laptop by name. (I deleted all the cookies first, so I could be sure.)
I noticed a bug reporting this in 2007, closed without any comment I could find, except "expired".
I am new to writing PHP, so the problem could be in my code, which was cribbed in the usual fashion from google.
Alan Adams
Revision 2013-12-18 18:03 by Vincent Sanders
Description alan@adamshome.org.uk.
I am developing a website with a login script. That script uses
session_register("myusername");
$_SESSION['login_user']=$myusername;

A check later does
$login_session=$row['login_user'];
if (!isset($login_session)) { <report no login> }
This works in IE, Firefox, Safari and Chrome. In Netsurf (2.8 and latest dev build) it works IF I use http://192.168.0.1/nckc/login.php
but fails for http://laptop2/nckc/login.php
There is a cookie created in 192.168.0.1 called PHPSESSID. There is nothing created when connecting to the laptop by name. (I deleted all the cookies first, so I could be sure.)
I noticed a bug reporting this in 2007, closed without any comment I could find, except "expired".
I am new to writing PHP, so the problem could be in my code, which was cribbed in the usual fashion from google.
Alan Adams
Revision 2012-01-17 20:10 by Sourceforge Import placeholder
Additional Information nobody added a note on Sun Jan 22 21:18:51 2012

previous comment should have started http://laptop2/nckc i.e. the host name contains no dots. Sorry for any confusion.

nobody added a note on Sun Jan 22 21:16:57 2012

I set up a DNS server, so http://laptop2.nckc/index.php became http://laptop2.adamshome.local/nck/index.php and the problem was no longer seen.

nobody added a note on Thu Jan 19 22:11:57 2012

I am guessing that this occurs when the domain name doesn't contain a dot.

Imported from sourceforge bug http://sourceforge.net/support/tracker.php?aid=3475082 on Tue Dec 10 17:34:12 2013

Revision 2013-12-18 18:03 by Vincent Sanders
Additional Information nobody added a note on Sun Jan 22 21:18:51 2012

previous comment should have started http://laptop2/nckc i.e. the host name contains no dots. Sorry for any confusion.

nobody added a note on Sun Jan 22 21:16:57 2012

I set up a DNS server, so http://laptop2.nckc/index.php became http://laptop2.adamshome.local/nck/index.php and the problem was no longer seen.

nobody added a note on Thu Jan 19 22:11:57 2012

I am guessing that this occurs when the domain name doesn't contain a dot.

Imported from sourceforge bug http://sourceforge.net/support/tracker.php?aid=3475082 on Tue Dec 10 17:34:12 2013