|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I'm using for my website script and upon users logging in a is set. Problem for me is that the doesn't work due to headers already sent. Is there anyway of fixing this because, there is no possible way of adding set() to the top of the PHP file when the is holding the username from the POSTed form. Any appreciated. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Ben Stones wrote:
> I'm using for my website script and upon users logging in a > is set. Problem for me is that the doesn't work due to > headers already sent. Is there anyway of fixing this because, there is > no possible way of adding set() to the top of the PHP file when > the is holding the username from the POSTed form. This must be a self imposed restriction on your side, coz' otherwise I see no problem. /Per Jessen, Zürich |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
What I mean is I cannot use set, I need to check if user credentials
are correct first (which is BEFORE set) and if so, set a . I can't do that unless set is first, but I need to check if the user credentials is correct. Furthermore I cannot use set in the header as I want to display a message saying that they have successfully logged in in the correct area of my template. 2008/10/11 Per Jessen <per@computer.org> > Ben Stones wrote: > > > I'm using for my website script and upon users logging in a > > is set. Problem for me is that the doesn't work due to > > headers already sent. Is there anyway of fixing this because, there is > > no possible way of adding set() to the top of the PHP file when > > the is holding the username from the POSTed form. > > This must be a self imposed restriction on your side, coz' otherwise I > see no problem. > > > /Per Jessen, Zürich > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Ben Stones wrote:
> What I mean is I cannot use set, I need to check if user > credentials are correct first (which is BEFORE set) and if so, > set a . I can't do that unless set is first, but I need to > check if the user credentials is correct. Furthermore I cannot use > set in the header as I want to display a message saying that > they have successfully logged in in the correct area of my template. Well, I'm doing exactly that and it works just fine. This is a rough outline of the flow: GET <login page> (form with user and password fields) POST <login page> validate user+password, save in session set(). redirect with 303 to <welcome page> GET <welcome page> /Per Jessen, Zürich |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Sat, Oct 11, 2008 at 12:33 PM, Per Jessen <per@computer.org> wrote:
> Ben Stones wrote: > > > What I mean is I cannot use set, I need to check if user > > credentials are correct first (which is BEFORE set) and if so, > > set a . I can't do that unless set is first, but I need to > > check if the user credentials is correct. Furthermore I cannot use > > set in the header as I want to display a message saying that > > they have successfully logged in in the correct area of my template. > > Well, I'm doing exactly that and it works just fine. This is a rough > outline of the flow: > > GET <login page> (form with user and password fields) > POST <login page> > > validate user+password, save in session > set(). > redirect with 303 to <welcome page> > > GET <welcome page> > > > /Per Jessen, Zürich > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Its likely just a little html or a blank line that is setting the headers before you are attempting to set the -- Bastien Cat, the other other white meat |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
The question is, why aren't you using a session variable instead of
? That's one of the greatest features of PHP. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ben Stones wrote: > What I mean is I cannot use set, I need to check if user credentials > are correct first (which is BEFORE set) and if so, set a . I > can't do that unless set is first, but I need to check if the user > credentials is correct. Furthermore I cannot use set in the header as > I want to display a message saying that they have successfully logged in in > the correct area of my template. > > 2008/10/11 Per Jessen <per@computer.org> > > >> Ben Stones wrote: >> >> >>> I'm using for my website script and upon users logging in a >>> is set. Problem for me is that the doesn't work due to >>> headers already sent. Is there anyway of fixing this because, there is >>> no possible way of adding set() to the top of the PHP file when >>> the is holding the username from the POSTed form. >>> >> This must be a self imposed restriction on your side, coz' otherwise I >> see no problem. >> >> >> /Per Jessen, Zürich >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> > > |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On 12 Oct 2008, at 23:51, Micah Gersten wrote:
> The question is, why aren't you using a session variable instead of > ? That's one of the greatest features of PHP. If you're able to use instead of sessions, and the size of the data you're storing is fairly small, it's always better to use . Sessions complicate scalability. Ben: The *only* restriction around use of set is that there cannot be any *output* before it. You can have as much code as you want as long as it doesn't output anything. If your script outputs content before your business logic is done then (IMHO) it's wrong and needs to be rewritten anyway, regardless of the need to set a . -Stut -- http://stut.net/ > Ben Stones wrote: >> What I mean is I cannot use set, I need to check if user >> credentials >> are correct first (which is BEFORE set) and if so, set a >> . I >> can't do that unless set is first, but I need to check if the >> user >> credentials is correct. Furthermore I cannot use set in the >> header as >> I want to display a message saying that they have successfully >> logged in in >> the correct area of my template. >> >> 2008/10/11 Per Jessen <per@computer.org> >> >> >>> Ben Stones wrote: >>> >>> >>>> I'm using for my website script and upon users logging in a >>>> is set. Problem for me is that the doesn't work due >>>> to >>>> headers already sent. Is there anyway of fixing this because, >>>> there is >>>> no possible way of adding set() to the top of the PHP file >>>> when >>>> the is holding the username from the POSTed form. >>>> >>> This must be a self imposed restriction on your side, coz' >>> otherwise I >>> see no problem. >>> >>> >>> /Per Jessen, Zürich >>> >>> >>> -- >>> 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 > |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
Hi,
My problem was a headers already sent error, which I fixed by redirecting the form POST to a seperate file instead of the same login.php. Thanks for all your ! 2008/10/13 Stut <stuttle@gmail.com> > On 12 Oct 2008, at 23:51, Micah Gersten wrote: > >> The question is, why aren't you using a session variable instead of >> ? That's one of the greatest features of PHP. >> > > If you're able to use instead of sessions, and the size of the data > you're storing is fairly small, it's always better to use . Sessions > complicate scalability. > > Ben: The *only* restriction around use of set is that there cannot be > any *output* before it. You can have as much code as you want as long as it > doesn't output anything. If your script outputs content before your business > logic is done then (IMHO) it's wrong and needs to be rewritten anyway, > regardless of the need to set a . > > -Stut > > -- > http://stut.net/ > > Ben Stones wrote: >> >>> What I mean is I cannot use set, I need to check if user >>> credentials >>> are correct first (which is BEFORE set) and if so, set a . I >>> can't do that unless set is first, but I need to check if the user >>> credentials is correct. Furthermore I cannot use set in the header >>> as >>> I want to display a message saying that they have successfully logged in >>> in >>> the correct area of my template. >>> >>> 2008/10/11 Per Jessen <per@computer.org> >>> >>> >>> Ben Stones wrote: >>>> >>>> >>>> I'm using for my website script and upon users logging in a >>>>> is set. Problem for me is that the doesn't work due to >>>>> headers already sent. Is there anyway of fixing this because, there is >>>>> no possible way of adding set() to the top of the PHP file when >>>>> the is holding the username from the POSTed form. >>>>> >>>>> This must be a self imposed restriction on your side, coz' otherwiseI >>>> see no problem. >>>> >>>> >>>> /Per Jessen, Zürich >>>> >>>> >>>> -- >>>> 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 >> >> > |
|
![]() |
| Outils de la discussion | |
|
|