Protection Function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
egturnkey
Forum Commoner
Posts: 34
Joined: Sun Jul 26, 2009 7:35 pm

Protection Function

Post by egturnkey »

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: Select all

 
<?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: Select all

 
$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
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Re: Protection Function

Post by tecktalkcm0391 »

What exactly are you trying to do with the licensing? Are you distrubiting this coding to buyers?
egturnkey
Forum Commoner
Posts: 34
Joined: Sun Jul 26, 2009 7:35 pm

Re: Protection Function

Post by egturnkey »

tecktalkcm0391 wrote:What exactly are you trying to do with the licensing? Are you distrubiting this coding to buyers?

i'm coding an web template as following :-

the customer came to me and ask me for web template XHTML/CSS
but that is not the only thing,after i code it , i convert it to PHP and add an simple admin cp to it so it act as simple CMS which valid for small office or services prodivders websites

did you got my idea of my work ? but not selling proffissional php script , in simple way i do create templates and made it as CMS


and yet i have customers in my countery and hence i need such protection method so that they don't distrubited my work

i know you will be angery of me since i'm in open source forum but i do care about the design itself not the way i code it

hope you got wt i ment ?

thanks in advance
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Re: Protection Function

Post by tecktalkcm0391 »

I want to make sure I am understanding you correctly? You want to design an HTML page, and make it so they cannot make a copy of it, and put it on another website?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Protection Function

Post by jackpf »

What's to stop them from just removing that block of code?
Post Reply