Re: [PHP] Login In script quesitons
On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote: [snip] Take a look at https://code.google.com/p/loginsystem-rd/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login In script quesitons
Richard Quadling rquadl...@gmail.com wrote in message news:aanlktilbmyedd8paky9dwgn0q7t6kem4zzutu_49u...@mail.gmail.com... On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote: [snip] Take a look at https://code.google.com/p/loginsystem-rd/ Richard Thank you for your quick reply and the link. Since I see you are one of the creators, thank you for that as well. I am getting the following error and I'm not sure how to correct it. Warning: Cannot modify header information - headers already sent by (output started at /home/content/45/6359745/html/login/include/loginGlobals.php:281) in /home/content/45/6359745/html/login/include/form_token.php on line 15 Warning: Cannot modify header information - headers already sent by (output started at /home/content/45/6359745/html/login/include/loginGlobals.php:281) in /home/content/45/6359745/html/login/include/form_token.php on line 22 Line 15 is: setcookie(token, , time()-42000); Line 22 is :if (setcookie(token, $_SESSION[token], time()+86400)) { loginGlobals stops at line 278 Again, thank you for all your help. gary __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login In script quesitons
On Fri, 2010-07-09 at 15:43 -0400, Gary wrote: Richard Quadling rquadl...@gmail.com wrote in message news:aanlktilbmyedd8paky9dwgn0q7t6kem4zzutu_49u...@mail.gmail.com... On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote: [snip] Take a look at https://code.google.com/p/loginsystem-rd/ Richard Thank you for your quick reply and the link. Since I see you are one of the creators, thank you for that as well. I am getting the following error and I'm not sure how to correct it. Warning: Cannot modify header information - headers already sent by (output started at /home/content/45/6359745/html/login/include/loginGlobals.php:281) in /home/content/45/6359745/html/login/include/form_token.php on line 15 Warning: Cannot modify header information - headers already sent by (output started at /home/content/45/6359745/html/login/include/loginGlobals.php:281) in /home/content/45/6359745/html/login/include/form_token.php on line 22 Line 15 is: setcookie(token, , time()-42000); Line 22 is :if (setcookie(token, $_SESSION[token], time()+86400)) { loginGlobals stops at line 278 Again, thank you for all your help. gary __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com My guess is that you've put the login PHP code after some HTML in that page? If you output any content at all (even a blank space) it will output the default headers. What you need to do is have any logic that includes a header() call before any output. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Login In script quesitons
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1278705035.2295.2.ca...@localhost... On Fri, 2010-07-09 at 15:43 -0400, Gary wrote: Richard Quadling rquadl...@gmail.com wrote in message news:aanlktilbmyedd8paky9dwgn0q7t6kem4zzutu_49u...@mail.gmail.com... On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote: [snip] Take a look at https://code.google.com/p/loginsystem-rd/ Richard Thank you for your quick reply and the link. Since I see you are one of the creators, thank you for that as well. I am getting the following error and I'm not sure how to correct it. Warning: Cannot modify header information - headers already sent by (output started at /home/content/45/6359745/html/login/include/loginGlobals.php:281) in /home/content/45/6359745/html/login/include/form_token.php on line 15 Warning: Cannot modify header information - headers already sent by (output started at /home/content/45/6359745/html/login/include/loginGlobals.php:281) in /home/content/45/6359745/html/login/include/form_token.php on line 22 Line 15 is: setcookie(token, , time()-42000); Line 22 is :if (setcookie(token, $_SESSION[token], time()+86400)) { loginGlobals stops at line 278 Again, thank you for all your help. gary __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com My guess is that you've put the login PHP code after some HTML in that page? If you output any content at all (even a blank space) it will output the default headers. What you need to do is have any logic that includes a header() call before any output. Thanks, Ash http://www.ashleysheridan.co.uk Ashley I am aware of that would cause a problem. I am not finding any html at all on either page. Thanks for your reply. Gary __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login In script quesitons
On Fri, 2010-07-09 at 15:58 -0400, Gary wrote: Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1278705035.2295.2.ca...@localhost... On Fri, 2010-07-09 at 15:43 -0400, Gary wrote: Richard Quadling rquadl...@gmail.com wrote in message news:aanlktilbmyedd8paky9dwgn0q7t6kem4zzutu_49u...@mail.gmail.com... On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote: [snip] Take a look at https://code.google.com/p/loginsystem-rd/ Richard Thank you for your quick reply and the link. Since I see you are one of the creators, thank you for that as well. I am getting the following error and I'm not sure how to correct it. Warning: Cannot modify header information - headers already sent by (output started at /home/content/45/6359745/html/login/include/loginGlobals.php:281) in /home/content/45/6359745/html/login/include/form_token.php on line 15 Warning: Cannot modify header information - headers already sent by (output started at /home/content/45/6359745/html/login/include/loginGlobals.php:281) in /home/content/45/6359745/html/login/include/form_token.php on line 22 Line 15 is: setcookie(token, , time()-42000); Line 22 is :if (setcookie(token, $_SESSION[token], time()+86400)) { loginGlobals stops at line 278 Again, thank you for all your help. gary __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com My guess is that you've put the login PHP code after some HTML in that page? If you output any content at all (even a blank space) it will output the default headers. What you need to do is have any logic that includes a header() call before any output. Thanks, Ash http://www.ashleysheridan.co.uk Ashley I am aware of that would cause a problem. I am not finding any html at all on either page. Thanks for your reply. Gary __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com What does your code look like now? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Login In script quesitons
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1278705549.2295.4.ca...@localhost... On Fri, 2010-07-09 at 15:58 -0400, Gary wrote: Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1278705035.2295.2.ca...@localhost... On Fri, 2010-07-09 at 15:43 -0400, Gary wrote: Richard Quadling rquadl...@gmail.com wrote in message news:aanlktilbmyedd8paky9dwgn0q7t6kem4zzutu_49u...@mail.gmail.com... On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote: [snip] Take a look at https://code.google.com/p/loginsystem-rd/ Richard Thank you for your quick reply and the link. Since I see you are one of the creators, thank you for that as well. I am getting the following error and I'm not sure how to correct it. Warning: Cannot modify header information - headers already sent by (output started at /home/content/45/6359745/html/login/include/loginGlobals.php:281) in /home/content/45/6359745/html/login/include/form_token.php on line 15 Warning: Cannot modify header information - headers already sent by (output started at /home/content/45/6359745/html/login/include/loginGlobals.php:281) in /home/content/45/6359745/html/login/include/form_token.php on line 22 Line 15 is: setcookie(token, , time()-42000); Line 22 is :if (setcookie(token, $_SESSION[token], time()+86400)) { loginGlobals stops at line 278 Again, thank you for all your help. gary __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com My guess is that you've put the login PHP code after some HTML in that page? If you output any content at all (even a blank space) it will output the default headers. What you need to do is have any logic that includes a header() call before any output. Thanks, Ash http://www.ashleysheridan.co.uk Ashley I am aware of that would cause a problem. I am not finding any html at all on either page. Thanks for your reply. Gary __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com What does your code look like now? Thanks, Ash http://www.ashleysheridan.co.uk Ashley This is form_token.php ?php if (!isset($_SESSION)) { session_start(); } ? ?php function generateToken(){ /* * Create and set a new token for CSRF protection * on initial entry or after form errors and we are going to redisplay theform. **/ $salt=; $tokenStr=; $salt = sha1($_SERVER[HTTP_HOST]); setcookie(token, , time()-42000); $_SESSION[salt]=$salt; $_SESSION[guid] = getGUID(); $_SESSION[ip] = $_SERVER[REMOTE_ADDR]; $_SESSION[time] = time(); $tokenStr = IP: . $_SESSION[ip] . ,SESSIONID: . session_id() .,GUID: . $_SESSION[guid]; $_SESSION[token]=sha1(($tokenStr.$_SESSION[salt]).$_SESSION[salt]); if (setcookie(token, $_SESSION[token], time()+86400)) { $_SESSION[usecookie]=True; }}function checkToken() { /* * Check the posted token for correctness **/ $oldToken=; $testToken=; $tokenStr=; $page=basename($_SERVER['PHP_SELF']); $oldToken=$_POST[token]; $tokenStr = IP: . $_SESSION[ip] . ,SESSIONID: . session_id() .,GUID: . $_SESSION[guid]; $testToken=sha1(($tokenStr.$_SESSION[salt]).$_SESSION[salt]); $checkToken=False; If ($oldToken===$testToken) { $diff = time() - $_SESSION[time]; If ($diff=300) { // Five minutes max If ($_SESSION[usecookie]) { If ($_COOKIE[token]===$oldToken) { /* * Destroy the old form token, then * generate a new token for the form, which may or may not be needed. Wewant to do this * before headers are written. When writeToken() or writeTokenH() iscalled we are only * writing the pre-generated token to the form. The cookie will havealready been written. **/ setcookie(token, '', time()-42000); generateToken(); return true;}else{ $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000); } session_destroy(); header(Location: http://;. lg_domain . lg_form_error .?p= . $page .t=ec);} }else{ return True; }}else{ $_SESSION = array(); if (isset($_COOKIE[session_name()])) {
Re: [PHP] Login In script quesitons
On Fri, 2010-07-09 at 16:04 -0400, Gary wrote: ? ?php That bit of the code has a newline in it, which counts as output :p I've not looked over the rest yet, but see if that helps. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Login In script quesitons
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1278706121.2295.5.ca...@localhost... On Fri, 2010-07-09 at 16:04 -0400, Gary wrote: ? ?php That bit of the code has a newline in it, which counts as output :p I've not looked over the rest yet, but see if that helps. Thanks, Ash http://www.ashleysheridan.co.uk Ashley Actually I had added that closing and opening tag in trying to solve the problem, I put it back and still have the issue. I looked at the code as it looks on the board, would it be easier if I sent you the files? Thanks again. Gary __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login In script quesitons
Ashley Richard I think I found the issue. In loginGlobals.php, the error was pointing to line 281, when the code stopped and 278. (I know most of the time this just means there is a missing bracket or semi-colon in the code), however, what I did is put my curser on link 281, backspaced to eliminate white space, and it seems to be working. I will let you know if this is just premature exhuberation. Thanks again for all your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1278706121.2295.5.ca...@localhost... On Fri, 2010-07-09 at 16:04 -0400, Gary wrote: ? ?php That bit of the code has a newline in it, which counts as output :p I've not looked over the rest yet, but see if that helps. Thanks, Ash http://www.ashleysheridan.co.uk __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com __ Information from ESET Smart Security, version of virus signature database 5266 (20100709) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php