+ Reply to Thread
Results 1 to 6 of 6

Thread: restrict access to a page unless from...

  1. #1
    1erik1 is offline x10Hosting Member 1erik1 is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    49

    Question restrict access to a page unless from...

    hey can anyone teach me how to restrict access to a webpage, let's say domain.com/home.html, unless you are coming from domain.com/index.html

    whatever is the best way to do it I think i read somewhere about headers? but I am completely lost.

    unfortunately I have no points to dish out since I spent them all on a raffle I lost :P

  2. #2
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: restrict access to a page unless from...

    http://www.electrictoolbox.com/php-h...erer-variable/

    I think this is what you are trying to do.
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  3. #3
    1erik1 is offline x10Hosting Member 1erik1 is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    49

    Re: restrict access to a page unless from...

    ehh not really.. anyone else?

  4. #4
    gomarc's Avatar
    gomarc is offline x10 Elder gomarc is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    USA
    Posts
    511

    Re: restrict access to a page unless from...

    They are many ways to restrict access to your web pages or to protect just part of your site.

    This may be what you are looking for:
    How can I use a .htaccess file to restrict access by the user's location?

    Just be careful when using the .htaccess file.

  5. #5
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: restrict access to a page unless from...

    Quote Originally Posted by 1erik1 View Post
    hey can anyone teach me how to restrict access to a webpage, let's say domain.com/home.html, unless you are coming from domain.com/index.html

    whatever is the best way to do it I think i read somewhere about headers? but I am completely lost.
    garrettroyce's answer best matches what you asked (the Referer header tells you what page a visitor is coming from), but it may not be what you need. Very important question to answer: why do you want to restrict access based on where a visitor is coming from? It's best to always post the overall goal in addition to a problematic step as there may be a better way of achieving the goal.

  6. #6
    primefalcon is offline x10Hosting Member primefalcon is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    15

    Re: restrict access to a page unless from...

    pretty easy thing to do

    PHP Code:
    <?php
    $urlToCheck 
    $_SERVER['HTTP_REFERER'];

    if(
    $urlToCheck != "http://onlyletthisurlthrough.com/index.php")
    { exit(
    "you are not aloud to be here"); }
    else { 
    /* do nothing, they're aloud */ }
    ?>
    Last edited by primefalcon; 04-03-2009 at 09:22 PM.

+ Reply to Thread

Similar Threads

  1. 404 Can't access any page
    By totakeke in forum Free Hosting
    Replies: 2
    Last Post: 08-12-2008, 06:29 PM
  2. Not able to access my CPanel login page.
    By Stricken82 in forum Free Hosting
    Replies: 0
    Last Post: 07-22-2008, 02:16 PM
  3. Wont let me access my web page
    By xxcthomasxx in forum Free Hosting
    Replies: 1
    Last Post: 01-12-2008, 03:04 PM
  4. Root and Shell Access
    By Wai_Wai in forum Free Hosting
    Replies: 5
    Last Post: 09-09-2005, 01:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers