i want the best php way to know if some one used my script of his server
If you mean he took the code and put it in his code on his server, then you can't.
If you mean him 'hot linking' to a script on your server, then put some code to generate a js popup or something like that
Place some code in your script that sends you an email with the name of the root address.. not sure how ethical that is.
You have 2 choices (that I can think of):
- Make your script "hot linking" something on your server.
- Use CURL (or something similar) in your script to send something to your server (of course the end user can always remove these calls from your script).
Bottom line, this is quite unusual and unreliable (and can even break privacy policies), you should avoid this.
The best way? Include a request in the header comment of the script saying to the effect of "if you use this script, please drop me a line at [email protected]".
Placing any hotlinks, pop-ups or any other kind of nonsense not only discourages people from using your script, but could actually impose a performance penalty and can be easily disabled.
If you don't want people to use your script, don't place it anywhere where the public can get to the source. If you want people to use it, don't obsess over usage....if it becomes popular you definitely will hear from users (who will be asking for enhancements and/or bug fixes).