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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:38:17+00:00 2026-06-17T08:38:17+00:00

Hope someone can shed some light on this. My php script can currently open

  • 0

Hope someone can shed some light on this.

My php script can currently open files above the document root by using relative paths such as require_once(../../passowrds.php);

1)is there anyway to enforce absolute paths open above the document root?

2)what is the safest method of accessing files above the document root?

Thanks 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-17T08:38:17+00:00Added an answer on June 17, 2026 at 8:38 am

    Safest method for require file in write $a = ‘samplevalue’; and top of the which passowrds.php in write;
    if($a != ‘samplevalue’){ header(‘Location: http://www.example.com/‘); }

    passowrds.php :

    if($r_key != 'a23b24c25samplekey' or empty($r_key)){ header('Location: http://www.example.com/'); exit(); } // r_key not equal a23b24c25samplekey or empty forward main page
    bla.. bla.. bla..
    

    sample.php :

      $r_key = 'a23b24c25samplekey';
      require_once(../../passowrds.php);
    

    and that can be used for relative path;

       $path = $_SERVER['DOCUMENT_ROOT'];
       $path .= "/yourfolder/passowrwds.php";
       require_once($path);
    

    require_once(../../passowrds.php); safest than $path = $_SERVER[‘DOCUMENT_ROOT’];
    $path .= “/yourfolder/passowrwds.php”;
    require_once($path);

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

Sidebar

Related Questions

I really hope someone can shed some light on this problem, I have built
I hope someone can shed some light on this. I can't believe I never
Hope someone can shed some light on this... I, and many other developers in
I hope someone out there can shed some light on the topic of creating
he this has been driving me nutts, and I hope someone can shed some
There is something that I can't quite understand hope someone can shed some light..
Good afternoon, hope someone can shed some light on a strange issue that I
Can someone please shed some light into echoing html when it contains php functions?
I have a strange situation which I hope someone can shed some light on.
hope someone can answer this. Here is some sample code. namespace std { #ifdef

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.