Pagina clientului.
Cod: Selectaţi tot
<?php
$pass_array['key'] = "1123-456";
$pass_array['domain'] = $_SERVER['SERVER_NAME'];
$pass_array['website_ip'] = $_SERVER['SERVER_ADDR'];
function confirm_license($url, $data)
{
$options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => false, CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 50, CURLOPT_TIMEOUT => 50, CURLOPT_MAXREDIRS => 0,
CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $data, CURLOPT_SSL_VERIFYHOST => 0, );
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
$license = confirm_license("http://localhost/license/server/", $pass_array);
if ( $license['status'] != "1" )
{
die($license['message']);
}
else
{
echo "Active";
}
?>
Cod: Selectaţi tot
<?php
if( !mysql_connect("localhost", "root", "root") ){
echo "Error: Connection To The MySQL Server Failed.";
}
if( !mysql_select_db("cs_system") ){
echo "Error: Unable To Select Database.";
}
$required_keys = array("key", "domain", "website_ip");
foreach ( $required_keys as $req_key )
{
if ( array_key_exists($req_key, $_POST) )
{
$sanitised[$req_key] = stripslashes(strip_tags($_POST[$req_key]));
}
else
{
echo "Error: " . $req_key . " missing from passed variables.";
break 1;
}
}
$ret_db = mysql_query("SELECT * FROM `license` WHERE `key` = '" .
mysql_real_escape_string($sanitised['key']) . "' && `domain` = '" .
mysql_real_escape_string($sanitised['domain']) . "' && `website_ip` = '" .
mysql_real_escape_string($sanitised['website_ip']) . "' ORDER BY `id` DESC LIMIT 0,1");
if ( mysql_num_rows($ret_db) == "0" )
{
echo "Invalid Details.";
}
else
{
$retdb = mysql_fetch_array($ret_db);
if ( $retdb['status'] == "active" )
{
echo "1";
}
else
{
if ( $retdb['status'] == "inactive" )
{
echo "Details Valid, License Status Inactive.";
}
else
{
echo "Details Valid, License Status Unknown.";
}
}
}
?>
Cod: Selectaţi tot
CREATE TABLE `license` (
`id` int(50) NOT NULL auto_increment,
`key` varchar(50) NOT NULL,
`domain` varchar(300) NOT NULL,
`website_ip` varchar(70) NOT NULL,
`status` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
Ce as putea sa modific ca sa apara tot mesajul?
Multumesc.