Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: anti-leech

  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts

    anti-leech

    Does way exist of only allowing the link asked by the dedicated server and not for the user? Example: if a user puts in his web browser: http://www.mydomain.com/reg.php the user will be redirected to error page, but if the user gives a click in the link called(the link is on the index page) REGISTER and this one appears to http://www.mydomain.com/reg.php the user has permission.

    Sorry if my english is bad. Regards

  • #2
    New Coder
    Join Date
    May 2006
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can check the referrer using php and match it accordingly. This can be faked though. Also, if you have a form on the reg page (as you would), you can use an if() statement to see if the submit button has been pressed yet. Name the submit button sumbit and:
    PHP Code:
    <?php
    if(!$_POST['submit']) {
    ?>
    form html here
    <?php
    }
    else{
    ?>
    other html here
    <?php
    }
    ?>

  • #3
    Senior Coder
    Join Date
    Feb 2006
    Location
    USA
    Posts
    1,013
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Checking the referrer is a very bad idea. Some firewalls remove it from HTTP Requests and some browsers can be set to not send it in the first place.

    You should use PHP's session functionality to make sure that the person came to reg.php from another page on your site by starting a session on another page and checking for it on the reg.php page.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions
    Java != JavaScript && JScript != JavaScript
    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    PHP can retrieve files from above the root directory or from password protected folders without needing the password. You can use that as a front end to test if the retrieval should be allowed. Other server side languages should offer something similar.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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