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!
I have a pageStart function that initializes each page that is displayed, it loads stuff like the header info and preloaded images. I am trying to implement a login and want to use session variables. The entire site has about 30-40 pages so i did not want to add permission checks to each page so i set up the checks in the pageStart function they look like this:
So my question is, what pages do i need session_start() at the top of? All that call the function? or can i just put it on top of the function? or ontop of the common.php file that the function is in?
ok one more question. I will try to explain this the best i can, and will use my customer_edit.php page as an example. My html forms are on the customer_edit page and then the page posts to customer_edit_process.php, the process page handles all the db entries and what not, but the user never sees this page it sends a header and takes the user back to the customer_viewall page. Phoenixheart said, that i will just need to place session_start() at the top of each page that calls the page_start function, but since the customer does not see this page there is no call to page_start so i dont think i will need to include session_start() at the top. But i also read somewhere that you had to have it on all your pages or else the session information will be lost. So my question is will i need to include session_start() on my process pages as well?
acp26b wrote:I have a pageStart function that initializes each page that is displayed, it loads stuff like the header info and preloaded images. I am trying to implement a login and want to use session variables. The entire site has about 30-40 pages so i did not want to add permission checks to each page so i set up the checks in the pageStart function they look like this:
So my question is, what pages do i need session_start() at the top of? All that call the function? or can i just put it on top of the function? or ontop of the common.php file that the function is in?
i think you must have an index.php that handles all the includes so that you don't have to include