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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:25:31+00:00 2026-05-26T03:25:31+00:00

Some applications use this code as FIRST LINE on every page included by the

  • 0

Some applications use this code as FIRST LINE on every page included by the index.php:

if (!defined('SECURE_CONST')) { die("Access denied!"); }

Why do they need to use this? Is it necessary for security? If yes, how can I use it properly?

  • 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-26T03:25:32+00:00Added an answer on May 26, 2026 at 3:25 am

    It’s done to ensure that the files are not executed directly. For example:

    /index.php

    <?php
      define('SECURE_CONST', 1);
      include 'include_me.php';
    ?>
    

    /include_me.php

    <?php
      if (!defined('SECURE_CONST')) { die("Access denied!"); }
    ?>
    

    Then, if http://example.com/index.php is requested SECURE_CONST will be defined and so die() will not be invoked when include_me.php is included. However, if http://example.com/include_me.php is requested directly, SECURE_CONST is never defined and so the script bails.

    If your web server is configured securely–i.e. files not intended to be accessed directly are outside the web root or in a directory made inaccessible by e.g. .htaccess–this should be unnecessary. Developers who use “security” measures like this probably do so because they assume, rightly, that many people using their software will not take the time to understand the security issues and configure their servers properly, and so use methods like this as a failsafe.

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

Sidebar

Related Questions

I have to use an other application (console) to pass some parameter to this
I've recently started upgrading some applications to use Spring Webflow 2, and I want
I've written some applications than heavily use network, and I would like to test
I've seen some iPhone applications that use a custom image as the background for
I currently use my local web server to allow costumers to preview some applications
I have some applications (some native, some .NET) which use manifest files so that
I’d like to use Instruments to peek at some third-party applications on my iPhone,
I frequently use HTML output in applications, up to now I've used some simple
People always advised me that if I am doing some application that should use
I'm using Visual Studio to create my installation package. My application use some bitmap

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.