Results 1 to 7 of 7

Thread: Random Question / Incoming Pages

  1. #1
    Join Date
    Jan 2009
    Posts
    1
    Thanks
    0
    Thanked 1 Time in 1 Post

    Question Random Question / Incoming Pages

    I know this is pretty ridiculous but I am looking for a script that only allows that page to be viewed from a specific origin page. IE if you want to view example.com/somepage.html you have to come from example.com/thepageyouareallowedtocomefrom.html LOL. I know its crazy and there may be better ways to do what I am thinking of but anything that would get the job done would be great. Basic js or php would work best. Thanks guys!

  2. The Following User Says Thank You to Kevin.N For This Useful Post:

    nighthawks (01-15-2009)

  3. #2
    Join Date
    Nov 2008
    Posts
    19
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Its a good question, its too crazy.
    Webmasters please take it as a challenge.
    Last edited by jscheuer1; 01-16-2009 at 07:08 AM. Reason: remove duplicate content

  4. #3
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    That could be done with .htaccess (possibly) or with cookies (probably), take a look at this article:
    http://www.webmasterworld.com/forum92/1292.htm

    Good luck!

  5. #4
    Join Date
    Jan 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yeah you can do this with php and luckily its pretty basic. What you are asking about is called the Referer URL. In PHP it is accessed like so: "@$HTTP_REFERER"

    here is an example that tests if the user came from 'http://www.example.com/allow.html'

    PHP Code:
    <?php
    $ref
    =@$HTTP_REFERER;
    if(
    $ref == 'http://www.example.com/allow.html')
    {
    echo 
    "<html><head></head><body><p>Hello World!</p></body></html>";
    }
    else
    {
    die 
    "Wrong way";
    }
    ?>
    Thats a simple example. And with alittle more work you could have it doing what you want.

  6. #5
    Join Date
    Apr 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Exactly what i was thinking

    Use >>>>>> $ref=@$HTTP_REFERER;

    Then add a normal if function

    Note that the people may come from

    http://www.example.com/allow.html or http://example.com/allow.html



    So....

    Code:
    <?php
    $ref=@$HTTP_REFERER;
    if($ref == 'http://www.example.com/allow.html' OR $ref == 'http://example.com/allow.html' )
    {
    echo "<html><head></head><body><p>Hello World!</p></body></html>";
    }
    else
    {
    die "Wrong way";
    }
    ?>

  7. #6
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    $ref=@$HTTP_REFERER
    This is depreciated use $ref=$_SERVER['HTTP_REFERER'] instead.
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  8. #7
    Join Date
    Sep 2005
    Posts
    22
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Maybe a differrent approach like using a password lock for the page mentioned.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •