|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
4 Files to decode please |
|
Posted: Sun Aug 04, 2013 7:24 pm |
|
|
sford999 |
Regular user |
|
|
Joined: Jul 13, 2013 |
Posts: 5 |
|
|
|
|
|
|
|
|
|
|
|
|
decoded |
|
Posted: Sun Aug 04, 2013 8:07 pm |
|
|
myg3nx |
Advanced user |
|
|
Joined: Jun 01, 2013 |
Posts: 72 |
Location: indonesia |
|
|
|
|
|
|
./addons/hooks.php
Code: |
<?php
function hook_licensing_addon_log_prune($vars) {
$logprune = get_query_val( 'tbladdonmodules', 'value', array( 'module' => 'licensing', 'setting' => 'logprune' ) );
if (is_numeric( $logprune )) {
full_query( 'DELETE FROM mod_licensinglog WHERE datetime<=\'' . date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - $logprune, date( 'Y' ) ) ) . '\'' );
}
}
function hook_licensing_addon_search($vars) {
$keyword = $vars['keyword'];
$matches = array( );
$result = select_query( 'mod_licensing', '', 'licensekey LIKE \'%' . db_escape_string( $keyword ) . '%\' OR validdomain LIKE \'%' . db_escape_string( $keyword ) . '%\'' );
while ($data = mysql_fetch_array( $result )) {
$serviceid = $data['serviceid'];
$licensekey = $data['licensekey'];
$validdomain = $data['validdomain'];
$status = $data['status'];
$validdomain = explode( ',', $validdomain );
$validdomain = $validdomain[0];
if (!$validdomain) {
$validdomain = 'Not Yet Accessed';
}
$matches[] = array( 'link' => 'clientshosting.php?id=' . $serviceid, 'status' => $status, 'title' => $licensekey, 'desc' => $validdomain );
}
return array( 'Licenses' => $matches );
}
add_hook( 'DailyCronJob', 0, 'hook_licensing_addon_log_prune' );
add_hook( 'AdminIntelliSearch', 0, 'hook_licensing_addon_search' );
?>
|
|
|
|
|
|
|
|
decoded |
|
Posted: Sun Aug 04, 2013 8:08 pm |
|
|
myg3nx |
Advanced user |
|
|
Joined: Jun 01, 2013 |
Posts: 72 |
Location: indonesia |
|
|
|
|
|
|
./addons/licensing.php
Code: |
<?php
function licensing_config() {
$configarray = array( 'name' => 'Licensing Manager', 'description' => 'This addon allows you to license and distribute your own applications securely using the same system we use for WHMCS', 'version' => '3.0', 'author' => 'WHMCS', 'language' => 'english', 'fields' => array( ) );
global $licensing;
$validlicense = false;
foreach ($licensing->keydata['addons'] as $addon) {
if (( $addon['name'] == 'Licensing Addon' && $addon['status'] == 'Active' )) {
$validlicense = true;
continue;
}
}
if (!$validlicense) {
$configarray['fields']['license'] = array( 'FriendlyName' => 'License Check Failed', 'Type' => '', 'Description' => 'You need to purchase the licensing addon from <a href="http://www.whmcs.com/addons/licensing" target="_blank">www.whmcs.com/addons/licensing</a> to enable the use of this addon' );
}
else {
$configarray['fields'] = array( 'clientverifytool' => array( 'FriendlyName' => 'Public License Verification Tool', 'Type' => 'yesno', 'Description' => 'Tick this box to enable the Client Area License Verification Tool (accessed via /index.php?m=licensing)' ), 'maxreissues' => array( 'FriendlyName' => 'Maximum Allowed Reissues', 'Type' => 'text', 'Size' => '4', 'Default' => '10', 'Description' => 'Enter the maximum number of reissues you want to allow (abuse protection)' ), 'logprune' => array( 'FriendlyName' => 'Auto Logs Prune', 'Type' => 'text', 'Size' => '4', 'Default' => '90', 'Description' => 'Enter the number of days to keep license access log history for' ) );
}
return $configarray;
}
function licensing_activate() {
$query = 'CREATE TABLE `mod_licensing` (`id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,`serviceid` INT( 10 ) NOT NULL ,`licensekey` TEXT NOT NULL ,`validdomain` TEXT NOT NULL ,`validip` TEXT NOT NULL ,`validdirectory` TEXT NOT NULL ,`reissues` INT( 1 ) NOT NULL ,`status` ENUM( \'Active\', \'Reissued\', \'Suspended\', \'Expired\' ) NOT NULL ,`lastaccess` datetime NOT NULL default \'0000-00-00 00:00:00\')';
full_query( $query );
$query = 'CREATE TABLE `mod_licensinglog` (`id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,`licenseid` INT( 10 ) NOT NULL ,`domain` TEXT NOT NULL ,`ip` TEXT NOT NULL ,`path` TEXT NOT NULL ,`message` TEXT NOT NULL ,`datetime` datetime NOT NULL default \'0000-00-00 00:00:00\')';
full_query( $query );
$query = 'CREATE TABLE `mod_licensingbans` (`id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,`type` VARCHAR(1) NOT NULL ,`value` TEXT NOT NULL ,`notes` TEXT NOT NULL )';
full_query( $query );
}
function licensing_deactivate() {
$query = 'DROP TABLE `mod_licensing`';
full_query( $query );
$query = 'DROP TABLE `mod_licensinglog`';
full_query( $query );
$query = 'DROP TABLE `mod_licensingbans`';
full_query( $query );
}
function licensing_output($vars) {
global $aInt;
global $numrows;
global $tabledata;
global $page;
global $limit;
global $jscode;
$modulelink = $vars['modulelink'];
$action = (isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '');
$id = (int)$_REQUEST['id'];
echo '<style>
.licensinglinksbar {
padding:10px 25px 10px 25px;
background-color:#6CAD41;
font-weight:bold;
font-size: 14px;
color: #5A7B2F;
margin: 0 0 15px 0;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
.licensinglinksbar a {
color: #fff;
font-weight: normal;
}
</style>
<div class="licensinglinksbar">
<a href="' . $modulelink . '">Home</a> | <a href="' . $modulelink . '&action=list">Search/Browse Licenses</a> | <a href="' . $modulelink . '&action=bans">Ban Control</a> | <a href="' . $modulelink . '&action=log">License Access Logs</a> | <a href="http://docs.whmcs.com/Licensing_Addon" target="_blank">Help</a>
</div>
';
if (!$action) {
echo '
<h2>Statistics</h2>
<table width="90%" align="center">
<tr><td width="33%">
<div style="margin:0 25px;padding:15px;font-family:Trebuchet MS,Tahoma;text-align:center;font-size:20px;background-color:#E7F1C0;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;">
Active Licenses<br />
';
echo '<s';
echo 'trong>';
echo get_query_val( 'mod_licensing', 'COUNT(*)', 'status=\'Reissued\' OR status=\'Active\'' );
echo '</strong>
</div>
</td><td width="33%">
<div style="margin:0 25px;padding:15px;font-family:Trebuchet MS,Tahoma;text-align:center;font-size:20px;background-color:#F2E8BF;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;">
Suspended Licenses<br />
';
echo '<s';
echo 'trong>';
echo get_query_val( 'mod_licensing', 'COUNT(*)', 'status=\'Suspended\'' );
echo '</strong>
</div>
</td><td width="33%">
<div style="margin:0 25px;padding:15px;font-family:Trebuchet MS,Tahoma;text-align:center;font-size:20px;background-color:#F2BFBF;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;">
Expired Licenses<br />
';
echo '<s';
echo 'trong>';
echo get_query_val( 'mod_licensing', 'COUNT(*)', 'status=\'Expired\'' );
echo '</strong>
</div>
</td></tr>
</table>
<table width="90%" align="center">
<tr><td width="50%">
<div style="margin:0 25px;padding:15px;font-family:Trebuchet MS,Tahoma;text-align:center;font-size:20px;background-color:#efefef;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;">
Total Licenses in Database<br />
';
echo '<s';
echo 'trong>';
echo get_query_val( 'mod_licensing', 'COUNT(*)', '' );
echo '</strong>
</div>
</td><td width="50%">
<div style="margin:0 25px;padding:15px;font-family:Trebuchet MS,Tahoma;text-align:center;font-size:20px;background-color:#efefef;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;">
Accessed within the Past 30 Days<br />
';
echo '<s';
echo 'trong>';
echo get_query_val( 'mod_licensing', 'COUNT(*)', 'lastaccess>=\'' . date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 30, date( 'Y' ) ) ) . '\'' );
echo '</strong>
</div>
</td></tr>
</table>
<br />
<h2>Search</h2>
<form method="post" action="';
echo $modulelink;
echo '&action=list">
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tr><td width="15%" class="fieldlabel">Product/License</td><td class="fieldarea">';
echo '<s';
echo 'elect name="search_pid"><option value="0">- Any -</option>';
$result = select_query( 'tblproducts', 'id,name', array( 'servertype' => 'licensing' ), 'name', 'ASC' );
while ($data = mysql_fetch_array( $result )) {
echo '<option value="' . $data['id'] . '">' . $data['name'] . '</option>';
}
echo '</select></td></tr>
<tr><td width="15%" class="fieldlabel">License Key</td><td class="fieldarea"><input type="text" name="search_licensekey" size="30" value="';
echo $search_licensekey;
echo '" /></td></tr>
<tr><td class="fieldlabel">Domain</td><td class="fieldarea"><input type="text" name="search_domain" size="30" value="';
echo $search_domain;
echo '" /></td></tr>
<tr><td class="fieldlabel">IP</td><td class="fieldarea"><input type="text" name="search_ip" size="30" value="';
echo $search_ip;
echo '" /></td></tr>
<tr><td class="fieldlabel">Directory</td><td class="fieldarea"><input type="text" name="search_dir" size="60" value="';
echo $search_dir;
echo '" /></td></tr>
<tr><td class="fieldlabel">Status</td><td class="fieldarea">';
echo '<s';
echo 'elect name="search_status">
<option value="">- Any -</option>
<option>Reissued</option>
<option>Active</option>
<option>Suspended</option>
<option>Expired</option>
</select></td></tr>
</table>
<p align="center"><input type="submit" value="Search" class="button" /></p>
</form>
';
return null;
}
if ($action == 'list') {
echo '
<form method="post" action="';
echo $modulelink;
echo '&action=list">
<h2>Search/Browse Licenses</h2>
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tr><td width="15%" class="fieldlabel">Product/License</td><td class="fieldarea">';
echo '<s';
echo 'elect name="search_pid"><option value="0">- Any -</option>';
$result = select_query( 'tblproducts', 'id,name', array( 'servertype' => 'licensing' ), 'name', 'ASC' );
while ($data = mysql_fetch_array( $result )) {
echo '<option value="' . $data['id'] . '"';
if ($_REQUEST['search_pid'] == $data['id']) {
echo ' selected';
}
echo '>' . $data['name'] . '</option>';
}
echo '</select></td></tr>
<tr><td width="15%" class="fieldlabel">License Key</td><td class="fieldarea"><input type="text" name="search_licensekey" size="30" value="';
echo $_REQUEST['search_licensekey'];
echo '" /></td></tr>
<tr><td class="fieldlabel">Domain</td><td class="fieldarea"><input type="text" name="search_domain" size="30" value="';
echo $_REQUEST['search_domain'];
echo '" /></td></tr>
<tr><td class="fieldlabel">IP</td><td class="fieldarea"><input type="text" name="search_ip" size="30" value="';
echo $_REQUEST['search_ip'];
echo '" /></td></tr>
<tr><td class="fieldlabel">Directory</td><td class="fieldarea"><input type="text" name="search_dir" size="60" value="';
echo $_REQUEST['search_dir'];
echo '" /></td></tr>
<tr><td class="fieldlabel">Status</td><td class="fieldarea">';
echo '<s';
echo 'elect name="search_status">
<option value="">- Any -</option>
<option';
if ($_REQUEST['search_status'] == 'Reissued') {
echo ' selected';
}
echo '>Reissued</option>
<option';
if ($_REQUEST['search_status'] == 'Active') {
echo ' selected';
}
echo '>Active</option>
<option';
if ($_REQUEST['search_status'] == 'Suspended') {
echo ' selected';
}
echo '>Suspended</option>
<option';
if ($_REQUEST['search_status'] == 'Expired') {
echo ' selected';
}
echo '>Expired</option>
</select></td></tr>
</table>
<p align="center"><input type="submit" value="Search" class="button" /></p>
</form>
';
$where = array( );
if ($_REQUEST['search_pid']) {
$where['packageid'] = $_REQUEST['search_pid'];
}
if ($_REQUEST['search_licensekey']) {
$where['licensekey'] = array( 'sqltype' => 'LIKE', 'value' => trim( $_REQUEST['search_licensekey'] ) );
}
if ($_REQUEST['search_domain']) {
$where['validdomain'] = array( 'sqltype' => 'LIKE', 'value' => trim( $_REQUEST['search_domain'] ) );
}
if ($_REQUEST['search_ip']) {
$where['validip'] = array( 'sqltype' => 'LIKE', 'value' => trim( $_REQUEST['search_ip'] ) );
}
if ($_REQUEST['search_dir']) {
$where['validdirectory'] = array( 'sqltype' => 'LIKE', 'value' => trim( $_REQUEST['search_dir'] ) );
}
if ($_REQUEST['search_status']) {
$where['status'] = $_REQUEST['search_status'];
}
$aInt->sortableTableInit( 'licensesmanager', 'ASC' );
$result = select_query( 'mod_licensing', 'mod_licensing.*', $where, 'lastaccess', 'DESC', '', 'tblhosting ON tblhosting.id=mod_licensing.serviceid' );
$numrows = mysql_num_rows( $result );
if (( count( $where ) && $numrows == 1 )) {
$data = mysql_fetch_array( $result );
$id = $data['id'];
header( '' . 'Location: ' . $modulelink . '&action=manage&id=' . $id );
exit( );
}
$result = select_query( 'mod_licensing', 'mod_licensing.*', $where, 'lastaccess', 'DESC', $page * $limit . ( '' . ',' . $limit ), 'tblhosting ON tblhosting.id=mod_licensing.serviceid' );
while ($data = mysql_fetch_array( $result )) {
$id = $data['id'];
$serviceid = $data['serviceid'];
$licensekey = $data['licensekey'];
$validdomain = $data['validdomain'];
$validip = $data['validip'];
$validdirectory = $data['validdirectory'];
$status = $data['status'];
$lastaccess = $data['lastaccess'];
if ($lastaccess == '0000-00-00 00:00:00') {
$lastaccess = 'Never';
}
else {
$lastaccess = fromMySQLDate( $lastaccess, 'time' );
}
$validdomain = explode( ',', $validdomain );
$validip = explode( ',', $validip );
$validdomain = $validdomain[0];
$validip = $validip[0];
$tabledata[] = array( '' . '<a href="clientshosting.php?id=' . $serviceid . '" target="_blank">' . $licensekey . '</a>', $validdomain, $validip, $lastaccess, $status, '' . '<a href="' . $modulelink . '&action=manage&id=' . $id . '"><img src="images/edit.gif" border="0"></a>' );
}
echo $aInt->sortableTable( array( array( 'licensekey', 'License Key' ), array( 'validdomain', 'Valid Domains' ), array( 'validip', 'Valid IPs' ), array( 'lastaccess', 'Last Access' ), array( 'status', 'Status' ), '' ), $tabledata );
return null;
}
if ($action == 'manage') {
if ($_REQUEST['save']) {
update_query( 'mod_licensing', array( 'validdomain' => $_REQUEST['validdomain'], 'validip' => $_REQUEST['validip'], 'validdirectory' => $_REQUEST['validdirectory'], 'reissues' => $_REQUEST['reissues'], 'status' => $_REQUEST['status'] ), array( 'id' => $id ) );
header( '' . 'Location: ' . $modulelink . '&action=manage&id=' . $id );
exit( );
}
$result = select_query( 'mod_licensing', '', array( 'id' => $id ) );
$data = mysql_fetch_array( $result );
$id = $data['id'];
if (!$id) {
echo '<p>License Not Found. Please go back and try again.</p>';
return false;
}
$serviceid = $data['serviceid'];
$licensekey = $data['licensekey'];
$validdomain = $data['validdomain'];
$validip = $data['validip'];
$validdirectory = $data['validdirectory'];
$reissues = $data['reissues'];
$status = $data['status'];
$lastaccess = $data['lastaccess'];
if ($lastaccess == '0000-00-00 00:00:00') {
$lastaccess = 'Never';
}
else {
$lastaccess = fromMySQLDate( $lastaccess, 'time' );
}
$data = get_query_vals( 'tblhosting', 'tblproductgroups.name,tblproducts.name', array( 'tblhosting.id' => $serviceid ), '', '', '', 'tblproducts ON tblhosting.packageid=tblproducts.id INNER JOIN tblproductgroups ON tblproductgroups.id=tblproducts.gid' );
$productname = $data[0] . ' - ' . $data[1];
echo '
<h2>Manage License Key</h2>
<form method="post" action="';
echo $modulelink;
echo '&action=manage&id=';
echo $id;
echo '">
<input type="hidden" name="save" value="true" />
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tr><td class="fieldlabel" width="20%">Product/Service</td><td class="fieldarea" height="24">';
echo $productname;
echo '</td></tr>
<tr><td class="fieldlabel">License Key</td><td class="fieldarea"><input type="text" size="40" value="';
echo $licensekey;
echo '" readonly="true" /> ';
echo '<s';
echo 'pan style="color:#cccccc;">(Not Editable)</span></td></tr>
<tr><td class="fieldlabel">Valid Domains</td><td class="fieldarea"><textarea name="validdomain" rows=2 cols=80>';
echo $validdomain;
echo '</textarea></td></tr>
<tr><td class="fieldlabel">Valid IPs</td><td class="fieldarea"><textarea name="validip" rows=2 cols=80>';
echo $validip;
echo '</textarea></td></tr>
<tr><td class="fieldlabel">Valid Directory</td><td class="fieldarea"><textarea name="validdirectory" rows=2 cols=80>';
echo $validdirectory;
echo '</textarea></td></tr>
<tr><td class="fieldlabel">Number of Reissues</td><td class="fieldarea"><input type="text" name="reissues" size="10" value="';
echo $reissues;
echo '"></td></tr>
<tr><td class="fieldlabel">Status</td><td class="fieldarea">';
echo '<s';
echo 'elect name="status">
<option';
if ($status == 'Reissued') {
echo ' selected';
}
echo '>Reissued</option>
<option';
if ($status == 'Active') {
echo ' selected';
}
echo '>Active</option>
<option';
if ($status == 'Suspended') {
echo ' selected';
}
echo '>Suspended</option>
<option';
if ($status == 'Expired') {
echo ' selected';
}
echo '>Expired</option>
</select></td></tr>
<tr><td class="fieldlabel">Last Access</td><td class="fieldarea" height="24">';
echo $lastaccess;
echo '</td></tr>
</table>
<p align="center"><input type="button" value="« Back to List" onclick="history.go(-1)" /> <input type="submit" value="Save Changes" class="button" /> <input type="button" value="Product Details »" onclick="window.location=\'clientshosting.php?id=';
echo $serviceid;
echo '\'" /></p>
</form>
<h2>Recent Access</h2>
';
$aInt->sortableTableInit( 'nopagination' );
$result = select_query( 'mod_licensinglog', '', array( 'licenseid' => $id ), 'id', 'DESC', '0,10' );
while ($data = mysql_fetch_array( $result )) {
$domain = $data['domain'];
$ip = $data['ip'];
$path = $data['path'];
$message = $data['message'];
$datetime = $data['datetime'];
$datetime = fromMySQLDate( $datetime, true );
$tabledata[] = array( $datetime, $domain, $ip, $path, $message );
}
echo $aInt->sortableTable( array( 'Date', 'Domain', 'IP', 'Path', 'Result' ), $tabledata );
return null;
}
if ($action == 'bans') {
if ($_REQUEST['save']) {
check_token( );
if (trim( $_REQUEST['banvalue'] )) {
insert_query( 'mod_licensingbans', array( 'value' => trim( $_REQUEST['banvalue'] ), 'notes' => trim( $_REQUEST['bannote'] ) ) );
}
header( '' . 'Location: ' . $modulelink . '&action=bans' );
exit( );
}
if ($_REQUEST['delete']) {
check_token( );
delete_query( 'mod_licensingbans', array( 'id' => $_REQUEST['delete'] ) );
header( '' . 'Location: ' . $modulelink . '&action=bans' );
exit( );
}
$jscode = 'function doDelete(id) {
if (confirm("Are you sure you want to delete this ban entry?")) {
window.location=\'' . $modulelink . '&action=bans&delete=\'+id+\'' . generate_token( 'link' ) . '\';
}
}
';
echo '
<h2>Ban Control</h2>
<form method="post" action="';
echo $modulelink;
echo '&action=bans">
<input type="hidden" name="save" value="true" />
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tr><td class="fieldlabel" width="20%">Value</td><td class="fieldarea"><input type="text" name="banvalue" size="40" /></td></tr>
<tr><td class="fieldlabel">Reason/Notes</td><td class="fieldarea"><input type="text" name="bannote" size="80" /></td></tr>
</table>
<p ali';
echo 'gn="center"><input type="submit" value="Add Ban" /></p>
</form>
';
$aInt->sortableTableInit( 'nopagination' );
$result = select_query( 'mod_licensingbans', '', '', 'value', 'ASC' );
while ($data = mysql_fetch_array( $result )) {
$id = $data['id'];
$value = $data['value'];
$notes = $data['notes'];
$tabledata[] = array( $value, $notes, '<a href="#" onClick="doDelete(\'' . $id . '\');return false"><img src="images/delete.gif" width="16" height="16" border="0" alt="' . $aInt->lang( 'global', 'delete' ) . '"></a>' );
}
echo $aInt->sortableTable( array( 'Domain/IP', 'Ban Reason/Notes', '' ), $tabledata );
return null;
}
if ($action == 'log') {
echo '
<h2>License Access Logs</h2>
<form method="post" action="';
echo $modulelink;
echo '&action=log">
<p align="center"><b>Search/Filter</b>
Domain: <input type="text" name="search_domainlog" size="30" value="';
echo $_REQUEST['search_domainlog'];
echo '" />
IP: <input type="text" name="search_iplog" size="15" value="';
echo $_REQUEST['search_iplog'];
echo '" />
Dir: <input type="text" name="search_dirlog" size="25" value="';
echo $_REQUEST['search_dirlog'];
echo '" />
Status: <input type="text" name="search_message" size="25" value="';
echo $_REQUEST['search_message'];
echo '" />
<input type="submit" value="Go" class="button" /></p>
</form>
';
$where = array( );
if ($_REQUEST['search_domainlog']) {
$where['domain'] = array( 'sqltype' => 'LIKE', 'value' => trim( $_REQUEST['search_domainlog'] ) );
}
if ($_REQUEST['search_iplog']) {
$where['ip'] = array( 'sqltype' => 'LIKE', 'value' => trim( $_REQUEST['search_iplog'] ) );
}
if ($_REQUEST['search_dirlog']) {
$where['path'] = array( 'sqltype' => 'LIKE', 'value' => trim( $_REQUEST['search_dirlog'] ) );
}
if ($_REQUEST['search_message']) {
$where['message'] = array( 'sqltype' => 'LIKE', 'value' => trim( $_REQUEST['search_message'] ) );
}
$result = select_query( 'mod_licensinglog', '', $where, 'id', 'DESC' );
$numrows = mysql_num_rows( $result );
$aInt->sortableTableInit( 'datetime', 'ASC' );
$result = select_query( 'mod_licensinglog', '', $where, 'id', 'DESC', $page * $limit . ( '' . ',' . $limit ) );
while ($data = mysql_fetch_array( $result )) {
$domain = $data['domain'];
$ip = $data['ip'];
$path = $data['path'];
$message = $data['message'];
$datetime = $data['datetime'];
$datetime = fromMySQLDate( $datetime, true );
$tabledata2[] = array( $datetime, $domain, $ip, $path, $message );
}
echo $aInt->sortableTable( array( 'Date', 'Domain', 'IP', 'Path', 'Status Message' ), $tabledata2 );
}
}
function licensing_clientarea($vars) {
if (!$vars['clientverifytool']) {
return false;
}
$domain = trim( $_POST['domain'] );
$check = false;
$results = array( );
if ($domain) {
$check = true;
$result = select_query( 'mod_licensing', 'mod_licensing.*,tblproducts.name', 'validdomain LIKE \'%' . db_escape_string( $domain ) . '%\' OR validip LIKE \'%' . db_escape_string( $domain ) . '%\'', '', '', '', 'tblhosting ON tblhosting.id=mod_licensing.serviceid INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid' );
while ($data = mysql_fetch_array( $result )) {
$licenseid = $data['id'];
$productname = $data['name'];
$status = $data['status'];
$validdomains = explode( ',', $data['validdomain'] );
$validips = explode( ',', $data['validip'] );
if (( in_array( $domain, $validdomains ) || in_array( $domain, $validips ) )) {
$results[] = array( 'productname' => $productname, 'domain' => $validdomains[0], 'ip' => $validips[0], 'status' => $status );
continue;
}
}
}
return array( 'pagetitle' => 'License Verification Tool', 'breadcrumb' => array( 'index.php?m=licensing' => 'License Verification Tool' ), 'templatefile' => 'licenseverify', 'vars' => array( 'domain' => $domain, 'check' => $check, 'results' => $results ) );
}
if (!defined( 'WHMCS' )) {
exit( 'This file cannot be accessed directly' );
}
?>
|
|
|
|
|
|
|
|
decoded |
|
Posted: Sun Aug 04, 2013 8:10 pm |
|
|
myg3nx |
Advanced user |
|
|
Joined: Jun 01, 2013 |
Posts: 72 |
Location: indonesia |
|
|
|
|
|
|
./servers/licensing.php
Code: |
<?php
function licensing_ConfigOptions() {
global $validlicense;
if (!$validlicense) {
return array( 'License Required' => array( 'Type' => 'na', 'Description' => 'You need to purchase the <a href="http://www.whmcs.com/licensing-addon/" target="_blank">Licensing Addon here</a> before you can access & use this module. If you have recently purchased, please go to Help > Check for Updates in order to force a local key update and have it take effect. Then try again.' ) );
}
$supportupdatesaddons = '0|None,';
global $id;
$result = select_query( 'tbladdons', '', '', 'name', 'ASC' );
while ($data = mysql_fetch_array( $result )) {
$addonid = $data['id'];
$addonname = $data['name'];
$addonpackages = $data['packages'];
$addonpackages = explode( ',', $addonpackages );
if (in_array( $id, $addonpackages )) {
$supportupdatesaddons .= '' . $addonid . '|' . $addonname . ',';
continue;
}
}
$supportupdatesaddons = substr( $supportupdatesaddons, 0, 0 - 1 );
$configarray = array( 'Key Length' => array( 'Type' => 'text', 'Size' => '10', 'Description' => 'String Length eg. 10' ), 'Key Prefix' => array( 'Type' => 'text', 'Size' => '20', 'Description' => 'eg. Leased-' ), 'Allow Reissue' => array( 'Type' => 'yesno', 'Description' => 'Tick to allow clients to self-reissue from the client area' ), 'Allow Domain Conflict' => array( 'Type' => 'yesno', 'Description' => 'Tick to not validate Domains' ), 'Allow IP Conflict' => array( 'Type' => 'yesno', 'Description' => 'Tick to not validate IPs' ), 'Allow Directory Conflict' => array( 'Type' => 'yesno', 'Description' => 'Tick to not validate installation path' ), 'Support/Updates Addon' => array( 'Type' => 'dropdown', 'Options' => $supportupdatesaddons ), 'Secret Key' => array( 'Type' => 'text', 'Size' => '20', 'Description' => 'Used in MD5 Verification' ), 'Free Trial' => array( 'Type' => 'yesno', 'Description' => 'Restricts license to one instance per Domain' ) );
return $configarray;
}
function licensing_genkey($length, $prefix) {
if (!$length) {
$length = 10;
}
$seeds = 'abcdef0123456789';
$key = null;
$seeds_count = strlen( $seeds ) - 1;
$i = 0;
while ($i < $length) {
$key .= $seeds[rand( 0, $seeds_count )];
++$i;
}
$licensekey = $prefix . $key;
$result = select_query( 'mod_licensing', 'COUNT(*)', array( 'licensekey' => $licensekey ) );
$data = mysql_fetch_array( $result );
if ($data[0]) {
$licensekey = licensing_genkey( $length, $prefix );
}
return $licensekey;
}
function licensing_CreateAccount($params) {
global $validlicense;
if (!$validlicense) {
return 'You need to purchase the Licensing Addon (http://www.whmcs.com/licensing-addon/) before you can access and use this module. If you have recently purchased, please go to Help - Check for Updates in order to force a local key update and have it take effect. Then try again.';
}
$result = select_query( 'mod_licensing', 'COUNT(*)', array( 'serviceid' => $params['serviceid'] ) );
$data = mysql_fetch_array( $result );
if ($data[0]) {
return 'A license has already been generated for this item';
}
$length = $params['configoption1'];
$prefix = $params['configoption2'];
$licensekey = licensing_genkey( $length, $prefix );
insert_query( 'mod_licensing', array( 'serviceid' => $params['serviceid'], 'licensekey' => $licensekey, 'validdomain' => '', 'validip' => '', 'validdirectory' => '', 'reissues' => '0', 'status' => 'Reissued' ) );
update_query( 'tblhosting', array( 'domain' => $licensekey, 'username' => '', 'password' => '' ), array( 'id' => $params['serviceid'] ) );
$addonid = explode( '|', $params['configoption7'] );
$addonid = $addonid[0];
if ($addonid) {
$result = select_query( 'tblhosting', 'orderid,paymentmethod', array( 'id' => $params['serviceid'] ) );
$data = mysql_fetch_array( $result );
$orderid = $data['orderid'];
$paymentmethod = $data['paymentmethod'];
$result = select_query( 'tbladdons', '', array( 'id' => $addonid ) );
$data = mysql_fetch_array( $result );
$addonname = $data['name'];
$result = select_query( 'tblpricing', '', array( 'relid' => $addonid, 'type' => 'addon', 'currency' => $params['clientsdetails']['currency'] ) );
$data2 = mysql_fetch_array( $result );
$addonsetupfee = $data2['msetupfee'];
$addonrecurring = $data2['monthly'];
$addonbillingcycle = $data['billingcycle'];
$addontax = $data['tax'];
if ($addonbillingcycle == 'Monthly') {
$nextduedate = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ) + 1, date( 'd' ), date( 'Y' ) ) );
}
else {
if ($addonbillingcycle == 'Quarterly') {
$nextduedate = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ) + 3, date( 'd' ), date( 'Y' ) ) );
}
else {
if ($addonbillingcycle == 'Semi-Annually') {
$nextduedate = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ) + 6, date( 'd' ), date( 'Y' ) ) );
}
else {
if ($addonbillingcycle == 'Annually') {
$nextduedate = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ) + 12, date( 'd' ), date( 'Y' ) ) );
}
else {
if ($addonbillingcycle == 'Biennially') {
$nextduedate = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ) + 24, date( 'd' ), date( 'Y' ) ) );
}
else {
$nextduedate = '0000-00-00';
}
}
}
}
}
insert_query( 'tblhostingaddons', array( 'orderid' => $orderid, 'hostingid' => $params['serviceid'], 'addonid' => $addonid, 'setupfee' => $addonsetupfee, 'recurring' => $addonrecurring, 'billingcycle' => $addonbillingcycle, 'tax' => $addontax, 'status' => 'Active', 'regdate' => 'now()', 'nextduedate' => $nextduedate, 'nextinvoicedate' => $nextduedate, 'paymentmethod' => $paymentmethod ) );
}
return 'success';
}
function licensing_SuspendAccount($params) {
global $validlicense;
if (!$validlicense) {
return 'You need to purchase the Licensing Addon (http://www.whmcs.com/licensing-addon/) before you can access and use this module. If you have recently purchased, please go to Help - Check for Updates in order to force a local key update and have it take effect. Then try again.';
}
$result = select_query( 'mod_licensing', 'COUNT(*)', array( 'serviceid' => $params['serviceid'] ) );
$data = mysql_fetch_array( $result );
if (!$data[0]) {
return 'No license exists for this item';
}
update_query( 'mod_licensing', array( 'status' => 'Suspended' ), array( 'serviceid' => $params['serviceid'] ) );
return 'success';
}
function licensing_UnsuspendAccount($params) {
global $validlicense;
if (!$validlicense) {
return 'You need to purchase the Licensing Addon (http://www.whmcs.com/licensing-addon/) before you can access and use this module. If you have recently purchased, please go to Help - Check for Updates in order to force a local key update and have it take effect. Then try again.';
}
$result = select_query( 'mod_licensing', 'COUNT(*)', array( 'serviceid' => $params['serviceid'] ) );
$data = mysql_fetch_array( $result );
if (!$data[0]) {
return 'No license exists for this item';
}
update_query( 'mod_licensing', array( 'status' => 'Active' ), array( 'serviceid' => $params['serviceid'] ) );
return 'success';
}
function licensing_TerminateAccount($params) {
global $validlicense;
if (!$validlicense) {
return 'You need to purchase the Licensing Addon (http://www.whmcs.com/licensing-addon/) before you can access and use this module. If you have recently purchased, please go to Help - Check for Updates in order to force a local key update and have it take effect. Then try again.';
}
$result = select_query( 'mod_licensing', 'COUNT(*)', array( 'serviceid' => $params['serviceid'] ) );
$data = mysql_fetch_array( $result );
if (!$data[0]) {
return 'No license exists for this item';
}
update_query( 'mod_licensing', array( 'status' => 'Expired' ), array( 'serviceid' => $params['serviceid'] ) );
return 'success';
}
function licensing_AdminCustomButtonArray() {
$buttonarray = array( 'Reissue License' => 'reissue', 'Reset Reissues' => 'reissuereset', 'Revoke License' => 'revoke', 'Manage' => 'manage' );
return $buttonarray;
}
function licensing_ClientAreaCustomButtonArray() {
$buttonarray = array( 'Reissue License' => 'reissue' );
return $buttonarray;
}
function licensing_reissue($params) {
global $validlicense;
if (!$validlicense) {
return 'You need to purchase the Licensing Addon (http://www.whmcs.com/licensing-addon/) before you can access and use this module. If you have recently purchased, please go to Help - Check for Updates in order to force a local key update and have it take effect. Then try again.';
}
$result = select_query( 'mod_licensing', 'id,status,reissues', array( 'serviceid' => $params['serviceid'] ) );
$data = mysql_fetch_array( $result );
if (!$data[0]) {
return 'No license exists for this item';
}
if (( !$_SESSION['adminid'] && !$params['configoption3'] )) {
return 'This license key is not allowed to be reissued';
}
if ($data[1] != 'Active') {
return 'License must be active to be reissued';
}
$maxreissues = get_query_val( 'tbladdonmodules', 'value', array( 'module' => 'licensing', 'setting' => 'maxreissues' ) );
if (( ( !$_SESSION['adminid'] && $maxreissues ) && $maxreissues <= $data[2] )) {
return 'The maximum number of reissues allowed has been reached for this license - please contact support';
}
update_query( 'mod_licensing', array( 'reissues' => '+1', 'status' => 'Reissued' ), array( 'serviceid' => $params['serviceid'] ) );
return '';
}
function licensing_reissuereset($params) {
global $validlicense;
if (!$validlicense) {
return 'You need to purchase the Licensing Addon (http://www.whmcs.com/licensing-addon/) before you can access and use this module. If you have recently purchased, please go to Help - Check for Updates in order to force a local key update and have it take effect. Then try again.';
}
$result = select_query( 'mod_licensing', 'id,status,reissues', array( 'serviceid' => $params['serviceid'] ) );
$data = mysql_fetch_array( $result );
if (!$data[0]) {
return 'No license exists for this item';
}
update_query( 'mod_licensing', array( 'reissues' => '0' ), array( 'serviceid' => $params['serviceid'] ) );
return '';
}
function licensing_revoke($params) {
global $validlicense;
if (!$validlicense) {
return 'You need to purchase the Licensing Addon (http://www.whmcs.com/licensing-addon/) before you can access and use this module. If you have recently purchased, please go to Help - Check for Updates in order to force a local key update and have it take effect. Then try again.';
}
$result = select_query( 'mod_licensing', 'COUNT(*)', array( 'serviceid' => $params['serviceid'] ) );
$data = mysql_fetch_array( $result );
if (!$data[0]) {
return 'No license exists for this item';
}
delete_query( 'mod_licensing', array( 'serviceid' => $params['serviceid'] ) );
update_query( 'tblhosting', array( 'domain' => '' ), array( 'id' => $params['serviceid'] ) );
return '';
}
function licensing_manage($params) {
$result = select_query( 'mod_licensing', 'id', array( 'serviceid' => $params['serviceid'] ) );
$data = mysql_fetch_array( $result );
if (!$data[0]) {
return 'No license exists for this item';
}
header( 'Location: addonmodules.php?module=licensing&action=manage&id=' . $data[0] );
exit( );
}
function licensing_AdminServicesTabFields($params) {
global $aInt;
global $validlicense;
if (!$validlicense) {
return array( 'License Required' => 'You need to purchase the <a href="http://www.whmcs.com/licensing-addon/" target="_blank">Licensing Addon here</a> before you can access & use this module. If you have recently purchased, please go to Help > Check for Updates in order to force a local key update and have it take effect. Then try again.' );
}
$result = select_query( 'mod_licensing', '', array( 'serviceid' => $params['serviceid'] ) );
$data = mysql_fetch_array( $result );
$licenseid = $data['id'];
if ($licenseid) {
$licensekey = $data['licensekey'];
$validdomain = $data['validdomain'];
$validip = $data['validip'];
$validdirectory = $data['validdirectory'];
$reissues = $data['reissues'];
$status = $data['status'];
$lastaccess = $data['lastaccess'];
if ($lastaccess == '0000-00-00 00:00:00') {
$lastaccess = 'Never';
}
else {
$lastaccess = fromMySQLDate( $lastaccess, 'time' );
}
$statusoptions = '<option';
if ($status == 'Reissued') {
$statusoptions .= ' selected';
}
$statusoptions .= '>Reissued</option><option';
if ($status == 'Active') {
$statusoptions .= ' selected';
}
$statusoptions .= '>Active</option><option';
if ($status == 'Suspended') {
$statusoptions .= ' selected';
}
$statusoptions .= '>Suspended</option><option';
if ($status == 'Expired') {
$statusoptions .= ' selected';
}
$statusoptions .= '>Expired</option>';
$result = select_query( 'mod_licensinglog', '', array( 'licenseid' => $licenseid ), 'id', 'DESC', '0,10' );
while ($data = mysql_fetch_array( $result )) {
$domain = $data['domain'];
$ip = $data['ip'];
$path = $data['path'];
$message = $data['message'];
$datetime = $data['datetime'];
$datetime = fromMySQLDate( $datetime, true );
$tabledata[] = array( $datetime, $domain, $ip, $path, $message );
}
$aInt->sortableTableInit( 'nopagination' );
$recentaccesslog = $aInt->sortableTable( array( 'Date', 'Domain', 'IP', 'Path', 'Result' ), $tabledata );
$fieldsarray = array( 'Valid Domains' => '<textarea name="modulefields[0]" rows="2" cols="80">' . $validdomain . '</textarea>', 'Valid IPs' => '<textarea name="modulefields[1]" rows="2" cols="80">' . $validip . '</textarea>', 'Valid Directory' => '<textarea name="modulefields[2]" rows="2" cols="80">' . $validdirectory . '</textarea>', 'License Status' => '<select name="modulefields[3]">' . $statusoptions . '</select>', 'Recent Access Log' => $recentaccesslog, 'Number of Reissues' => $reissues, 'Last Access' => $lastaccess );
return $fieldsarray;
}
}
function licensing_AdminServicesTabFieldsSave($params) {
update_query( 'mod_licensing', array( 'validdomain' => $_POST['modulefields'][0], 'validip' => $_POST['modulefields'][1], 'validdirectory' => $_POST['modulefields'][2], 'status' => $_POST['modulefields'][3] ), array( 'serviceid' => $params['serviceid'] ) );
}
global $licensing;
global $validlicense;
$validlicense = false;
foreach ($licensing->keydata['addons'] as $addon) {
if (( $addon['name'] == 'Licensing Addon' && $addon['status'] == 'Active' )) {
$validlicense = true;
continue;
}
}
?>
|
|
|
|
|
|
|
|
decoded |
|
Posted: Sun Aug 04, 2013 8:11 pm |
|
|
myg3nx |
Advanced user |
|
|
Joined: Jun 01, 2013 |
Posts: 72 |
Location: indonesia |
|
|
|
|
|
|
./servers/verify.php
Code: |
<?php
function licensing_getlicreturndata($licenseid) {
global $licensing_secret_key;
global $licensing_secretkey;
$result = select_query( 'mod_licensing', '', array( 'id' => $licenseid ) );
$data = mysql_fetch_array( $result );
$serviceid = $data['serviceid'];
$licensekey = $data['licensekey'];
$validdomain = $data['validdomain'];
$validip = $data['validip'];
$validdirectory = $data['validdirectory'];
$status = $data['status'];
$result = select_query( 'tblhosting', '', array( 'id' => $serviceid ) );
$data = mysql_fetch_array( $result );
$productid = ltrim( $data['packageid'], '0' );
$nextduedate = $data['nextduedate'];
$regdate = $data['regdate'];
$billingcycle = $data['billingcycle'];
$userid = $data['userid'];
$result = select_query( 'tblproducts', '', array( 'id' => $productid ) );
$data = mysql_fetch_array( $result );
$productname = $data['name'];
$result = select_query( 'tblclients', '', array( 'id' => $userid ) );
$data = mysql_fetch_array( $result );
$firstname = $data['firstname'];
$lastname = $data['lastname'];
$companyname = $data['companyname'];
$email = $data['email'];
$configoptions = '';
$result = full_query( '' . 'SELECT tblproductconfigoptions.optionname, tblproductconfigoptions.optiontype, tblproductconfigoptionssub.optionname, tblhostingconfigoptions.qty FROM tblhostingconfigoptions INNER JOIN tblproductconfigoptions ON tblproductconfigoptions.id = tblhostingconfigoptions.configid INNER JOIN tblproductconfigoptionssub ON tblproductconfigoptionssub.id = tblhostingconfigoptions.optionid INNER JOIN tblhosting ON tblhosting.id=tblhostingconfigoptions.relid INNER JOIN tblproductconfiglinks ON tblproductconfiglinks.gid=tblproductconfigoptions.gid WHERE tblhostingconfigoptions.relid=\'' . $serviceid . '\' AND tblproductconfiglinks.pid=tblhosting.packageid ORDER BY tblproductconfigoptions.`order`,tblproductconfigoptions.id ASC' );
while ($data = mysql_fetch_array( $result )) {
if ($data[1] == '3') {
if ($data[3]) {
$data[2] = 'Yes';
}
else {
$data[2] = '';
}
}
else {
if ($data[1] == '4') {
$data[2] = $data[3];
}
}
$configoptions .= $data[0] . '=' . $data[2] . '|';
}
$configoptions = substr( $configoptions, 0, 0 - 1 );
$customfields = '';
$result = full_query( '' . 'SELECT tblcustomfields.fieldname,tblcustomfieldsvalues.value FROM tblcustomfields,tblcustomfieldsvalues WHERE tblcustomfields.id=tblcustomfieldsvalues.fieldid AND tblcustomfields.type=\'product\' AND tblcustomfieldsvalues.relid=\'' . $serviceid . '\'' );
while ($data = mysql_fetch_array( $result )) {
$customfields .= $data[0] . '=' . $data[1] . '|';
}
$customfields = substr( $customfields, 0, 0 - 1 );
$addons = '';
$result = full_query( '' . 'SELECT addonid, name, nextduedate, status FROM tblhostingaddons WHERE tblhostingaddons.hostingid=' . $serviceid );
while ($data = mysql_fetch_assoc( $result )) {
if (!$data['name']) {
$result2 = select_query( 'tbladdons', 'name', array( 'id' => $data['addonid'] ) );
$data2 = mysql_fetch_assoc( $result2 );
$data['name'] = $data2['name'];
}
$addons .= 'name=' . $data['name'] . ';nextduedate=' . $data['nextduedate'] . ';status=' . $data['status'] . '|';
}
$addons = substr( $addons, 0, 0 - 1 );
$md5hash = (isset( $_POST['check_token'] ) ? md5( $licensing_secretkey . $_POST['check_token'] ) : '');
echo '' . '
<registeredname>' . $firstname . ' ' . $lastname . '</registeredname>
<companyname>' . $companyname . '</companyname>
<email>' . $email . '</email>
<serviceid>' . $serviceid . '</serviceid>
<productid>' . $productid . '</productid>
<productname>' . $productname . '</productname>
<regdate>' . $regdate . '</regdate>
<nextduedate>' . $nextduedate . '</nextduedate>
<billingcycle>' . $billingcycle . '</billingcycle>
<validdomain>' . $validdomain . '</validdomain>
<validip>' . $validip . '</validip>
<validdirectory>' . $validdirectory . '</validdirectory>
<configoptions>' . $configoptions . '</configoptions>
<customfields>' . $customfields . '</customfields>
<addons>' . $addons . '</addons>
<md5hash>' . $md5hash . '</md5hash>';
}
require( '../../../dbconnect.php' );
require( '../../../includes/functions.php' );
$result = select_query( 'mod_licensing', '', array( 'licensekey' => $_POST['licensekey'] ) );
$data = mysql_fetch_array( $result );
$licenseid = $data['id'];
$serviceid = $data['serviceid'];
$validdomain = $data['validdomain'];
$validip = $data['validip'];
$validdirectory = $data['validdirectory'];
$reissues = $data['reissues'];
$status = $data['status'];
$result = select_query( 'tblhosting', 'tblproducts.id,tblproducts.configoption4,tblproducts.configoption5,tblproducts.configoption6,tblproducts.configoption8,tblproducts.configoption9', array( 'tblhosting.id' => $serviceid ), '', '', '', 'tblproducts ON tblhosting.packageid=tblproducts.id' );
$data = mysql_fetch_array( $result );
$pid = $data['id'];
$allowdomainconflict = $data['configoption4'];
$allowipconflict = $data['configoption5'];
$allowdirectoryconflict = $data['configoption6'];
$licensing_secretkey = $data['configoption8'];
$licensing_freetrial = $data['configoption9'];
if (!$ip) {
$ip = $_SERVER['REMOTE_ADDR'];
}
if (!$licenseid) {
echo '<status>Invalid</status>';
insert_query( 'mod_licensinglog', array( 'licenseid' => $licenseid, 'domain' => $_POST['domain'], 'ip' => $_POST['ip'], 'path' => $_POST['dir'], 'message' => 'Invalid Key - ' . $_POST['licensekey'], 'datetime' => 'now()' ) );
exit( );
}
else {
update_query( 'mod_licensing', array( 'lastaccess' => 'now()' ), array( 'id' => $licenseid ) );
}
if ($status == 'Expired') {
echo '<status>Expired</status>';
licensing_getlicreturndata( $licenseid );
insert_query( 'mod_licensinglog', array( 'licenseid' => $licenseid, 'domain' => $_POST['domain'], 'ip' => $_POST['ip'], 'path' => $_POST['dir'], 'message' => 'License Expired', 'datetime' => 'now()' ) );
exit( );
}
if ($status == 'Suspended') {
echo '<status>Suspended</status>';
licensing_getlicreturndata( $licenseid );
insert_query( 'mod_licensinglog', array( 'licenseid' => $licenseid, 'domain' => $_POST['domain'], 'ip' => $_POST['ip'], 'path' => $_POST['dir'], 'message' => 'License Suspended', 'datetime' => 'now()' ) );
exit( );
}
if ($status == 'Reissued') {
if (substr( $domain, 0, 4 ) == 'www.') {
$domain = substr( $domain, 4 );
}
$validdomain = $domain . ',www.' . $domain;
$validip = $ip;
$validdirectory = $dir;
update_query( 'mod_licensing', array( 'validdomain' => $validdomain, 'validip' => $validip, 'validdirectory' => $validdirectory, 'status' => 'Active' ), array( 'id' => $licenseid ) );
if (0 < $reissues) {
insert_query( 'mod_licensinglog', array( 'licenseid' => $licenseid, 'domain' => $_POST['domain'], 'ip' => $_POST['ip'], 'path' => $_POST['dir'], 'message' => 'License Reissued', 'datetime' => 'now()' ) );
}
}
if (( $status == 'Reissued' || $status == 'Active' )) {
if ($licensing_freetrial) {
$trialmatches = array( );
$result = select_query( 'mod_licensing', 'mod_licensing.*', 'mod_licensing.id!=' . (int)$licenseid . ' AND tblhosting.packageid=' . (int)$pid . ' AND mod_licensing.validdomain LIKE \'%' . db_escape_string( $domain ) . '%\'', '', '', '', 'tblhosting ON tblhosting.id=mod_licensing.serviceid' );
while ($data = mysql_fetch_array( $result )) {
$triallicenseid = $data['id'];
$trialvaliddomains = explode( ',', $data['validdomain'] );
if (in_array( $domain, $trialvaliddomains )) {
$trialmatches[] = $triallicenseid;
continue;
}
}
if (count( $trialmatches )) {
echo '<status>Suspended</status>';
licensing_getlicreturndata( $licenseid );
update_query( 'mod_licensing', array( 'status' => 'Suspended' ), array( 'id' => $licenseid ) );
update_query( 'tblhosting', array( 'status' => 'Suspended', 'suspendreason' => 'Duplicate Free Trial Use' ), array( 'id' => $serviceid ) );
insert_query( 'mod_licensinglog', array( 'licenseid' => $licenseid, 'domain' => $_POST['domain'], 'ip' => $_POST['ip'], 'path' => $_POST['dir'], 'message' => 'License Suspended for Duplicate Trials Use (' . implode( ',', $trialmatches ) . ')', 'datetime' => 'now()' ) );
exit( );
}
}
$result = select_query( 'mod_licensingbans', '', array( 'value' => $domain ) );
$data = mysql_fetch_array( $result );
$banid = $data['id'];
$bannotes = $data['notes'];
if ($banid) {
echo '<status>Suspended</status>';
licensing_getlicreturndata( $licenseid );
update_query( 'mod_licensing', array( 'status' => 'Suspended' ), array( 'id' => $licenseid ) );
update_query( 'tblhosting', array( 'status' => 'Suspended', 'suspendreason' => 'Banned Domain/IP' ), array( 'id' => $serviceid ) );
insert_query( 'mod_licensinglog', array( 'licenseid' => $licenseid, 'domain' => $_POST['domain'], 'ip' => $_POST['ip'], 'path' => $_POST['dir'], 'message' => 'Banned Domain/IP (' . $bannotes . ')', 'datetime' => 'now()' ) );
exit( );
}
}
$validdomains = explode( ',', $validdomain );
$validips = explode( ',', $validip );
if (( !in_array( $ip, $validips ) && !$allowipconflict )) {
echo '<status>Invalid</status>
<message>IP Address Invalid</message>';
insert_query( 'mod_licensinglog', array( 'licenseid' => $licenseid, 'domain' => $_POST['domain'], 'ip' => $_POST['ip'], 'path' => $_POST['dir'], 'message' => 'IP Address Invalid', 'datetime' => 'now()' ) );
return 1;
}
if (( !in_array( $domain, $validdomains ) && !$allowdomainconflict )) {
echo '<status>Invalid</status>
<message>Domain Invalid</message>';
insert_query( 'mod_licensinglog', array( 'licenseid' => $licenseid, 'domain' => $_POST['domain'], 'ip' => $_POST['ip'], 'path' => $_POST['dir'], 'message' => 'Domain Invalid', 'datetime' => 'now()' ) );
return 1;
}
if (( $validdirectory != $dir && !$allowdirectoryconflict )) {
echo '<status>Invalid</status>
<message>Directory Invalid</message>';
insert_query( 'mod_licensinglog', array( 'licenseid' => $licenseid, 'domain' => $_POST['domain'], 'ip' => $_POST['ip'], 'path' => $_POST['dir'], 'message' => 'Directory Invalid', 'datetime' => 'now()' ) );
return 1;
}
echo '<status>Active</status>';
licensing_getlicreturndata( $licenseid );
?>
|
|
|
|
|
|
|
|
|
|
Posted: Mon Aug 05, 2013 3:19 pm |
|
|
sford999 |
Regular user |
|
|
Joined: Jul 13, 2013 |
Posts: 5 |
|
|
|
|
|
|
|
|
|
|
|
www.waraxe.us Forum Index -> PHP script decode requests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|