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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:37:59+00:00 2026-05-22T02:37:59+00:00

php : view.php <h1>hello world</h1> php: index.php require(‘view.php’); if both files are on root

  • 0

php : view.php

<h1>hello world</h1>

php: index.php

require('view.php');

if both files are on root mysite.com

if I access mysite.com/index.php I should get ‘hello world‘

if I access mysite.com/view.php I should get Nothing displayed.

I was looking for some .HTACCESS method but any other suggestions are welcomed 🙂

Conclusion: wish the user to not be able to see the view plain text, and only allow the required or get_file_contents() to read the files. So read the file only within server.

  • 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-22T02:38:00+00:00Added an answer on May 22, 2026 at 2:38 am

    The best way to handle this is to have your include files that are never intended to be accessed outside the web root, where they can never be accessed via a browser.

    i.e. your file structure would be:

    www/index.php
    includes/view.php
    

    You can set PHP’s include_path to include the includes/ directory so your includes don’t need to have a path explicitly in them, too.

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

Sidebar

Related Questions

I have quite a lot of PHP view files, which I used to include
PHP, as we all know is very loosely typed. The language does not require
I am newbie to Kohana (v3 used). When I run the Hello World example.
In PHP, CGI, or in RoR's View, we can easily print out debug information.
Hello I have the following proble: I have the action class of a view
Contoller iscalled MaintainusersController.php View is called maintainusers/listusers.phtml How do I push values from controller
Class_view.php contains the class definition as an associative array: class View { private $viewArray
hello i got the same problem as php :: new line in textarea? or
The simplest script: <?php echo 'hello'; Takes about 3 seconds to execute. There seems
Suppose I have a page called view.php, if I give an argument like view.php?q=fruit,

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.