Re: Re: HTTP header information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Another little nift thing ive learned to always do regarding headers,
is to always - ALWAYS - after a location have an exit;

Example :

header("location: somewhere.php");
exit;

Ive learned that sometimes someting odd happens to the server and
PHP delivers notices and errors to the browser. Sometimes something
in your code could go wrong leading to a header not working the way
intended. Point is, having the exit atleast stops the user from getting
alot of stuff which he didnt accually want on the screen.

I remember one of my earlier login systems, and if the login wasnt valid
the user was sendt to the login page, pretty old fashioned. Problem was
I didnt have an exit behind, and the webserver got a hickup. There happened
someting wrong with the /tmp folder on the server so PHP issued an error
on all pages that there was errors with the sessions, meaning something was
printed out before my validation of the login, and the user accually got the
content he wasnt allowed to see, :)

This is abit off topic, but you never know. Headers are headers, and
small things are small things...

Good luck.

--
--
Kim Steinhaug
----------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
----------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
----------------------------------------------------------------------

"James Harrell" <jharrell@xxxxxxxxxxxxxxxxx> wrote in message
news:FHELIIHLFCGNIJGPHNNMKEENEFAA.jharrell@xxxxxxxxxxxxxxxxxxxx
> >> Make sure that NO output is done before session_start() is called. Can
> >> you post some of your code?
> >>
>
> >See, that's the case. Because I'm essentially just changing the content
> >within the page, it never leaves the page 'viewer.php' - it just
> >changes the content by tacking on '?type=login, submitproblem, etc'.
>
> Look for an errant space or CR after your original closing PHP tag. Also
> check the file CR/LF/EOF spec is the same as that of your server. For
> example, if your server is unix and your dev machine in Win32, dos2unix
> the file to make certain there are no extra characters after the closing
> php tag.
>
> Any output- even a space or extra CR/LF will cause PHP to send the
headers.
>
> James

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux