Jump to content

cURL - Check DB on remote server for authentication? (code included)


blesseld

Recommended Posts

Hey All,

 

I will be marketing a simple php script shortly and would like to Obfuscate my code and have it check to see if the person is running the script on the proper domain, much like other Purchased Scripts, you have to buy licenses and some are limited to a Per Domain basis.

 

Could I use cURL to run a script on another server (mine) that takes the URL it came from, and a variable "the auth key" and check if the person is using the script on the proper domain?  If the domain and auth key don't match in the DB i would return a message saying invalid key or something, else continue to execute the script.

 

<?php
//authkey would be defined in config file
$authkey = "769870afhljkzxf90436";

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,"http://example.com/page.php?authkey=$authkey");
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

if (empty($buffer))
{
    print "Sorry, AuthServ is performing maintenance.....<p>";
}
else
{
    print $buffer;
}
?>

 

 

Is there a smarter way to do this?  I don't have an extra 300 bucks to use something like ioncube,  just looking for a general proper direction on going about this as I am totally clueless.

 

thanks

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.