Jump to content

Finding Out Where My Script Is Being Run From.


nook6

Recommended Posts

Hi

 

im fairly new here so i would like to say hello to everyone.

 

Now my Question:

 

Im making a few php scripts and im wondering what if anything i can do to find out what url my scripts are running on.

maybe some little bit of code in the script somewhere that takes the url and sends it to a script on my website or something?

 

Any help will be greatly appreciated

 

Thank you

 

Nook

<?php echo __FILE__; ?>

 

Hi thanks for the reply not sure if you understood the question i am trying to send the url of a php script that is hosted on lets say server1 and send it to a script on server2 (if this is possible)

 

I have the url i just need to find a way of sending it from server 1 to server 2 without any user participation or without the user knowing it has been sent.

 

Nook6

Or, the slightly more readable version. :P

echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']

 

Do take into consideration potential XSS injections and other security risks when doing this, as this will send whatever the user wrote in the address-field unmodified!

Hi

 

Well i was thinking more of using the url that the end buyer would setup in the config settings for the script to use, then all i need to work out is how to get the script on the end users server to send this url to my server in the background, I could setup a switch somewhere so it only sends the url to me once. so i dont get loads of loads of hits everytime someone goes on one of thier sites.

 

Im getting the feeling this isnt really doable lmao

 

thank you

 

nook6

i thought i had explained lol.

 

ok let me try again,

lets say someone buys a php script from me to use on www.doable.com, then he decides to give a copy of my script to his friend. now his friend will have a free copy of a script that im selling. so im looking for a way of the script letting me know where its running from so i can see if they have paid or not for that script.

 

have i explained it a little better this time??

 

nook

so im looking for a way of the script letting me know where its running from so i can see if they have paid or not for that script.

 

Just make a HTTP request to your site to log the URL/IP of the host.  $_SERVER['HTTP_HOST'] will contain the domain name of the server.  You can use gethostbyname to get the IP if you want.

 

You can do a simple request using file_get_contents or curl to your server to log the information.

 

Keep in mind that anyone with even just a bit of knowledge of PHP could just comment out that phone-home portion of the script (or modify it to always return a valid domain).

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.