Results 1 to 2 of 2
Hybrid View
-
06-01-2005, 01:53 PM #1Newbie
- Join Date
- May 2005
- Location
- Voorhees, NJ
- Posts
- 10
PHP5+Cookie = Pulling My Hair Out
I'm going nuts over this, so I'm hoping you guys can help. I've got a login script (aptly named login.php) that takes two GET parameters ( a username and password hash ).
If everything pans out, the server sets two cookies on the client. I had this working when it was all one huge login script, but now I've broken things down into discrete objects and files, and now the cookies refuse to be sent.
For example, the following code:
PHP Code:$session = new TSession();
setcookie("ISmellSmoke", 1, time()+60*60*24*30, "/", ".mydomain.com", 0);
$login = new TLogin();
setcookie("ISmellFire", 1, time()+60*60*24*30, "/", ".mydomain.com", 0);
$login->Login();
$login = new TLogin();
But that line produces no ouput, and no errors (that I've seen). The class has no constructor, so no other code is run.
Any clue what the problem is?-jw
-
06-01-2005, 02:50 PM #2Newbie
- Join Date
- May 2005
- Location
- Voorhees, NJ
- Posts
- 10
I solved it!
First item:
PHP Code:error_reporting(E_ALL);
Once I did that, I got a very nice warning telling me that the second cookie could not be sent because output had already been sent.
The TLogin class is stored in a file named TLogin, and is required through the PHP5 autoloader.
Each of the included files must start with <? and end with ?>
I had made the mistake of having a single extra linefeed after the ?> which was being sent to the browser as a blank line (or possibly a space).
Go figure. I spent nearly 2 days on this.-jw