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 SourceGuardian & phpSHIELD)
- *
- * @ Version : 1.1.5.0
- * @ Author : DeZender
- * @ Release on : 09.06.2012
- * @ Official site : http://DeZender.Net
- *
- */
- class usersOnline {
- var $timeout = 600;
- var $count = 0;
- var $error = null;
- var $i = 0;
- function __construct() {
- $this->timestamp = time( );
- $this->ip = $this->ipCheck( );
- $this->new_user( );
- $this->delete_user( );
- $this->count_users( );
- }
- function ipCheck() {
- if (getenv( 'HTTP_CLIENT_IP' )) {
- $ip = getenv( 'HTTP_CLIENT_IP' );
- } else {
- if (getenv( 'HTTP_X_FORWARDED_FOR' )) {
- $ip = getenv( 'HTTP_X_FORWARDED_FOR' );
- } else {
- if (getenv( 'HTTP_X_FORWARDED' )) {
- $ip = getenv( 'HTTP_X_FORWARDED' );
- } else {
- if (getenv( 'HTTP_FORWARDED_FOR' )) {
- $ip = getenv( 'HTTP_FORWARDED_FOR' );
- } else {
- if (getenv( 'HTTP_FORWARDED' )) {
- $ip = getenv( 'HTTP_FORWARDED' );
- } else {
- $ip = $_SERVER['REMOTE_ADDR'];
- }
- }
- }
- }
- }
- return $ip;
- }
- function new_user() {
- $insert = mysql_query( 'INSERT INTO th_useronline(timestamp, ip) VALUES (\'' . $this->timestamp . '\', \'' . $this->ip . '\')' );
- if (!$insert) {
- $this->error[$this->i] = 'Unable to record new visitor
- ';
- $this->i++;
- }
- }
- function delete_user() {
- $delete = mysql_query( ( 'DELETE FROM th_useronline WHERE timestamp < (' . $this->timestamp . ' - ' . $this->timeout . ')' ) );
- if (!$delete) {
- $this->error[$this->i] = 'Unable to delete visitors';
- $this->i++;
- }
- }
- function count_users() {
- if (count( $this->error ) == 0) {
- $count = mysql_num_rows( mysql_query( 'SELECT DISTINCT ip FROM th_useronline' ) );
- return $count;
- }
- }
- }
- function getrefdetails() {
- $q = mysql_query( 'select username,email,regdate from th_users where uplineid=' . $_SESSION['t_loggeduserid'] . '' );
- $d = '
- <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tablestyle1" >
- <tr>
- <td width="20%" height="37" align="center" valign="middle" class="boxtop2">Username</td>
- <td width="21%" align="center" valign="middle" class="boxtop2">Email</td>
- <td width="23%" align="center" valign="middle" class="boxtop2">Registered On</td>
- </tr>';
- if (0 < mysql_num_rows( $q )) {
- while ($r = mysql_fetch_array( $q )) {
- $d .= '
- <tr>
- <td align="center" valign="middle" class="tdstyle1">' . $r['username'] . '</td>
- <td align="center" valign="middle" class="tdstyle1">' . $r['email'] . '</td>
- <td align="center" valign="middle" class="tdstyle1">' . date( 'F,j Y', strtotime( $r['regdate'] ) ) . '</td>
- </tr>
- ';
- }
- } else {
- $d .= ' <tr>
- <td align="center" colspan=3 valign="middle" class="tdstyle1">Sorry,None Found</td>
- </tr>';
- }
- $d .= '</table>';
- return $d;
- }
- function hotannounce() {
- if (( ( checkset( 2001 ) && mca( ) ) && !$_SESSION['hotannounce'] )) {
- $message = getset( 2001 );
- echo '<script type=\'text/javascript\'>$.prompt("' . addslashes( $message ) . '");</script>';
- $_SESSION['hotannounce'] = 'set';
- }
- }
- function encrypt($string) {
- $iv_size = mcrypt_get_iv_size( MCRYPT_BLOWFISH, MCRYPT_MODE_ECB );
- $iv = mcrypt_create_iv( $iv_size, MCRYPT_RAND );
- return mcrypt_encrypt( MCRYPT_BLOWFISH, KRYPT_KEY, $string, MCRYPT_MODE_ECB, $iv );
- }
- function decrypt($crypttext) {
- $iv_size = mcrypt_get_iv_size( MCRYPT_BLOWFISH, MCRYPT_MODE_ECB );
- $iv = mcrypt_create_iv( $iv_size, MCRYPT_RAND );
- return mcrypt_decrypt( MCRYPT_BLOWFISH, KRYPT_KEY, $crypttext, MCRYPT_MODE_ECB, $iv );
- }
- function formatdec($num, $decplaces) {
- $fnum = substr( $num, 0, strpos( $num, '.' ) + $decplaces + 1 );
- return $fnum;
- }
- function checkauto() {
- $error = false;
- $q = mysql_query( 'select u_a_w from th_admin where id=1' );
- $uaw = mysql_result( $q, 0, 'u_a_w' );
- if (!$uaw) {
- $error = true;
- }
- $q = mysql_query( 'select autowith from th_users where userid=' . $_SESSION['t_loggeduserid'] . '' );
- $auto = mysql_result( $q, 0, 'autowith' );
- if (!$auto) {
- $error = true;
- }
- if (!$error) {
- return true;
- } else {
- return false;
- }
- }
- function getinvplans() {
- $plans = getall( 'plans' );
- if ($plans != 0) {
- for ($i = 0; $i < count( $plans ); $i++) {
- echo '<table width="100%" height="104" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td height="26" colspan="3" class="title1">' . $plans[$i]['planname'] . '</td>
- <td height="26" align="right" class="color1"> </td>
- </tr>
- <tr>
- <td width="30%" height="26" align="center" valign="middle" class="boxtop2">Amout Range</td>
- <td width="19%" align="center" valign="middle" class="boxtop2">Percent(%)</td>
- <td width="24%" align="center" valign="middle" class="boxtop2">Cashout Term</td>
- <td width="27%" align="center" valign="middle" class="boxtop2">Total Duration</td>
- </tr>';
- $q = mysql_query( 'select * from th_planterms where parentid=' . $plans[$i]['planid'] . ' and status="Active"' );
- while ($r = mysql_fetch_array( $q )) {
- echo '
- <tr>
- <td height="26" align="center" valign="middle" class="tdstyle1">' . $r['termsmin'] . ' - ' . $r['termsmax'] . '</td>
- <td align="center" valign="middle" class="tdstyle1">';
- if ($plans[$i]['termstype'] == 'Variable') {
- echo $r['termsminp'] . ' - ' . $r['termsmaxp'];
- } else {
- echo $r['percent'];
- }
- echo '
- </td>
- <td align="center" valign="middle" class="tdstyle1">' . $plans[$i]['cashouttype'] . '</td>
- <td align="center" valign="middle" class="tdstyle1">' . $plans[$i]['totperiod'] . ' ' . $plans[$i]['termunit'] . '</td>
- </tr>';
- }
- echo '
- <tr>
- <td height="26" colspan="4" align="center" class="tdstyle1">
- ';
- if ($plans[$i]['retprincipal']) {
- echo '<font color=\'green\'>Principal is Returned</font>';
- } else {
- echo '<font color=\'red\'>Prinicipal is Not Returned</font>';
- }
- echo '</td></tr></table>';
- }
- } else {
- echo '<p><font color=red>No Plans Yet</font></p>';
- }
- }
- function cron() {
- if (checkset( 981 )) {
- $q = mysql_query( 'select * from th_crontab' );
- if (mysql_num_rows( $q ) == 0) {
- runcron( );
- mysql_query( 'insert into th_crontab(ctime)values(NOW())' );
- } else {
- $q = @mysql_query( 'select NOW() as curdatetime,(select ctime from th_crontab order by id DESC LIMIT 1) as lastdatetime' );
- $curdatetime = strtotime( mysql_result( $q, 0, 'curdatetime' ) );
- $lastdatetime = strtotime( mysql_result( $q, 0, 'lastdatetime' ) );
- switch (getset( 982 )) {
- case 'Hourly': {
- if (3600 < $curdatetime - $lastdatetime) {
- runcron( );
- mysql_query( 'insert into th_crontab(ctime)values(NOW())' );
- }
- break;
- }
- case 'Daily': {
- if (86400 < $curdatetime - $lastdatetime) {
- runcron( );
- mysql_query( 'insert into th_crontab(ctime)values(NOW())' );
- }
- break;
- }
- case 'Weekly': {
- if (604800 < $curdatetime - $lastdatetime) {
- runcron( );
- mysql_query( 'insert into th_crontab(ctime)values(NOW())' );
- }
- break;
- }
- case 'Monthly': {
- if (2592000 < $curdatetime - $lastdatetime) {
- runcron( );
- mysql_query( 'insert into th_crontab(ctime)values(NOW())' );
- }
- break;
- }
- }
- }
- }
- return false;
- }
- function runcron() {
- date_default_timezone_set( 'UTC' );
- $act_deposits = @mysql_query( 'select * from th_deposits where status=1 order by id' );
- if (0 < mysql_num_rows( $act_deposits )) {
- while ($act_deposit = @mysql_fetch_array( $act_deposits )) {
- $depositid = $act_deposit['id'];
- $paycount = $act_deposit['paycount'];
- $a_amount = $act_deposit['a_amount'];
- $amount = $act_deposit['amount'];
- $ecurrid = $act_deposit['ecurrid'];
- $currid = $act_deposit['currid'];
- $userid = $act_deposit['user_id'];
- $depdate = $act_deposit['dep_date'];
- $lastpaydate = $act_deposit['lastpay_date'];
- $compval = $act_deposit['compound'];
- $currname = getdatabyid( 'th_currs', 'cid=' . $currid, 'c_name' );
- $act_dep_plan = @mysql_query( 'select * from th_plans where planid=' . $act_deposit['plan_id'] . '' );
- $cashouttype = @mysql_result( $act_dep_plan, 0, 'cashouttype' );
- $retprincipal = @mysql_result( $act_dep_plan, 0, 'retprincipal' );
- $earningmonfri = @mysql_result( $act_dep_plan, 0, 'earningmonfri' );
- $termunit = @mysql_result( $act_dep_plan, 0, 'termunit' );
- $totduration = @mysql_result( $act_dep_plan, 0, 'totperiod' );
- $allowcomp = @mysql_result( $act_dep_plan, 0, 'allowcomp' );
- $planexpdur = @mysql_result( $act_dep_plan, 0, 'planexpdur' );
- if (( $planexpdur == 'Limited' && $totduration <= $paycount )) {
- @mysql_query( 'update th_deposits set status=0 where id=' . $act_deposit['id'] . '' );
- exit( );
- }
- $holidays = explode( ',', @mysql_result( $act_dep_plan, 0, 'holidays' ) );
- $dep_timestamp = strtotime( $depdate );
- if (( $earningmonfri && $planexpdur == 'Limited' )) {
- $last_timestamp = get_last_timestamp( $dep_timestamp, $totduration, $holidays, $termunit, $cashouttype, 'Business' );
- } else {
- $last_timestamp = get_last_timestamp( $dep_timestamp, $totduration, $holidays, $termunit, $cashouttype, 'Non-Business' );
- }
- if ($cashouttype == 'At Plan Expiry') {
- if ($last_timestamp <= $cur_timestamp) {
- $earndate = date( 'Y-m-d h:i:s', $last_timestamp );
- $type1 = 'Earning';
- $cpaycount = getdatabyid( 'th_deposits', 'id=' . $act_deposit['id'], 'paycount' ) + 1;
- $lpaydate = date( 'Y-m-d h:i:s', $endtstamp );
- $pprofit = $percent / 100 * $a_amount;
- $earning = $pprofit - $compval / 100 * $pprofit;
- $desc = 'Earning from ' . $a_amount . ' ' . $currname . ' Deposit at ' . $percent . '%';
- $hash = genshahash( $userid . $earning . $currid . $ecurrid . $type1 . $earndate );
- mysql_query( 'insert into th_history(user_id,amount,a_amount,hdesc,ecurrid,currid,type,date,hash,dep_id)values
- (' . $userid . ',' . $earning . ',' . $earning . ',\'' . $desc . '\',' . $ecurrid . ',' . $currid . ',\'' . $type1 . '\',\'' . $earndate . '\'
- ,\'' . $hash . '\',' . $act_deposit['id'] . ')' );
- mysql_query( 'update th_deposits set lastpay_date=' . date( 'Y-m-d h:i:s', $last_timestamp ) . ' where id=' . $act_deposit['id'] . '' );
- if ($retprincipal == 1) {
- $a_amount = getdatabyid( 'th_deposits', 'id=' . $act_deposit['id'], 'a_amount' );
- $earndate = date( 'Y-m-d h:i:s', $endtstamp );
- $desc = 'Return Principal of ' . $a_amount . ' ' . $currname . ' Deposit';
- $type1 = 'Return_Principal';
- $hash = genshahash( $userid . $a_amount . $currid . $ecurrid . $type1 . $earndate );
- $q4 = 'insert into th_history(user_id,amount,a_amount,hdesc,ecurrid,currid,type,date,hash,dep_id)values
- (' . $userid . ',' . $a_amount . ',' . $a_amount . ',\'' . $desc . '\',' . $ecurrid . ',' . $currid . ',\'' . $type1 . '\',\'' . $earndate . '\'
- ,\'' . $hash . '\',' . $act_deposit['id'] . ')';
- if (!@mysql_query( $q4 )) {
- $error = true;
- }
- @mysql_query( 'update th_deposits set status=0 where id=' . $act_deposit['id'] . '' );
- break;
- }
- @mysql_query( 'update th_deposits set status=0 where id=' . $act_deposit['id'] . '' );
- }
- } else {
- $now = strtotime( date( 'Y-m-d h:i:s', time( ) ) );
- if ($planexpdur == 'Limited') {
- $cur_timestamp = ($last_timestamp <= $now ? $last_timestamp : $now);
- } else {
- $cur_timestamp = $now;
- }
- if ($lastpaydate == 0) {
- $startdate = $dep_timestamp;
- } else {
- $startdate = strtotime( $lastpaydate );
- }
- if ($earningmonfri) {
- $type = 'Business';
- } else {
- $type = 'Non-Business';
- }
- $paydates = get_all_paydates( $startdate, $cur_timestamp, $holidays, $termunit, $cashouttype, $type );
- for ($i = 0; $i < count( $paydates ); $i++) {
- $percent = getprofit( $act_deposit['plan_id'], $amount, 'numeric', $paydates[$i] );
- $tquery = mysql_query( 'select * from th_deposits where id=' . $act_deposit['id'] . '' );
- $a_amount = mysql_result( $tquery, 0, 'a_amount' );
- $paycount = mysql_result( $tquery, 0, 'paycount' );
- $t_earning = $percent / 100 * $a_amount;
- $compamount = $compval / 100 * $t_earning;
- if (( ( $allowcomp && $compval != 0 ) && $paydates[$i] == $last_timestamp )) {
- $compamount = 0;
- }
- $earning = $t_earning - $compamount;
- $earndate = date( 'Y-m-d h:i:s', $paydates[$i] );
- $type1 = 'Earning';
- $cpaycount = getdatabyid( 'th_deposits', 'id=' . $act_deposit['id'], 'paycount' ) + 1;
- $lpaydate = date( 'Y-m-d h:i:s', $i );
- $desc = 'Earning from ' . $a_amount . ' ' . $currname . ' Deposit at ' . $percent . '%';
- $hash = genshahash( $userid . $earning . $currid . $ecurrid . $type1 . $earndate );
- mysql_query( 'insert into th_history(user_id,amount,a_amount,hdesc,ecurrid,currid,type,date,hash,dep_id)values
- (' . $userid . ',' . $earning . ',' . $earning . ',\'' . $desc . '\',' . $ecurrid . ',' . $currid . ',\'' . $type1 . '\',\'' . $earndate . '\'
- ,\'' . $hash . '\',' . $act_deposit['id'] . ')' );
- mysql_query( 'update th_deposits set paycount=' . $cpaycount . ',lastpay_date=\'' . date( 'Y-m-d h:i:s', $paydates[$i] ) . '\' where id=' . $act_deposit['id'] . '' );
- if (( ( $allowcomp && $compval != 0 ) && $paydates[$i] != $last_timestamp )) {
- @mysql_query( 'update th_deposits set a_amount=a_amount+' . $compamount . ' where id=' . $act_deposit['id'] . '' );
- }
- }
- if (( ( $retprincipal == 1 && $cur_timestamp == $last_timestamp ) && $planexpdur == 'Limited' )) {
- $a_amount = getdatabyid( 'th_deposits', 'id=' . $act_deposit['id'], 'a_amount' );
- $earndate = date( 'Y-m-d h:i:s', $last_timestamp );
- $desc = 'Return Principal of ' . $a_amount . ' ' . $currname . ' Deposit';
- $type1 = 'Return_Principal';
- $hash = genshahash( $userid . $a_amount . $currid . $ecurrid . $type1 . $earndate );
- $q4 = 'insert into th_history(user_id,amount,a_amount,hdesc,ecurrid,currid,type,date,hash,dep_id)values
- (' . $userid . ',' . $a_amount . ',' . $a_amount . ',\'' . $desc . '\',' . $ecurrid . ',' . $currid . ',\'' . $type1 . '\',\'' . $earndate . '\'
- ,\'' . $hash . '\',' . $act_deposit['id'] . ')';
- if (!@mysql_query( $q4 )) {
- $error = true;
- }
- @mysql_query( 'update th_deposits set status=0 where id=' . $act_deposit['id'] . '' );
- break;
- }
- if ($last_timestamp <= $now) {
- @mysql_query( 'update th_deposits set status=0 where id=' . $act_deposit['id'] . '' );
- }
- }
- }
- }
- }
- function getrefclicks($type, $period) {
- if ($type == 'M') {
- switch ($period) {
- case 'D': {
- $q = mysql_query( 'select count(userid) as res from th_users where regdate=CURDATE() and uplineid=' . $_SESSION['t_loggeduserid'] . '' );
- break;
- }
- case 'W': {
- $q = mysql_query( 'select count(userid) as res from th_users where WEEK(regdate)=WEEK(CURDATE()) and uplineid=' . $_SESSION['t_loggeduserid'] . '' );
- break;
- }
- case 'M': {
- $q = mysql_query( 'select count(userid) as res from th_users where MONTH(regdate)=MONTH(CURDATE()) and uplineid=' . $_SESSION['t_loggeduserid'] . '' );
- break;
- }
- case 'Y': {
- $q = mysql_query( 'select count(userid) as res from th_users where YEAR(regdate)=YEAR(CURDATE()) and uplineid=' . $_SESSION['t_loggeduserid'] . '' );
- break;
- }
- }
- }
- if ($type == 'V') {
- switch ($period) {
- case 'D': {
- $q = mysql_query( 'select count(userid) as res from th_refclicks where rdate=CURDATE() and userid=' . $_SESSION['t_loggeduserid'] . '' );
- break;
- }
- case 'W': {
- $q = mysql_query( 'select count(userid) as res from th_refclicks where WEEK(rdate)=WEEK(CURDATE()) and userid=' . $_SESSION['t_loggeduserid'] . '' );
- break;
- }
- case 'M': {
- $q = mysql_query( 'select count(userid) as res from th_refclicks where MONTH(rdate)=MONTH(CURDATE()) and userid=' . $_SESSION['t_loggeduserid'] . '' );
- break;
- }
- case 'Y': {
- $q = mysql_query( 'select count(userid) as res from th_refclicks where YEAR(rdate)=YEAR(CURDATE()) and userid=' . $_SESSION['t_loggeduserid'] . '' );
- break;
- }
- }
- }
- $res = mysql_result( $q, 0, 'res' );
- return $res;
- }
- function showinfo($type) {
- switch ($type) {
- case 'top10invest': {
- $d = '<table width="500" border="0" cellpadding="0" cellspacing="1" >
- <tr>
- <td width="25%" height="30" colspan=3 align="center" valign=middle class="boxtop2"><strong>TOP 10 INVESTORS</strong></td>
- </tr>
- <tr>
- <td width="25%" height="23" align="center" class="boxtop2" valign=middle>Username</td>
- <td width="25%" align="center" class="boxtop2" valign=middle>Total Invested(USD/EUR)</td>
- </tr>
- ';
- $q = mysql_query( 'select user_id,abs(sum(a_amount)) as sumamnt from th_deposits group by user_id order by sumamnt desc LIMIT 10' );
- while ($r = mysql_fetch_array( $q )) {
- $d .= ' <tr>
- <td height="23" align="center" class="tdstyle1">' . getdatabyid( 'th_users', 'userid=' . $r['user_id'], 'username' ) . '</td>
- <td align="center" class="tdstyle1">' . $r['sumamnt'] . '</td>
- </tr>';
- }
- $d .= '</table>';
- break;
- }
- case 'last10invest': {
- $d = '<table width="500" border="0" cellpadding="0" cellspacing="1" >
- <tr>
- <td width="25%" height="30" colspan=3 align="center" valign=middle class="boxtop2"><strong>LAST 10 INVESTORS</strong></td>
- </tr>
- <tr>
- <td width="25%" height="23" align="center" class="boxtop2" valign=middle>Username</td>
- <td width="25%" align="center" class="boxtop2" valign=middle>Total Invested(USD/EUR)</td>
- </tr>
- ';
- $q = mysql_query( 'select user_id,abs(sum(a_amount)) as sumamnt from th_deposits group by user_id order by sumamnt asc LIMIT 10' );
- while ($r = mysql_fetch_array( $q )) {
- $d .= ' <tr>
- <td height="23" align="center" class="tdstyle1">' . getdatabyid( 'th_users', 'userid=' . $r['user_id'], 'username' ) . '</td>
- <td align="center" class="tdstyle1">' . $r['sumamnt'] . '</td>
- </tr>';
- }
- $d .= '</table>';
- break;
- }
- case 'top10ref': {
- $d = '<table width="500" border="0" cellpadding="0" cellspacing="1" >
- <tr>
- <td width="25%" height="30" colspan=3 align="center" valign=middle class="boxtop2"><strong>TOP 10 REFERRERS</strong></td>
- </tr>
- <tr>
- <td width="25%" height="23" align="center" class="boxtop2" valign=middle>Username</td>
- <td width="25%" align="center" class="boxtop2" valign=middle>Total Referrals</td>
- </tr>
- ';
- $q = mysql_query( 'select uplineid,count(uplineid) as totref from th_users where uplineid!=0 group by uplineid order by totref desc LIMIT 10' );
- while ($r = mysql_fetch_array( $q )) {
- $d .= ' <tr>
- <td height="23" align="center" class="tdstyle1">' . $r['uplineid'] . '</td>
- <td align="center" class="tdstyle1">' . $r['totref'] . '</td>
- </tr>';
- }
- $d .= '</table>';
- break;
- }
- case 'last10pay': {
- $d = '<table width="500" border="0" cellpadding="0" cellspacing="1" >
- <tr>
- <td width="25%" height="30" colspan=3 align="center" valign=middle class="boxtop2"><strong>LAST 10 PAYOUTS</strong></td>
- </tr>
- <tr>
- <td width="25%" height="23" align="center" class="boxtop2" valign=middle>Username</td>
- <td width="25%" align="center" class="boxtop2" valign=middle>Amount</td>
- <td width="25%" align="center" class="boxtop2" valign=middle>Payment Processor</td>
- </tr>
- ';
- $q = mysql_query( 'select date,user_id,amount,ecurrid from th_history where type=\'Processed_Withdrawal\' order by id desc LIMIT 10' );
- if (@mysql_num_rows( $q )) {
- while ($r = mysql_fetch_array( $q )) {
- $d .= ' <tr>
- <td height="23" align="center" class="tdstyle1">' . getdatabyid( 'th_users', 'userid=' . $r['user_id'], 'username' ) . '</td>
- <td align="center" class="tdstyle1">' . number_format( abs( $r['amount'] ), 2 ) . '</td>
- <td align="center" class="tdstyle1">' . getdatabyid( 'th_pps', 'ppid=' . $r['ecurrid'], 'ppreal' ) . '</td>
- </tr>';
- }
- } else {
- $d .= '<tr><td colspan=3>Sorry,None Found</td></tr>';
- }
- $d .= '</table>';
- break;
- }
- }
- return $d;
- }
- ...................................................................
- ............................................
- ...................
Advertisement
Add Comment
Please, Sign In to add comment