943,887 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1189
  • PHP RSS
Jan 5th, 2009
0

Call Home Function (Like paid scripts have)

Expand Post »
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!
Reputation Points: 7
Solved Threads: 14
Junior Poster
smartness is offline Offline
103 posts
since Aug 2007
Jan 6th, 2009
0

Re: Call Home Function (Like paid scripts have)

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.
Reputation Points: 96
Solved Threads: 124
Master Poster
Will Gresham is offline Offline
728 posts
since May 2008
Jan 6th, 2009
0

Re: Call Home Function (Like paid scripts have)

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.
Reputation Points: 7
Solved Threads: 14
Junior Poster
smartness is offline Offline
103 posts
since Aug 2007
Jan 6th, 2009
0

Re: Call Home Function (Like paid scripts have)

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.
Sponsor
Reputation Points: 265
Solved Threads: 126
Practically a Master Poster
mschroeder is offline Offline
624 posts
since Jul 2008
Jan 6th, 2009
0

Re: Call Home Function (Like paid scripts have)

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?
Reputation Points: 7
Solved Threads: 14
Junior Poster
smartness is offline Offline
103 posts
since Aug 2007
Jan 6th, 2009
0

Re: Call Home Function (Like paid scripts have)

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:

php Syntax (Toggle Plain Text)
  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
php Syntax (Toggle Plain Text)
  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.
Sponsor
Reputation Points: 265
Solved Threads: 126
Practically a Master Poster
mschroeder is offline Offline
624 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Server Address vs DNS
Next Thread in PHP Forum Timeline: Which is better for storing user data?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC