Results 1 to 5 of 5

Thread: Setting up hotlink protection without .htaccess

  1. #1
    Join Date
    Aug 2006
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Setting up hotlink protection without .htaccess

    I have this code::

    PHP Code:
     /*
    PHProxy bandwidth MOD 1.1 by Rhett Canney (Billy Connite)
    This MOD will stop any hotlinking via PHProxy, even if the
    clients referer is not set!
    Check out proxywebsite.org if you want to try hotlinking.
    */

    // allow hotlinking from these sites, seperate by comma (make sure you eneter your site's domains)
    $domains="www.yourdomain.com,yourdomain.com";

    // convert domains into an array
    $domains=explode(",",$domains);

      
    // if there is a request:
      
    if($_GET['q']!="")
      {
      
    // get referer
      
    $referer=explode("/",($_SERVER['HTTP_REFERER']));
        
    // if the referer is not allowed:
        
    if(!in_array($referer[2],$domains))
        {
        
    // redirect to homepage and finish script
        
    header("Location: http://".$domains[0]."/");

        exit();
        }
      }

    /*
    END MOD
    */ 
    Can this script work on any web page?

    I know people wont go breaking their back to help me, but if someone has time, and can help me, please PM me.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    uh.... why.
    People can't link to you then.

    You might be able to use it on images, but that would be weird, and a lot of work.

    Just use .htaccess
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    For password protected pages, you can only access when your on the site
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Unless once the page is entered it saves a value to a flat-file, and redirects to another page if that value is whatever, the login page would load.
    - Mike

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    This is stupid for password protection.

    You could hack this without too much trouble.

    so... you need real password protection, so why bother with this as well. And if a browser messes up with the transfer of the referer, which I believe can happen, then you're stuck.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •