Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7415645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:20:31+00:00 2026-05-29T07:20:31+00:00

My header.php looks like this. include(sessions.php); <h1>… My sessions.php page looks like this session_start();

  • 0

My header.php looks like this.

include("sessions.php");
<h1>...

My sessions.php page looks like this

session_start();

function validate_user()
{
    //validate user
}

I have a user_class.php in my body. can i just call validate_user() because i have already included it in the page or do i have to include it in my user_class.php and every .php that uses a session function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:20:32+00:00Added an answer on May 29, 2026 at 7:20 am

    Short answer, yes. What your asking is essentially the whole purpose of includes. Using includes you can divide you code into chunks (files) that represent functional units, such as your session handling. As some of the other posters have suggested, one of your chunks might be your initialization code.

    Imagine includes as simply inlining the file into the point of the include/require statement, replacing it. In this model, as long as the function would appear above the point you are using it, you’re good to go.

    At the end of the day, it’s you preference on how you divide up your code but books like the classic “Design Patterns” from the Gang of Four can help you make good decisions about how to design your code for maximum ease of maintenance and re-use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a page setup like this: PHP Variable Declarations HTML header, then
Usually I have the main page (index.php) that include header/footer/menu and the content of
so I have a simple login page like this: <fieldset> <legend>Verification</legend> <form method=post action=authentication.php>
I'm using require_once() in header.php to include the FirePHP library. In the page.php I'm
its a little bit hard to understand. in the header.php i have this code:
I have created this report using BIRT and phpjavabridge <?php header(Content-type: application/pdf); header(Content-Disposition: inline;
I have header.php and footer.php files which I include in all of my pages.
The site should look like this . But I'm using PHP include (as I
I have bought a Joomla template from Template monster. It looks like this template
I have a website that use this style : /index.php?page=45&info=whatever&anotherparam=2 I plan to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.