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 9058063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:37:35+00:00 2026-06-16T14:37:35+00:00

i was recently browsing some php source code, particularly ones of forum software like

  • 0

i was recently browsing some php source code, particularly ones of forum software like phpbb and esotalk

I noticed one thing, most of them used a global variable at the start of their page as some sort of security like so:

if (!defined("IN_ESOTALK")) exit; //For esotalk
if (!defined("IN_PHPBB")) exit; //FOR phpbb

What sort of security is this? I don’t understand.
Could you explain to me what this prevents and how?

thanks,
Vidhu

  • 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-16T14:37:37+00:00Added an answer on June 16, 2026 at 2:37 pm

    it works by making sure the php script doesn’t run unless the framework has started up. This way the user can’t execute a script without going through the proper page.

    Here’s an example. We have 2 files:

    index.php

    <?php
         define("_MY_FRAMEWORK", 1);
         echo 'started';
         require('script.php');
    ?>
    

    and script.php

    <?php
        if (!defined("_MY_FRAMEWORK")) exit;
        echo "my script";
    ?>
    

    If you run script.php directly, nothing will happen because _MY_FRAMEWORK has not been defined. it will exit.

    However, if you run index.php, which includes script.php, the script will continue because you did define _MY_FRAMEWORK first. You will get the full output: started followed by my script.

    @Gumbo makes a good point: If you haven’t seen define before, it defines a constant that cannot be changed. The user contributions to the PHP documentation can be helpful to understand how it works.

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

Sidebar

Related Questions

Recently I found some simple source code of a bootloader.The following is the simple
I recently played with a .htaccess file to make one server to parse PHP
I recently discovered the Emacs code browsing package (ECB) and it seems to be
Recently wrote some JavaScript code, but there has been a memory leak in IE7.Are
I recently found some interesting macro while browsing random sources around the internet: #define
I was browsing quite a lot of threads recently and came across this one:
recently I am doing some project on something like a flip card. I have
Recently I found a pretty graph when I was browsing the adminskins at ThemeForest
Recently one of our app servers went down, when it was rebooted the Python
Recently I was able to create a tablet software for my Cerebral Palsy girl

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.