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

  • Home
  • SEARCH
  • 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 9117921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:00:50+00:00 2026-06-17T05:00:50+00:00

So in file first.php I will include file original.php with include_once . Problem occurs,

  • 0

So in file first.php I will include file original.php with include_once.

Problem occurs, when I try to call functions which are inside original.php and that file is not loading if there is no user session.

Basicaly I’m include file original.php in which are few functions im calling later in first.php, but those functions are inaccesible due to restrictions I’ve set in original.php, but now I want to add rule to original.php to allow such requests from first.php or any other PHP file that will include original.php…

I wonder what could I do in this case OR could I simply add some if clause to original.php, like:

if($fileIncluded == 'yes')
{
   // do not check if user session exist etc.
}
else
{
   // check for user session
}

Thanks for ideas and help in advance!

  • 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-06-17T05:00:51+00:00Added an answer on June 17, 2026 at 5:00 am

    You can set a constant in the file to be included like so:

    In original.php:

    define('ORIGINAL_INCLUDED', TRUE);
    

    Then in first.php you check if the constant exists:

    if (defined('ORIGINAL_INCLUDED'))
    {
        // do not check if user session exist etc.
    }
    else
    {
        // check for user session
    }
    

    Unlike get_included_files() this will work when a script includes a script. get_included_files() will only return the files included in the main script, but not scripts included in child scripts.

    Or in original.php:

    if ('original.php' == basename(__FILE__))
    {
        // original.php directly accessed
    }
    else
    {
        // original.php included instead
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First I have a PHP file that gets data and file from a HTML
I have a php file somejson.php that echos a json encoded array {jsonone:first json,jsontwo:second
Some setup background first: I have a cronjob which runs a PHP file called
This is user.php: include(databse.php);//retrieving successfully first name and lastname from databse file into user.php
whenever we include\require some file using php like require ('links.php'); OR include ('links.php'); which
I have 3 files 1) show_createtable.html 2) do_showfielddef.php 3) do_showtble.php 1) First file is
If I have three files index.php file.php and fns.php First example (it works): index.php
I have a problem here im trying to upload a file first time it
I'm trying to get some data from a PHP file which only gives a
Ok here is my problem. I have a file which outputs an XML based

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.