Re: Re: PHP, LDAP, Authentication

From: Date: Wed, 16 Apr 2003 12:59:47 +0000
Subject: Re: Re: PHP, LDAP, Authentication
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144109@lists.php.net to get a copy of this message
It sounds like you're outputting something before the redirect. Make sure there isn't *anything* output before the redirect. I've received this type of error by just having blank lines after the closing ?> at the end of a script. > I just discovered, the hard way, exactly what you've described -- the > thinking and the code works beautifully. However, I do have one > resulting problem with giving other pages the ability to check for a > 'authentication' variable AND then redirect with a "header('Location: > > http://www.someplaceelse.com/dir1/nextpage.php?avariable=astatus');" > > I receive the following warning message: > > > Warning: Cannot add header information - headers already sent by > (output started at /export/.../yourfile.php:9) in > /export/.../yourfile.php on line 13 > > > Ultimately, it looks as though it's complaining about having already > received a redirection instruction, even though another page initiated > it. I have several other pages that will have a need to check for > authentication and, initially, I thought I'd try to incorporate this > authentication and redirection stuff into my top nav bar which happens > to be INCLUDED on every page. I changed the code to see to if I could > generate different results. > > Any suggestions would be appreciative. > > > -----Original Message----- > From: Marcus Brock <mbrock@mbrock.com> > To: velikanka@hotmail.com <velikanka@hotmail.com>; > php-general@lists.php.net <php-general@lists.php.net> > Date: Tuesday, April 08, 2003 8:52 AM > Subject: [PHP] Re: PHP, LDAP, Authentication > > >>Here is how I authenticate using PHP and LDAP. So far it has worked >>pretty well.... >> >>Have a form where the user inputs their username/password. >> >>Start a session and set an is_authenticated session variable to >>'false'. >> >>Then Bind to the LDAP server anonymously and do a search for the input >>username. If the username is not found then this is not a valid user >>and you return a bad username error. If the username is found then >>this is a valid user and you can validate the password. >> >>Next bind to the LDAP server using the valid username and the input >>password. If an error is returned then return a bad password error. >>If the password is good then set the is_authenticated session variable >>to 'true' and get any other info you need from the LDAP server and >>store this data in session variables. >> >>Then at the beginning of each page that needs authentication, check the >>is_authenticated session variable for 'true'. >> >>HTH >> >>> >>> >>> -----Original Message----- >>> From: Simon [mailto:velikanka@hotmail.com] >>> Sent: Tuesday, April 08, 2003 8:33 AM >>> To: php-general@lists.php.net >>> Subject: [PHP] Re: PHP, LDAP, Authentication >>> >>> >>> Simon wrote: >>>> Hi, >>>> >>>> I need to authorise users with ldap and php. Does anybody have any >>>> example script how to do it. Sessions will be great. >>>> >>>> TNX >>>> >>> anybody? Is it possible to authenticate userst through php and ldap >>> by using sessions? >>> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#144109) next »