Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 1.1.3.0
- * @ Author : DeZender
- * @ Release on : 17.05.2011
- * @ Official site : http://DeZender.Net
- *
- */
- function CheckLicense() {
- require( dirname( realpath( __FILE__ ) ) . '/' . 'config.php' );
- $licensekey = '' . $modulelicensekey;
- if (!mysql_num_rows( mysql_query( 'SHOW TABLES LIKE \'mod_ovhsrv\'' ) )) {
- $query = 'CREATE TABLE `mod_ovhsrv` (`id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,`licensekey` TEXT NOT NULL)';
- $result = mysql_query( $query );
- }
- $res = mysql_query( '' . 'SELECT relid,value FROM tblcustomfieldsvalues WHERE relid IN (SELECT id FROM tblhosting WHERE domainstatus = \'Active\') AND value REGEXP \'^(ns|ks)[0-9].*\.(ovh.net|kimsufi.com)$\'' );
- $num = mysql_num_rows( $res );
- if (( preg_match( '' . '/^OvhSrv\-Micro\-(Leased|Owned)\-[a-zA-Z0-9]{20}$/', '' . $modulelicensekey ) && 2 < $num )) {
- echo '' . '<div class="errorbox">License exceeded.<br />Please contact our support to resolve this issue<br /><br />Error code [0' . $num . '2]<br /></div>';
- return false;
- }
- if (( preg_match( '' . '/^OvhSrv\-Mini\-(Leased|Owned)\-[a-zA-Z0-9]{20}$/', '' . $modulelicensekey ) && 5 < $num )) {
- echo '' . '<div class="errorbox">License exceeded.<br />Please contact our support to resolve this issue<br /><br />Error code [0' . $num . '5]<br /></div>';
- return false;
- }
- if (!preg_match( '' . '/^OvhSrv\-([a-zA-Z]{4,5}\-)?(Leased|Owned)\-[a-zA-Z0-9]{20}$/', '' . $modulelicensekey )) {
- echo '<div class="errorbox">Your license key is invalid.<br />Please contact WebSoftSolus support at support@websoftsolus.com to resolve this issue<br /></div>';
- return false;
- }
- $query = select_query( 'mod_ovhsrv', 'licensekey' );
- $data = mysql_fetch_array( $query );
- $localkey = $data['licensekey'];
- $results = check_license( $licensekey, $localkey );
- if ($results['status'] == 'Active') {
- if ($results['localkey']) {
- $localkeydata = $results['localkey'];
- $query = select_query( 'mod_ovhsrv', 'licensekey' );
- $result = mysql_fetch_assoc( $query );
- if (empty( $result )) {
- insert_query( 'mod_ovhsrv', array( 'licensekey' => '' . $localkeydata ) );
- } else {
- update_query( 'mod_ovhsrv', array( 'licensekey' => '' . $localkeydata ) );
- }
- }
- return true;
- }
- if ($results['status'] == 'Invalid') {
- echo '<div class="errorbox">Your license key is invalid.<br />Please contact WebSoftSolus support at support@websoftsolus.com to resolve this issue<br /></div>';
- } else {
- if ($results['status'] == 'Expired') {
- echo '<div class="errorbox">Your license key is Expired.<br />Please contact WebSoftSolus support at support@websoftsolus.com to resolve this issue<br /></div>';
- } else {
- if ($results['status'] == 'Suspended') {
- echo '<div class="errorbox">Your license key is Suspended.<br />Please contact WebSoftSolus support at support@websoftsolus.com to resolve this issue<br /></div>';
- }
- }
- }
- return false;
- }
- function check_license($licensekey, $localkey = '') {
- $whmcsurl = 'http://www.websoftsolus.com/clients/';
- $licensing_secret_key = 'bd553aeb64S53ada45d8626db4e6d6ed';
- $check_token = time( ) . md5( mt_rand( 1000000000, 9999999999 ) . $licensekey );
- $checkdate = date( 'Ymd' );
- $usersip = (isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR']);
- $localkeydays = 23;
- $allowcheckfaildays = 18;
- $localkeyvalid = false;
- if ($localkey) {
- $localkey = str_replace( '
- ', '', $localkey );
- $localdata = substr( $localkey, 0, strlen( $localkey ) - 32 );
- $md5hash = substr( $localkey, strlen( $localkey ) - 32 );
- if ($md5hash == md5( $localdata . $licensing_secret_key )) {
- $localdata = strrev( $localdata );
- $md5hash = substr( $localdata, 0, 32 );
- $localdata = substr( $localdata, 32 );
- $localdata = base64_decode( $localdata );
- $localkeyresults = unserialize( $localdata );
- $originalcheckdate = $localkeyresults['checkdate'];
- if ($md5hash == md5( $originalcheckdate . $licensing_secret_key )) {
- $localexpiry = date( 'Ymd', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - $localkeydays, date( 'Y' ) ) );
- if ($localexpiry < $originalcheckdate) {
- $localkeyvalid = true;
- $results = $localkeyresults;
- $validdomains = explode( ',', $results['validdomain'] );
- if (!in_array( $_SERVER['SERVER_NAME'], $validdomains )) {
- $localkeyvalid = false;
- $localkeyresults['status'] = 'Invalid';
- $results = array( );
- }
- $validips = explode( ',', $results['validip'] );
- if (!in_array( $usersip, $validips )) {
- $localkeyvalid = false;
- $localkeyresults['status'] = 'Invalid';
- $results = array( );
- }
- if ($results['validdirectory'] != dirname( __FILE__ )) {
- $localkeyvalid = false;
- $localkeyresults['status'] = 'Invalid';
- $results = array( );
- }
- }
- }
- }
- }
- if (!$localkeyvalid) {
- $postfields['licensekey'] = $licensekey;
- $postfields['domain'] = $_SERVER['SERVER_NAME'];
- $postfields['ip'] = $usersip;
- $postfields['dir'] = dirname( __FILE__ );
- if ($check_token) {
- $postfields['check_token'] = $check_token;
- }
- if (function_exists( 'curl_exec' )) {
- $ch = curl_init( );
- curl_setopt( $ch, CURLOPT_URL, $whmcsurl . 'modules/servers/licensing/verify.php' );
- curl_setopt( $ch, CURLOPT_POST, 1 );
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $postfields );
- curl_setopt( $ch, CURLOPT_TIMEOUT, 30 );
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
- $data = curl_exec( $ch );
- curl_close( $ch );
- } else {
- $fp = fsockopen( $whmcsurl, 80, $errno, $errstr, 5 );
- if ($fp) {
- $querystring = '';
- foreach ($postfields as $k => $v) {
- $querystring .= '' . $k . '=' . urlencode( $v ) . '&';
- }
- $header = 'POST ' . $whmcsurl . 'modules/servers/licensing/verify.php HTTP/1.0
- ';
- $header .= 'Host: ' . $whmcsurl . '
- ';
- $header .= 'Content-type: application/x-www-form-urlencoded
- ';
- $header .= 'Content-length: ' . @strlen( $querystring ) . '
- ';
- $header .= 'Connection: close
- ';
- $header .= $querystring;
- $data = '';
- @stream_set_timeout( $fp, 20 );
- @fputs( $fp, $header );
- $status = @socket_get_status( $fp );
- while (( !@feof( $fp ) && $status )) {
- $data .= @fgets( $fp, 1024 );
- $status = @socket_get_status( $fp );
- }
- @fclose( $fp );
- }
- }
- if (!$data) {
- $localexpiry = date( 'Ymd', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - ( $localkeydays + $allowcheckfaildays ), date( 'Y' ) ) );
- if ($localexpiry < $originalcheckdate) {
- $results = $localkeyresults;
- } else {
- $results['status'] = 'Invalid';
- $results['description'] = 'Remote Check Failed';
- return $results;
- }
- }
- preg_match_all( '/<(.*?)>([^<]+)<\/\1>/i', $data, $matches );
- $results = array( );
- foreach ($matches[1] as $k => $v) {
- $results[$v] = $matches[2][$k];
- }
- if ($results['md5hash']) {
- if ($results['md5hash'] != md5( $licensing_secret_key . $check_token )) {
- $results['status'] = 'Invalid';
- $results['description'] = 'MD5 Checksum Verification Failed';
- return $results;
- }
- }
- if ($results['status'] == 'Active') {
- $results['checkdate'] = $checkdate;
- $data_encoded = serialize( $results );
- $data_encoded = base64_encode( $data_encoded );
- $data_encoded = md5( $checkdate . $licensing_secret_key ) . $data_encoded;
- $data_encoded = strrev( $data_encoded );
- $data_encoded = $data_encoded . md5( $data_encoded . $licensing_secret_key );
- $data_encoded = wordwrap( $data_encoded, 80, '
- ', true );
- $results['localkey'] = $data_encoded;
- }
- $results['remotecheck'] = true;
- }
- unset( $postfields );
- unset( $data );
- unset( $matches );
- unset( $whmcsurl );
- unset( $licensing_secret_key );
- unset( $checkdate );
- unset( $usersip );
- unset( $localkeydays );
- unset( $allowcheckfaildays );
- unset( $md5hash );
- return $results;
- }
- function ovh_ConfigOptions() {
- if (!CheckLicense( )) {
- return null;
- }
- $configarray = array( 'Clientarea Services Buttons' => array( 'Type' => 'text', 'Size' => '50', 'Description' => '<br />
- Separate with commas EX : reboot,mrtg,rtm<br /><br />
- reboot = Reboot<br />
- netboot = Netboot<br />
- install = Reinstall<br />
- reverseipv4 = Reverse IPv4<br />
- reverseipv6 = Reverse IPv6<br />
- failover = IP Failover<br />
- ircfilter = IRC Filter<br />
- vmac = Virtual Mac for VPS<br />
- blockedip = Blocked IP addresses<br />
- mrtg = Graphs MRTG<br />
- rtm = Real Time Monitoring<br />
- history = Interventions History<br />
- <br />' ), 'Colsnum' => array( 'Type' => 'dropdown', 'Options' => '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15', 'Description' => '# of buttons per line' ), 'Clientarea Summary' => array( 'Type' => 'yesno', 'Description' => 'Show Client Area server summary' ), 'White Label' => array( 'Type' => 'yesno', 'Description' => 'Conceal any information that may be related to OVH' ), 'Hide Rescue NetBoots' => array( 'Type' => 'yesno', 'Description' => 'Hide vKVM, Rescue-pro and WinRescue' ), 'Debug Mode' => array( 'Type' => 'yesno', 'Description' => 'Show all errors for debug' ) );
- return $configarray;
- }
- function ovh_ClientArea($params) {
- if (!CheckLicense( )) {
- return null;
- }
- $sql = select_query( 'tblhosting', 'regdate,nextduedate,domainstatus,dedicatedip', array( 'id' => $params['serviceid'] ) );
- $data = mysql_fetch_array( $sql );
- require( dirname( realpath( __FILE__ ) ) . '/' . 'config.php' );
- global $_LANG;
- $ClientareaButtons = $params['configoption1'];
- $ButtonsColsnum = $params['configoption2'];
- $ClientareaSummary = $params['configoption3'];
- $WhiteLabel = $params['configoption4'];
- $HideRescueNetBoots = $params['configoption5'];
- $Debug = $params['configoption6'];
- $regdate = explode( '-', $data['regdate'] );
- $regdate = '' . $regdate['2'] . '/' . $regdate['1'] . '/' . $regdate['0'];
- if ($data['nextduedate'] == '0000-00-00') {
- $nextduedate = '-';
- } else {
- $nextduedate = explode( '-', $data['nextduedate'] );
- $nextduedate = '' . $nextduedate['2'] . '/' . $nextduedate['1'] . '/' . $nextduedate['0'];
- }
- $domain = $params['domain'];
- $customfields = $params['customfields'];
- $nic = $customfields['ovh_nic'];
- $nicpassword = $customfields['ovh_password'];
- $serveur = $customfields['ovh_hostname'];
- $ip = gethostbyname( $serveur );
- $id = $params['serviceid'];
- $clientsdetails = $params['clientsdetails'];
- $rebootbtn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="reboot" type="hidden" />
- <input name="a" value="reboot" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="reboot" type="image" src="images/icons/energy.gif" alt="' . $_LANG['srvReboot'] . '" title="' . $_LANG['srvReboot'] . '" value="reboot">
- <br />
- </div>' . $_LANG['srvReboot'] . '
- </div>
- </form>';
- $netbootbtn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;" align="center">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="netboot" type="hidden" />
- <input name="a" value="netboot" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="Netboot" type="image" src="images/icons/neat.gif" alt="' . $_LANG['srvNetboot'] . '" title="' . $_LANG['srvNetboot'] . '" value="Netboot">
- <br />
- </div>' . $_LANG['srvNetboot'] . '
- </div>
- </form>';
- $installbtn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="install" type="hidden" />
- <input name="a" value="install" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="install" type="image" src="images/icons/package-utilities.gif" alt="' . $_LANG['srvReinstall'] . '" title="' . $_LANG['srvReinstall'] . '" value="install">
- <br />
- </div>' . $_LANG['srvReinstall'] . '
- </div>
- </form>';
- $reverseipv4btn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="reverseipv4" type="hidden" />
- <input name="a" value="reverseipv4" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="reverseipv4" type="image" src="images/icons/reverse_ipv4.gif" alt="' . $_LANG['srvIpv4Reverse'] . '" title="' . $_LANG['srvIpv4Reverse'] . '" value="reverseipv4">
- <br />
- </div>' . $_LANG['srvIpv4Reverse'] . '
- </div>
- </form>';
- $reverseipv6btn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="reverseipv6" type="hidden" />
- <input name="a" value="reverseipv6" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="reverseipv6" type="image" src="images/icons/reverse_ipv6.gif" alt="' . $_LANG['srvIpv6Reverse'] . '" title="' . $_LANG['srvIpv6Reverse'] . '" value="reverseipv6">
- <br />
- </div>' . $_LANG['srvIpv6Reverse'] . '
- </div>
- </form>';
- $failoverbtn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="failover" type="hidden" />
- <input name="a" value="failover" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="failover" type="image" src="images/icons/extraip.gif" alt="' . $_LANG['srvIpFailOver'] . '" title="' . $_LANG['srvIpFailOver'] . '" value="failover">
- <br />
- </div>' . $_LANG['srvIpFailOver'] . '
- </div>
- </form>';
- $ircfilterbtn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="ircfilter" type="hidden" />
- <input name="a" value="ircfilter" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="ircfilter" type="image" src="images/icons/chat.gif" alt="' . $_LANG['srvIrcFilter'] . '" title="' . $_LANG['srvIrcFilter'] . '" value="ircfilter">
- <br />
- </div>' . $_LANG['srvIrcFilter'] . '
- </div>
- </form>';
- $vmacbtn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="vmac" type="hidden" />
- <input name="a" value="vmac" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="vmac" type="image" src="images/icons/virtuamac.gif" alt="' . $_LANG['srvVirtualMacForVPS'] . '" title="' . $_LANG['srvVirtualMacForVPS'] . '" value="vmac">
- <br />
- </div>' . $_LANG['srvVirtualMacForVPS'] . '
- </div>
- </form>';
- $blockedipbtn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="blockedip" type="hidden" />
- <input name="a" value="blockedip" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="BlockedIp" type="image" src="images/icons/mx.gif" alt="' . $_LANG['srvBlockedIpAddresses'] . '" title="' . $_LANG['srvBlockedIpAddresses'] . '" value="BlockedIp">
- <br />
- </div>' . $_LANG['srvBlockedIpAddresses'] . '
- </div>
- </form>';
- $mrtgbtn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="mrtg" type="hidden" />
- <input name="a" value="mrtg" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="mrtg" type="image" src="images/icons/kchart.gif" alt="' . $_LANG['srvMrtgGraphs'] . '" title="' . $_LANG['srvMrtgGraphs'] . '" value="mrtg">
- <br />
- </div>' . $_LANG['srvMrtgGraphs'] . '
- </div>
- </form>';
- $rtmbtn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="rtm" type="hidden" />
- <input name="a" value="rtm" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="rtm" type="image" src="images/icons/rtm.gif" alt="' . $_LANG['srvRtm'] . '" title="' . $_LANG['srvRtm'] . '" value="rtm">
- <br />
- </div>' . $_LANG['srvRtm'] . '
- </div>
- </form>';
- $historybtn = ' <form action="clientarea.php?action=productdetails" method="post">
- <div style="margin:10px;">
- <div style="text-align:center;width:80px;">
- <input name="id" value="' . $id . '" type="hidden" />
- <input name="do" value="history" type="hidden" />
- <input name="a" value="history" type="hidden" />
- <input name="modop" value="custom" type="hidden" />
- <input name="history" type="image" src="images/icons/summary.gif" alt="' . $_LANG['srvHistory'] . '" title="' . $_LANG['srvHistory'] . '" value="history">
- <br />
- </div>' . $_LANG['srvHistory'] . '
- </div>
- </form>';
- $btnallow = explode( ',', $ClientareaButtons );
- if (empty( $_POST['do'] )) {
- $code = '';
- if ($ClientareaSummary == 'on') {
- $soap = new SoapClient( 'https://www.ovh.com/soapi/soapi-re-1.24.wsdl' );
- $session = $soap->login( '' . $nic, '' . $nicpassword, 'en', false );
- $resultinfo = $soap->dedicatedInfo( $session, $serveur );
- $resultrev = $soap->dedicatedReverseList( $session, $serveur );
- $resultnetboot = $soap->dedicatedNetbootInfo( $session, $serveur );
- if ($resultnetboot->kernel == 'hd') {
- $netboot = $_LANG['srvHd'];
- $netboot1 = $_LANG['srvDesabled'];
- } else {
- $netboot = $resultnetboot->kernel;
- $netboot1 = $_LANG['srvEnabled'];
- }
- $Quota = $resultinfo->traffic->monthlyQuota;
- if (empty( $Quota )) {
- $Quota = $_LANG['srvUnlimited'];
- }
- if ($resultinfo->network->connexion == 100000) {
- $conex = '100 Mbps';
- } else {
- if ($resultinfo->network->connexion == 1000000) {
- $conex = '1 Gbps';
- } else {
- if ($resultinfo->network->connexion == 10000000) {
- $conex = '10 Gbps';
- } else {
- $conex = $resultinfo->network->connexion . ' Kbps';
- }
- }
- }
- if ($resultinfo->network->bandwidthOvhToOvh == 100000) {
- $htoh = '100 Mbps';
- } else {
- if ($resultinfo->network->bandwidthOvhToOvh == 200000) {
- $htoh = '200 Mbps';
- } else {
- if ($resultinfo->network->bandwidthOvhToOvh == 1000000) {
- $htoh = '1 Gbps';
- } else {
- $htoh = $resultinfo->network->bandwidthOvhToOvh . ' Kbps';
- }
- }
- }
- if ($resultinfo->network->bandwidthOvhToInternet == 100000) {
- $htoi = '100 Mbps';
- } else {
- if ($resultinfo->network->bandwidthOvhToInternet == 200000) {
- $htoi = '200 Mbps';
- } else {
- if ($resultinfo->network->bandwidthOvhToInternet == 10000000) {
- $htoi = '1 Gbps';
- } else {
- $htoi = $resultinfo->network->bandwidthOvhToInternet . ' Kbps';
- }
- }
- }
- if ($resultinfo->network->bandwidthInternetToOvh == 100000) {
- $itoh = '100 Mbps';
- } else {
- if ($resultinfo->network->bandwidthInternetToOvh == 1000000) {
- $itoh = '1 Gbps';
- } else {
- $itoh = $resultinfo->network->bandwidthInternetToOvh . ' Kbps';
- }
- }
- $i = 59;
- while ($resultinfo->network->interfaces[$i]) {
- if ($i == 0) {
- $Switch = $resultinfo->network->interfaces[$i]->switch;
- $Mac = $resultinfo->network->interfaces[$i]->mac;
- $IP = $resultinfo->network->interfaces[$i]->ip;
- $Reverse = $resultinfo->network->interfaces[$i]->reverse;
- if (( $WhiteLabel == 'on' && preg_match( '' . '/^[a-zA-Z0-9\-\_\.]+(ovh|kimsufi)\.[a-zA-Z]{2,4}$/', '' . $Reverse ) )) {
- $Reverse = $_LANG['srvIpFailOverRedefineReverse'];
- }
- $IPV6 = $resultinfo->network->interfaces[$i]->ipv6;
- }
- ++$i;
- $nb = $i - 1;
- }
- .........................
- ................
- ....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement