Jump to content
Larry Ullman's Book Forums

Simple Query About Includes() Function In Relation To Login Script


Recommended Posts

Hi, this is a general question based on the user registration scripts found in the back of this book.

 

I was trying to create a single page which could call login.php and registration.php via includes() at the beginning of index.php; and then have two areas on a single page where the user could either sign up and be taken to the activation page, or where the user could login and be taken to the backend.

 

Is there a way to do this on a single page without having to cut and paste the entirety of the two scripts (login and registration) into index.php? Is this how includes() can be used?

 

Any advice would be welcome and appreciated.

Link to comment
Share on other sites

Yes, absolutely. In fact, I demonstrate exactly that in my PHP 5 Advanced book, Chapter 2. Just modify the login and registration scripts so they're meant to be included (i.e., they wouldn't include the HTML header and footer, the configuration file, or the database file), then add logic to index.php to decide which file to include and where in the script (so the output works properly).

Link to comment
Share on other sites

 Share

×
×
  • Create New...