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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.