Call Home Function (Like paid scripts have)

Reply

Join Date: Aug 2007
Posts: 72
Reputation: smartness is an unknown quantity at this point 
Solved Threads: 10
smartness's Avatar
smartness smartness is offline Offline
Junior Poster in Training

Call Home Function (Like paid scripts have)

 
0
  #1
Jan 5th, 2009
Hi, I'm maintaining a script, and want to add a CallBack home function, to know which domains are using the script!

Can someone help me on this one!

All i need is the script to show me the domain where the call is comming from!

Thanks in Advance!
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro

Re: Call Home Function (Like paid scripts have)

 
0
  #2
Jan 6th, 2009
Do you mean $_SERVER['HTTP_REFERER'] ? you could get the domain which the user came to this page from from this variable, however this is not perfect, it can be spoofed and hidden quite easily.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 72
Reputation: smartness is an unknown quantity at this point 
Solved Threads: 10
smartness's Avatar
smartness smartness is offline Offline
Junior Poster in Training

Re: Call Home Function (Like paid scripts have)

 
0
  #3
Jan 6th, 2009
I think i was not clear enough!
The Call Back function will be in the Script (Users Website) and when someone visits it, the script "calls" my server, and then a script in my server logs down the domain from which it was called!
Last edited by smartness; Jan 6th, 2009 at 4:16 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 148
Reputation: mschroeder is on a distinguished road 
Solved Threads: 25
mschroeder mschroeder is offline Offline
Junior Poster

Re: Call Home Function (Like paid scripts have)

 
0
  #4
Jan 6th, 2009
unless the files are first encoded, then anyone with an understanding of the language would be able to audit the code and remove the function if they didn't want it occurring, or in some case were using your code without paying for it etc.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 72
Reputation: smartness is an unknown quantity at this point 
Solved Threads: 10
smartness's Avatar
smartness smartness is offline Offline
Junior Poster in Training

Re: Call Home Function (Like paid scripts have)

 
0
  #5
Jan 6th, 2009
Don't worry, I know it has to be coded... i just need the function, then i BASE64 it...

Can someone find me that function or not?
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 148
Reputation: mschroeder is on a distinguished road 
Solved Threads: 25
mschroeder mschroeder is offline Offline
Junior Poster

Re: Call Home Function (Like paid scripts have)

 
0
  #6
Jan 6th, 2009
I wasn't referencing base64 encoding as that can be quickly decoded by anyone familiar enough to pick out what base64 looks like and I don't believe you can base64 encode a chunk of the source code inside a php file without doing something obscure to it like passing it through an eval statement or such.

I was referencing something like Zend Guard or ionCube PHP encoder.

As far as your function:

  1. <?php
  2.  
  3. function call()
  4. {
  5. if( ini_get( 'allow_url_fopen' ) == '1' )
  6. {
  7. $response = file_get_contents( 'http://yourdomain.com/answer.php' );
  8.  
  9. if( $response != 'TRUE' )
  10. {
  11. //Cause some catastrophic death?
  12. exit();
  13. }
  14. }
  15. else
  16. {
  17. //Maybe implement a curl fail over if the curl extension is installed.
  18. //But allow_url_fopen *SHOULD* be enabled by default;
  19. }
  20. }

answer.php
  1. <?php
  2.  
  3. //Something to log $_SERVER variables as necessary.
  4. //maybe referrer or maybe we are validating a key passed as a GET variable?
  5.  
  6. //if we're happy return true
  7. echo 'TRUE';

Now if you were to use curl, you could actually have curl post an almost infinite amount of information to your server and then verify or log it etc.

This is very basic and untested but you should be able to grasp the general concept. If you wanted to get more advanced you could post xml and return xml or JSON etc.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC