PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
What I want to do is when the user logs in for the first time they are redirected to their personal details page else they remain on the page they have logged in.
I have tried user the header('Location') but where the login box are on the pages it is saying the headers have already been sent.
The general idea is to always do all logic processing before any output is sent so you can perform redirections and other dealings without being in the midst of output. This also lends itself to the concept many of us preach: separation of application logic from display logic.
thats great thanks, I have seperated the login script from the login display.
What I would like to know is there a way of adding my login function $login = login($username, $password); to each page automatically, rather than going through each page and adding it manually?
That's what FrontControllers, ApplicationControllers and PageControllers can do. Otherwise, you'll need to manually add it in some fashion. It may be as simple as including the right file and running a function at the proper time, it's hard to say without knowing your code more.
the function just needs to run at the start of every page returning a variable $login which displays the appropriate login display. Could this be achieved by including a file that runs this function on the page?