Advanced Search

Results 1 to 2 of 2

Thread: Protection Function

  1. #1
    Join Date
    Apr 2009
    Posts
    45
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Default Protection Function

    Hello Dear Friends,


    Consider we have an php file called

    index.php

    how can i add a code to (index.php) so that when it excute (run) on any website for example (anysite.com)

    it call an text file (license.txt) which is on my server and also in same time it record the URL of the (index.php) in another text file (record.txt)


    WHAT FOR


    it someone open ( index.php) it will record in a text file on my server the URL
    if it was licensed then it will be okay and if not
    then i remove the ( license.txt) and then index.php won't work


    I've made the following code but it give some problems


    on my server both
    track.php and empty counter.txt

    Code:
    <?php
    $url = @$_GET['url'];
    $path = @$_GET['path'];
    $entry_line = "$url | $path
    "; //give ENTER to break into new line in text file
    $fp = fopen("counter.txt","a");
    fputs($fp,$entry_line);
    fclose($fp);
    ?>
    and the tacking code inside index.php
    Code:
    $f = @fopen("xxxxxxxxxxxxxxxxxxx/track.php?url=$_SERVER[HTTP_HOST]&path=$_SERVER[SCRIPT_FILENAME]","r");
    @fread($f,10);
    @fclose($f);
    where xxxxxxxxxxxxxx is my website which i do stored the text file


    PROBLEMS

    1- It makes the website running so slow
    2- it keeps store the URL everytime it open i mean has no overwrite option if same URL

    My needs

    any simple idea that makes me able to do the following

    - know what url using the script ( index.php )
    - if i changed license.txt , it won't load ( index.php ) or give warrning MSG not licensed please buy license


    thanks in advance

    it really will helps me a lot

  2. #2
    Join Date
    Aug 2009
    Location
    Orlando Florida USA
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Maybe try some of the built in PHP $SERVER functions such as $_SERVER['PATH_INFO']). It might be faster

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
  •