Guest User

Untitled

a guest
Oct 20th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.20 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for SourceGuardian & phpSHIELD)
  6. *
  7. * @ Version : 1.1.5.0
  8. * @ Author : DeZender
  9. * @ Release on : 09.06.2012
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class usersOnline {
  15. var $timeout = 600;
  16. var $count = 0;
  17. var $error = null;
  18. var $i = 0;
  19.  
  20. function __construct() {
  21. $this->timestamp = time( );
  22. $this->ip = $this->ipCheck( );
  23. $this->new_user( );
  24. $this->delete_user( );
  25. $this->count_users( );
  26. }
  27.  
  28. function ipCheck() {
  29. if (getenv( 'HTTP_CLIENT_IP' )) {
  30. $ip = getenv( 'HTTP_CLIENT_IP' );
  31. } else {
  32. if (getenv( 'HTTP_X_FORWARDED_FOR' )) {
  33. $ip = getenv( 'HTTP_X_FORWARDED_FOR' );
  34. } else {
  35. if (getenv( 'HTTP_X_FORWARDED' )) {
  36. $ip = getenv( 'HTTP_X_FORWARDED' );
  37. } else {
  38. if (getenv( 'HTTP_FORWARDED_FOR' )) {
  39. $ip = getenv( 'HTTP_FORWARDED_FOR' );
  40. } else {
  41. if (getenv( 'HTTP_FORWARDED' )) {
  42. $ip = getenv( 'HTTP_FORWARDED' );
  43. } else {
  44. $ip = $_SERVER['REMOTE_ADDR'];
  45. }
  46. }
  47. }
  48. }
  49. }
  50.  
  51. return $ip;
  52. }
  53.  
  54. function new_user() {
  55. $insert = mysql_query( 'INSERT INTO th_useronline(timestamp, ip) VALUES (\'' . $this->timestamp . '\', \'' . $this->ip . '\')' );
  56.  
  57. if (!$insert) {
  58. $this->error[$this->i] = 'Unable to record new visitor
  59. ';
  60. $this->i++;
  61. }
  62.  
  63. }
  64.  
  65. function delete_user() {
  66. $delete = mysql_query( ( 'DELETE FROM th_useronline WHERE timestamp < (' . $this->timestamp . ' - ' . $this->timeout . ')' ) );
  67.  
  68. if (!$delete) {
  69. $this->error[$this->i] = 'Unable to delete visitors';
  70. $this->i++;
  71. }
  72.  
  73. }
  74.  
  75. function count_users() {
  76. if (count( $this->error ) == 0) {
  77. $count = mysql_num_rows( mysql_query( 'SELECT DISTINCT ip FROM th_useronline' ) );
  78. return $count;
  79. }
  80.  
  81. }
  82. }
  83.  
  84. function getrefdetails() {
  85. $q = mysql_query( 'select username,email,regdate from th_users where uplineid=' . $_SESSION['t_loggeduserid'] . '' );
  86. $d = '
  87. <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tablestyle1" >
  88.  
  89. <tr>
  90. <td width="20%" height="37" align="center" valign="middle" class="boxtop2">Username</td>
  91. <td width="21%" align="center" valign="middle" class="boxtop2">Email</td>
  92. <td width="23%" align="center" valign="middle" class="boxtop2">Registered On</td>
  93. </tr>';
  94.  
  95. if (0 < mysql_num_rows( $q )) {
  96. while ($r = mysql_fetch_array( $q )) {
  97. $d .= '
  98. <tr>
  99. <td align="center" valign="middle" class="tdstyle1">' . $r['username'] . '</td>
  100. <td align="center" valign="middle" class="tdstyle1">' . $r['email'] . '</td>
  101. <td align="center" valign="middle" class="tdstyle1">' . date( 'F,j Y', strtotime( $r['regdate'] ) ) . '</td>
  102. </tr>
  103. ';
  104. }
  105. } else {
  106. $d .= ' <tr>
  107. <td align="center" colspan=3 valign="middle" class="tdstyle1">Sorry,None Found</td>
  108.  
  109. </tr>';
  110. }
  111.  
  112. $d .= '</table>';
  113. return $d;
  114. }
  115.  
  116. function hotannounce() {
  117. if (( ( checkset( 2001 ) && mca( ) ) && !$_SESSION['hotannounce'] )) {
  118. $message = getset( 2001 );
  119. echo '<script type=\'text/javascript\'>$.prompt("' . addslashes( $message ) . '");</script>';
  120. $_SESSION['hotannounce'] = 'set';
  121. }
  122.  
  123. }
  124.  
  125. function encrypt($string) {
  126. $iv_size = mcrypt_get_iv_size( MCRYPT_BLOWFISH, MCRYPT_MODE_ECB );
  127. $iv = mcrypt_create_iv( $iv_size, MCRYPT_RAND );
  128. return mcrypt_encrypt( MCRYPT_BLOWFISH, KRYPT_KEY, $string, MCRYPT_MODE_ECB, $iv );
  129. }
  130.  
  131. function decrypt($crypttext) {
  132. $iv_size = mcrypt_get_iv_size( MCRYPT_BLOWFISH, MCRYPT_MODE_ECB );
  133. $iv = mcrypt_create_iv( $iv_size, MCRYPT_RAND );
  134. return mcrypt_decrypt( MCRYPT_BLOWFISH, KRYPT_KEY, $crypttext, MCRYPT_MODE_ECB, $iv );
  135. }
  136.  
  137. function formatdec($num, $decplaces) {
  138. $fnum = substr( $num, 0, strpos( $num, '.' ) + $decplaces + 1 );
  139. return $fnum;
  140. }
  141.  
  142. function checkauto() {
  143. $error = false;
  144. $q = mysql_query( 'select u_a_w from th_admin where id=1' );
  145. $uaw = mysql_result( $q, 0, 'u_a_w' );
  146.  
  147. if (!$uaw) {
  148. $error = true;
  149. }
  150.  
  151. $q = mysql_query( 'select autowith from th_users where userid=' . $_SESSION['t_loggeduserid'] . '' );
  152. $auto = mysql_result( $q, 0, 'autowith' );
  153.  
  154. if (!$auto) {
  155. $error = true;
  156. }
  157.  
  158.  
  159. if (!$error) {
  160. return true;
  161. } else {
  162. return false;
  163. }
  164.  
  165. }
  166.  
  167. function getinvplans() {
  168. $plans = getall( 'plans' );
  169.  
  170. if ($plans != 0) {
  171. for ($i = 0; $i < count( $plans ); $i++) {
  172. echo '<table width="100%" height="104" border="0" cellpadding="0" cellspacing="0">
  173. <tr>
  174. <td height="26" colspan="3" class="title1">' . $plans[$i]['planname'] . '</td>
  175. <td height="26" align="right" class="color1">&nbsp;</td>
  176. </tr>
  177. <tr>
  178. <td width="30%" height="26" align="center" valign="middle" class="boxtop2">Amout Range</td>
  179. <td width="19%" align="center" valign="middle" class="boxtop2">Percent(%)</td>
  180. <td width="24%" align="center" valign="middle" class="boxtop2">Cashout Term</td>
  181. <td width="27%" align="center" valign="middle" class="boxtop2">Total Duration</td>
  182. </tr>';
  183. $q = mysql_query( 'select * from th_planterms where parentid=' . $plans[$i]['planid'] . ' and status="Active"' );
  184.  
  185. while ($r = mysql_fetch_array( $q )) {
  186. echo '
  187. <tr>
  188. <td height="26" align="center" valign="middle" class="tdstyle1">' . $r['termsmin'] . ' - ' . $r['termsmax'] . '</td>
  189. <td align="center" valign="middle" class="tdstyle1">';
  190.  
  191. if ($plans[$i]['termstype'] == 'Variable') {
  192. echo $r['termsminp'] . ' - ' . $r['termsmaxp'];
  193. } else {
  194. echo $r['percent'];
  195. }
  196.  
  197. echo '
  198.  
  199. </td>
  200. <td align="center" valign="middle" class="tdstyle1">' . $plans[$i]['cashouttype'] . '</td>
  201. <td align="center" valign="middle" class="tdstyle1">' . $plans[$i]['totperiod'] . ' ' . $plans[$i]['termunit'] . '</td>
  202. </tr>';
  203. }
  204.  
  205. echo '
  206. <tr>
  207. <td height="26" colspan="4" align="center" class="tdstyle1">
  208. ';
  209.  
  210. if ($plans[$i]['retprincipal']) {
  211. echo '<font color=\'green\'>Principal is Returned</font>';
  212. } else {
  213. echo '<font color=\'red\'>Prinicipal is Not Returned</font>';
  214. }
  215.  
  216. echo '</td></tr></table>';
  217. }
  218. } else {
  219. echo '<p><font color=red>No Plans Yet</font></p>';
  220. }
  221.  
  222. }
  223.  
  224. function cron() {
  225. if (checkset( 981 )) {
  226. $q = mysql_query( 'select * from th_crontab' );
  227.  
  228. if (mysql_num_rows( $q ) == 0) {
  229. runcron( );
  230. mysql_query( 'insert into th_crontab(ctime)values(NOW())' );
  231. } else {
  232. $q = @mysql_query( 'select NOW() as curdatetime,(select ctime from th_crontab order by id DESC LIMIT 1) as lastdatetime' );
  233. $curdatetime = strtotime( mysql_result( $q, 0, 'curdatetime' ) );
  234. $lastdatetime = strtotime( mysql_result( $q, 0, 'lastdatetime' ) );
  235. switch (getset( 982 )) {
  236. case 'Hourly': {
  237. if (3600 < $curdatetime - $lastdatetime) {
  238. runcron( );
  239. mysql_query( 'insert into th_crontab(ctime)values(NOW())' );
  240. }
  241.  
  242. break;
  243. }
  244.  
  245. case 'Daily': {
  246. if (86400 < $curdatetime - $lastdatetime) {
  247. runcron( );
  248. mysql_query( 'insert into th_crontab(ctime)values(NOW())' );
  249. }
  250.  
  251. break;
  252. }
  253.  
  254. case 'Weekly': {
  255. if (604800 < $curdatetime - $lastdatetime) {
  256. runcron( );
  257. mysql_query( 'insert into th_crontab(ctime)values(NOW())' );
  258. }
  259.  
  260. break;
  261. }
  262.  
  263. case 'Monthly': {
  264. if (2592000 < $curdatetime - $lastdatetime) {
  265. runcron( );
  266. mysql_query( 'insert into th_crontab(ctime)values(NOW())' );
  267. }
  268.  
  269. break;
  270. }
  271. }
  272. }
  273. }
  274.  
  275. return false;
  276. }
  277.  
  278. function runcron() {
  279. date_default_timezone_set( 'UTC' );
  280. $act_deposits = @mysql_query( 'select * from th_deposits where status=1 order by id' );
  281.  
  282. if (0 < mysql_num_rows( $act_deposits )) {
  283. while ($act_deposit = @mysql_fetch_array( $act_deposits )) {
  284. $depositid = $act_deposit['id'];
  285. $paycount = $act_deposit['paycount'];
  286. $a_amount = $act_deposit['a_amount'];
  287. $amount = $act_deposit['amount'];
  288. $ecurrid = $act_deposit['ecurrid'];
  289. $currid = $act_deposit['currid'];
  290. $userid = $act_deposit['user_id'];
  291. $depdate = $act_deposit['dep_date'];
  292. $lastpaydate = $act_deposit['lastpay_date'];
  293. $compval = $act_deposit['compound'];
  294. $currname = getdatabyid( 'th_currs', 'cid=' . $currid, 'c_name' );
  295. $act_dep_plan = @mysql_query( 'select * from th_plans where planid=' . $act_deposit['plan_id'] . '' );
  296. $cashouttype = @mysql_result( $act_dep_plan, 0, 'cashouttype' );
  297. $retprincipal = @mysql_result( $act_dep_plan, 0, 'retprincipal' );
  298. $earningmonfri = @mysql_result( $act_dep_plan, 0, 'earningmonfri' );
  299. $termunit = @mysql_result( $act_dep_plan, 0, 'termunit' );
  300. $totduration = @mysql_result( $act_dep_plan, 0, 'totperiod' );
  301. $allowcomp = @mysql_result( $act_dep_plan, 0, 'allowcomp' );
  302. $planexpdur = @mysql_result( $act_dep_plan, 0, 'planexpdur' );
  303.  
  304. if (( $planexpdur == 'Limited' && $totduration <= $paycount )) {
  305. @mysql_query( 'update th_deposits set status=0 where id=' . $act_deposit['id'] . '' );
  306. exit( );
  307. }
  308.  
  309. $holidays = explode( ',', @mysql_result( $act_dep_plan, 0, 'holidays' ) );
  310. $dep_timestamp = strtotime( $depdate );
  311.  
  312. if (( $earningmonfri && $planexpdur == 'Limited' )) {
  313. $last_timestamp = get_last_timestamp( $dep_timestamp, $totduration, $holidays, $termunit, $cashouttype, 'Business' );
  314. } else {
  315. $last_timestamp = get_last_timestamp( $dep_timestamp, $totduration, $holidays, $termunit, $cashouttype, 'Non-Business' );
  316. }
  317.  
  318.  
  319. if ($cashouttype == 'At Plan Expiry') {
  320. if ($last_timestamp <= $cur_timestamp) {
  321. $earndate = date( 'Y-m-d h:i:s', $last_timestamp );
  322. $type1 = 'Earning';
  323. $cpaycount = getdatabyid( 'th_deposits', 'id=' . $act_deposit['id'], 'paycount' ) + 1;
  324. $lpaydate = date( 'Y-m-d h:i:s', $endtstamp );
  325. $pprofit = $percent / 100 * $a_amount;
  326. $earning = $pprofit - $compval / 100 * $pprofit;
  327. $desc = 'Earning from ' . $a_amount . ' ' . $currname . ' Deposit at ' . $percent . '%';
  328. $hash = genshahash( $userid . $earning . $currid . $ecurrid . $type1 . $earndate );
  329. mysql_query( 'insert into th_history(user_id,amount,a_amount,hdesc,ecurrid,currid,type,date,hash,dep_id)values
  330. (' . $userid . ',' . $earning . ',' . $earning . ',\'' . $desc . '\',' . $ecurrid . ',' . $currid . ',\'' . $type1 . '\',\'' . $earndate . '\'
  331. ,\'' . $hash . '\',' . $act_deposit['id'] . ')' );
  332. mysql_query( 'update th_deposits set lastpay_date=' . date( 'Y-m-d h:i:s', $last_timestamp ) . ' where id=' . $act_deposit['id'] . '' );
  333.  
  334. if ($retprincipal == 1) {
  335. $a_amount = getdatabyid( 'th_deposits', 'id=' . $act_deposit['id'], 'a_amount' );
  336. $earndate = date( 'Y-m-d h:i:s', $endtstamp );
  337. $desc = 'Return Principal of ' . $a_amount . ' ' . $currname . ' Deposit';
  338. $type1 = 'Return_Principal';
  339. $hash = genshahash( $userid . $a_amount . $currid . $ecurrid . $type1 . $earndate );
  340. $q4 = 'insert into th_history(user_id,amount,a_amount,hdesc,ecurrid,currid,type,date,hash,dep_id)values
  341. (' . $userid . ',' . $a_amount . ',' . $a_amount . ',\'' . $desc . '\',' . $ecurrid . ',' . $currid . ',\'' . $type1 . '\',\'' . $earndate . '\'
  342. ,\'' . $hash . '\',' . $act_deposit['id'] . ')';
  343.  
  344. if (!@mysql_query( $q4 )) {
  345. $error = true;
  346. }
  347.  
  348. @mysql_query( 'update th_deposits set status=0 where id=' . $act_deposit['id'] . '' );
  349. break;
  350. }
  351.  
  352. @mysql_query( 'update th_deposits set status=0 where id=' . $act_deposit['id'] . '' );
  353. }
  354. } else {
  355. $now = strtotime( date( 'Y-m-d h:i:s', time( ) ) );
  356.  
  357. if ($planexpdur == 'Limited') {
  358. $cur_timestamp = ($last_timestamp <= $now ? $last_timestamp : $now);
  359. } else {
  360. $cur_timestamp = $now;
  361. }
  362.  
  363.  
  364. if ($lastpaydate == 0) {
  365. $startdate = $dep_timestamp;
  366. } else {
  367. $startdate = strtotime( $lastpaydate );
  368. }
  369.  
  370.  
  371. if ($earningmonfri) {
  372. $type = 'Business';
  373. } else {
  374. $type = 'Non-Business';
  375. }
  376.  
  377. $paydates = get_all_paydates( $startdate, $cur_timestamp, $holidays, $termunit, $cashouttype, $type );
  378. for ($i = 0; $i < count( $paydates ); $i++) {
  379. $percent = getprofit( $act_deposit['plan_id'], $amount, 'numeric', $paydates[$i] );
  380. $tquery = mysql_query( 'select * from th_deposits where id=' . $act_deposit['id'] . '' );
  381. $a_amount = mysql_result( $tquery, 0, 'a_amount' );
  382. $paycount = mysql_result( $tquery, 0, 'paycount' );
  383. $t_earning = $percent / 100 * $a_amount;
  384. $compamount = $compval / 100 * $t_earning;
  385.  
  386. if (( ( $allowcomp && $compval != 0 ) && $paydates[$i] == $last_timestamp )) {
  387. $compamount = 0;
  388. }
  389.  
  390. $earning = $t_earning - $compamount;
  391. $earndate = date( 'Y-m-d h:i:s', $paydates[$i] );
  392. $type1 = 'Earning';
  393. $cpaycount = getdatabyid( 'th_deposits', 'id=' . $act_deposit['id'], 'paycount' ) + 1;
  394. $lpaydate = date( 'Y-m-d h:i:s', $i );
  395. $desc = 'Earning from ' . $a_amount . ' ' . $currname . ' Deposit at ' . $percent . '%';
  396. $hash = genshahash( $userid . $earning . $currid . $ecurrid . $type1 . $earndate );
  397. mysql_query( 'insert into th_history(user_id,amount,a_amount,hdesc,ecurrid,currid,type,date,hash,dep_id)values
  398. (' . $userid . ',' . $earning . ',' . $earning . ',\'' . $desc . '\',' . $ecurrid . ',' . $currid . ',\'' . $type1 . '\',\'' . $earndate . '\'
  399. ,\'' . $hash . '\',' . $act_deposit['id'] . ')' );
  400. mysql_query( 'update th_deposits set paycount=' . $cpaycount . ',lastpay_date=\'' . date( 'Y-m-d h:i:s', $paydates[$i] ) . '\' where id=' . $act_deposit['id'] . '' );
  401.  
  402. if (( ( $allowcomp && $compval != 0 ) && $paydates[$i] != $last_timestamp )) {
  403. @mysql_query( 'update th_deposits set a_amount=a_amount+' . $compamount . ' where id=' . $act_deposit['id'] . '' );
  404. }
  405. }
  406.  
  407.  
  408. if (( ( $retprincipal == 1 && $cur_timestamp == $last_timestamp ) && $planexpdur == 'Limited' )) {
  409. $a_amount = getdatabyid( 'th_deposits', 'id=' . $act_deposit['id'], 'a_amount' );
  410. $earndate = date( 'Y-m-d h:i:s', $last_timestamp );
  411. $desc = 'Return Principal of ' . $a_amount . ' ' . $currname . ' Deposit';
  412. $type1 = 'Return_Principal';
  413. $hash = genshahash( $userid . $a_amount . $currid . $ecurrid . $type1 . $earndate );
  414. $q4 = 'insert into th_history(user_id,amount,a_amount,hdesc,ecurrid,currid,type,date,hash,dep_id)values
  415. (' . $userid . ',' . $a_amount . ',' . $a_amount . ',\'' . $desc . '\',' . $ecurrid . ',' . $currid . ',\'' . $type1 . '\',\'' . $earndate . '\'
  416. ,\'' . $hash . '\',' . $act_deposit['id'] . ')';
  417.  
  418. if (!@mysql_query( $q4 )) {
  419. $error = true;
  420. }
  421.  
  422. @mysql_query( 'update th_deposits set status=0 where id=' . $act_deposit['id'] . '' );
  423. break;
  424. }
  425.  
  426.  
  427. if ($last_timestamp <= $now) {
  428. @mysql_query( 'update th_deposits set status=0 where id=' . $act_deposit['id'] . '' );
  429. }
  430. }
  431. }
  432. }
  433.  
  434. }
  435.  
  436. function getrefclicks($type, $period) {
  437. if ($type == 'M') {
  438. switch ($period) {
  439. case 'D': {
  440. $q = mysql_query( 'select count(userid) as res from th_users where regdate=CURDATE() and uplineid=' . $_SESSION['t_loggeduserid'] . '' );
  441. break;
  442. }
  443.  
  444. case 'W': {
  445. $q = mysql_query( 'select count(userid) as res from th_users where WEEK(regdate)=WEEK(CURDATE()) and uplineid=' . $_SESSION['t_loggeduserid'] . '' );
  446. break;
  447. }
  448.  
  449. case 'M': {
  450. $q = mysql_query( 'select count(userid) as res from th_users where MONTH(regdate)=MONTH(CURDATE()) and uplineid=' . $_SESSION['t_loggeduserid'] . '' );
  451. break;
  452. }
  453.  
  454. case 'Y': {
  455. $q = mysql_query( 'select count(userid) as res from th_users where YEAR(regdate)=YEAR(CURDATE()) and uplineid=' . $_SESSION['t_loggeduserid'] . '' );
  456. break;
  457. }
  458. }
  459. }
  460.  
  461.  
  462. if ($type == 'V') {
  463. switch ($period) {
  464. case 'D': {
  465. $q = mysql_query( 'select count(userid) as res from th_refclicks where rdate=CURDATE() and userid=' . $_SESSION['t_loggeduserid'] . '' );
  466. break;
  467. }
  468.  
  469. case 'W': {
  470. $q = mysql_query( 'select count(userid) as res from th_refclicks where WEEK(rdate)=WEEK(CURDATE()) and userid=' . $_SESSION['t_loggeduserid'] . '' );
  471. break;
  472. }
  473.  
  474. case 'M': {
  475. $q = mysql_query( 'select count(userid) as res from th_refclicks where MONTH(rdate)=MONTH(CURDATE()) and userid=' . $_SESSION['t_loggeduserid'] . '' );
  476. break;
  477. }
  478.  
  479. case 'Y': {
  480. $q = mysql_query( 'select count(userid) as res from th_refclicks where YEAR(rdate)=YEAR(CURDATE()) and userid=' . $_SESSION['t_loggeduserid'] . '' );
  481. break;
  482. }
  483. }
  484. }
  485.  
  486. $res = mysql_result( $q, 0, 'res' );
  487. return $res;
  488. }
  489.  
  490. function showinfo($type) {
  491. switch ($type) {
  492. case 'top10invest': {
  493. $d = '<table width="500" border="0" cellpadding="0" cellspacing="1" >
  494. <tr>
  495. <td width="25%" height="30" colspan=3 align="center" valign=middle class="boxtop2"><strong>TOP 10 INVESTORS</strong></td>
  496.  
  497. </tr>
  498. <tr>
  499. <td width="25%" height="23" align="center" class="boxtop2" valign=middle>Username</td>
  500. <td width="25%" align="center" class="boxtop2" valign=middle>Total Invested(USD/EUR)</td>
  501. </tr>
  502. ';
  503. $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' );
  504.  
  505. while ($r = mysql_fetch_array( $q )) {
  506. $d .= ' <tr>
  507. <td height="23" align="center" class="tdstyle1">' . getdatabyid( 'th_users', 'userid=' . $r['user_id'], 'username' ) . '</td>
  508. <td align="center" class="tdstyle1">' . $r['sumamnt'] . '</td>
  509. </tr>';
  510. }
  511.  
  512. $d .= '</table>';
  513. break;
  514. }
  515.  
  516. case 'last10invest': {
  517. $d = '<table width="500" border="0" cellpadding="0" cellspacing="1" >
  518. <tr>
  519. <td width="25%" height="30" colspan=3 align="center" valign=middle class="boxtop2"><strong>LAST 10 INVESTORS</strong></td>
  520.  
  521. </tr>
  522. <tr>
  523. <td width="25%" height="23" align="center" class="boxtop2" valign=middle>Username</td>
  524. <td width="25%" align="center" class="boxtop2" valign=middle>Total Invested(USD/EUR)</td>
  525. </tr>
  526. ';
  527. $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' );
  528.  
  529. while ($r = mysql_fetch_array( $q )) {
  530. $d .= ' <tr>
  531. <td height="23" align="center" class="tdstyle1">' . getdatabyid( 'th_users', 'userid=' . $r['user_id'], 'username' ) . '</td>
  532. <td align="center" class="tdstyle1">' . $r['sumamnt'] . '</td>
  533. </tr>';
  534. }
  535.  
  536. $d .= '</table>';
  537. break;
  538. }
  539.  
  540. case 'top10ref': {
  541. $d = '<table width="500" border="0" cellpadding="0" cellspacing="1" >
  542. <tr>
  543. <td width="25%" height="30" colspan=3 align="center" valign=middle class="boxtop2"><strong>TOP 10 REFERRERS</strong></td>
  544.  
  545. </tr>
  546. <tr>
  547. <td width="25%" height="23" align="center" class="boxtop2" valign=middle>Username</td>
  548. <td width="25%" align="center" class="boxtop2" valign=middle>Total Referrals</td>
  549. </tr>
  550. ';
  551. $q = mysql_query( 'select uplineid,count(uplineid) as totref from th_users where uplineid!=0 group by uplineid order by totref desc LIMIT 10' );
  552.  
  553. while ($r = mysql_fetch_array( $q )) {
  554. $d .= ' <tr>
  555. <td height="23" align="center" class="tdstyle1">' . $r['uplineid'] . '</td>
  556. <td align="center" class="tdstyle1">' . $r['totref'] . '</td>
  557. </tr>';
  558. }
  559.  
  560. $d .= '</table>';
  561. break;
  562. }
  563.  
  564. case 'last10pay': {
  565. $d = '<table width="500" border="0" cellpadding="0" cellspacing="1" >
  566. <tr>
  567. <td width="25%" height="30" colspan=3 align="center" valign=middle class="boxtop2"><strong>LAST 10 PAYOUTS</strong></td>
  568.  
  569. </tr>
  570. <tr>
  571. <td width="25%" height="23" align="center" class="boxtop2" valign=middle>Username</td>
  572. <td width="25%" align="center" class="boxtop2" valign=middle>Amount</td>
  573. <td width="25%" align="center" class="boxtop2" valign=middle>Payment Processor</td>
  574. </tr>
  575. ';
  576. $q = mysql_query( 'select date,user_id,amount,ecurrid from th_history where type=\'Processed_Withdrawal\' order by id desc LIMIT 10' );
  577.  
  578. if (@mysql_num_rows( $q )) {
  579. while ($r = mysql_fetch_array( $q )) {
  580. $d .= ' <tr>
  581. <td height="23" align="center" class="tdstyle1">' . getdatabyid( 'th_users', 'userid=' . $r['user_id'], 'username' ) . '</td>
  582. <td align="center" class="tdstyle1">' . number_format( abs( $r['amount'] ), 2 ) . '</td>
  583. <td align="center" class="tdstyle1">' . getdatabyid( 'th_pps', 'ppid=' . $r['ecurrid'], 'ppreal' ) . '</td>
  584. </tr>';
  585. }
  586. } else {
  587. $d .= '<tr><td colspan=3>Sorry,None Found</td></tr>';
  588. }
  589.  
  590. $d .= '</table>';
  591. break;
  592. }
  593. }
  594.  
  595. return $d;
  596. }
  597. ...................................................................
  598. ............................................
  599. ...................
Advertisement
Add Comment
Please, Sign In to add comment