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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:12:22+00:00 2026-05-15T18:12:22+00:00

There is this PHP script on my website which I don’t want people to

  • 0

There is this PHP script on my website which I don’t want people to be able to run by just typing its name in the browser.

Ideally I would like this script to be run only by registered users and only from within a Windows app (which I will have to provide). Can this be done ?

Alternatively, how can I protect this script so that it can only be called from a specific page or script?

Also how can I hide the exact URI from appearing on the address bar?

Thanks !

  • 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-15T18:12:22+00:00Added an answer on May 15, 2026 at 6:12 pm

    If you are running Apache for your webserver, you can protect it with a username/password combo using .htaccess. It takes a little configuration if your server is not already configured to allow .htaccess. Here are the Apache docs.

    If you need authentication based on application-specific factors, you can put something at the top of your script like

    <?php
      if(!$user->isLoggedIn()) {
        // do 404
        header('HTTP/1.0 404 Not Found');
      }
    

    Do you have a question about how you would implement isLoggedIn?

    You can also use mod_rewrite to rewrite URIs, and those directives can go inside your .htaccess as well. mod_rewrite can rewrite incoming requests transparently (from the browser’s perspective) so a request for /foo/bar can be translated into secret_script.php/foo/bar. Docs for mod_rewrite.

    However you decide to implement this, I would urge you to not rely solely on the fact that your script’s name is obscure as a means to secure your application. At the very least, use .htaccess with some per-user authentication, and consider having your application authenticate users as well.

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

Sidebar

Related Questions

In there an easy way to do this in PHP. I want to make
PHP, for all its warts, is pretty good on this count. There's no difference
There's this Excel file I want users to be able to download from my
There are lots of PHP articles about the subject so is this a PHP
Is there any advantage to writing a PHP conditional like this: if ($variable !=
I found this: http://www.evolt.org/failover-database-connection-with-php-mysql and similar examples. But is there a better way? I
I'm a rookie designer having a few troubles with this page: http://www.resolvegroup.co.nz/javasurvey.php There are
I got this project, where there this error keeps occurring and its not on
There is this example code, but then it starts talking about millisecond / nanosecond
There's this program, pdftotext, that can convert a pdf file to a text file.

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.