PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Set()
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Set()

Réponse
 
LinkBack Outils de la discussion
Vieux 11/10/2008, 17h45   #1
Ben Stones
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Set()

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.

  Réponse avec citation
Vieux 11/10/2008, 18h02   #2
Per Jessen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Set()

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

  Réponse avec citation
Vieux 11/10/2008, 18h15   #3
Ben Stones
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Set()

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
>
>


  Réponse avec citation
Vieux 11/10/2008, 18h33   #4
Per Jessen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Set()

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

  Réponse avec citation
Vieux 12/10/2008, 16h01   #5
Bastien Koert
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Set()

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

  Réponse avec citation
Vieux 13/10/2008, 00h51   #6
Micah Gersten
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Set()

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
>>
>>
>>

>
>

  Réponse avec citation
Vieux 13/10/2008, 11h46   #7
Stut
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Set()

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
>


  Réponse avec citation
Vieux 13/10/2008, 13h59   #8
Ben Stones
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Set()

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
>>
>>

>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 20h07.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16904 seconds with 16 queries