Announcement

Announcement Module
Collapse

Forum Rules.

This terms of being safe and users being happy.

There will be rules you must apply too.
1. No fighting this also includes shoutbox ...
2. No Spam links into shoutbox ....
3. Grabbers are banned to be sold but allowed to share.
4. Selling scripts that is posted here is NOT ALLOWED!!
5. Selling service's is allowed etc hosting,domains,scripts install allowed only you and the client know the trust.
6. There will be no swearing at staff or members or anywhere !! !!
7. Coding scripts and php code MUST be coded into or Any one that posted with out block code like rules 7 will auto be deleted to you understand to use them type of bbcodes this will save time for admin's doing it also we are getting sick of seeing a page of 1094+ long with your error code.

If you broken the rules admins will inform your actions.

You will be warn 3 times MAX if you choice to not to listen then you will be BANNED for a week.

Keep it up later you will be Gone for good!

Sign up again this will just slap you ip deny ban ! means your time here is done for good.

Remember keep the forum clean and sweet and nice !!

We all here to help you with your errors and coding but remember we are not slaves!

If you wish to change your USERNAME inbox GUMSLONE.

Update
Any users wanted a freelancer or script builder and willing to pay for it don't pay in front contact one of admins and they will swap the deal of.. Anyone found founding the system will be banned from the site.
Be safe trade with me ( subzero ) if you want to deal a freelancer they will have to go though me.
As to make sure i know ( india ) having problems with paypal but it is better then moneybookers where you can't get a refund from unless the other person sends it back..

All this to keep your time here a enjoyable time and have fun !
See more
See less

how to block direct access to a .php file

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to block direct access to a .php file

    hi friends,
    if i want to block direct access to test.php file what should i do,

    example: if any one type directly this http://mydomain.com/test.php in browser it must redirect to home page

    is there any code for this

  • #2
    its too easy.....jast add this code in your .htaccess file
    ErrorDocument 403 /index.php
    ErrorDocument 404 /index.php
    ErrorDocument 500 /index.php

    Comment


    • #3
      i think u didn't get my point .....i asked to block test.php when it is visitors directly type in browser like http://mydomain.com/test.php if they type this only directly it should redirect to home page ,

      or consider like this i have my.php file and linked test.php in that file ...now test.php must be open if it clicked from my.php .....otherwise it should redirect to home page

      Comment


      • #4
        SetEnvIf REFERER "www.mydomain.com/my.php" linked_from_here
        SetEnvIf REFERER "^$" linked_from_here

        <Files ~ "test.php">
        Order deny,allow
        Deny from all
        Allow from env=linked_from_here
        </Files>


        is this correct

        Comment


        • #5
          I take it the php file is included in another script
          so you would probably add something like:
          PHP Code:
          if($_SERVER['REQUEST_URI']=="/test.php"){
          header("Location: /index.php");
          exit;

          Last edited by something else; 05-07-10, 17:50.

          Comment


          • #6
            what do you mean? can u explain clearly

            Comment


            • #7
              my above code is for a php page if it actually exists but you dont want nobody going on it directly ...only way to get on that page is via another page by using include('test.php'); or some other similar way

              if the page doesnt exist then use sanju`s suggestion in .htaccess
              ErrorDocument 404 /index.php

              Comment


              • #8
                Hmmmmm.....after tried several methods i got solution by using $_SERVER['PHP_SELF']; and $_SERVER['HTTP_REFERER']; ........please close this thread

                Comment

                Working...
                X