View Single Post
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