Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.94 KB | None | 0 0
  1. <?php
  2. /*
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.5.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 22.06.2018
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. define('ADMINAREA', true);
  15. require '../init.php';
  16. $aInt = new WHMCS\Admin('Manage Affiliates');
  17. $aInt->title = $aInt->lang('affiliates', 'title');
  18. $aInt->sidebar = 'clients';
  19. $aInt->icon = 'affiliates';
  20. $aInt->helplink = 'Affiliates';
  21. $aInt->requiredFiles(array('invoicefunctions', 'gatewayfunctions'));
  22.  
  23. if ($action == 'save') {
  24. check_token('WHMCS.admin.default');
  25. update_query('tblaffiliates', array('paytype' => $paymenttype, 'payamount' => $payamount, 'onetime' => $onetime, 'visitors' => $visitors, 'balance' => $balance, 'withdrawn' => $withdrawn), array('id' => $id));
  26. logActivity('Affiliate ID ' . $id . ' Details Updated');
  27. redir('action=edit&id=' . $id);
  28. }
  29.  
  30. if ($action == 'deletecommission') {
  31. check_token('WHMCS.admin.default');
  32. delete_query('tblaffiliatespending', array('id' => $cid));
  33. redir('action=edit&id=' . $id);
  34. }
  35.  
  36. if ($action == 'deletehistory') {
  37. check_token('WHMCS.admin.default');
  38. delete_query('tblaffiliateshistory', array('id' => $hid));
  39. redir('action=edit&id=' . $id);
  40. }
  41.  
  42. if ($action == 'deletereferral') {
  43. check_token('WHMCS.admin.default');
  44. delete_query('tblaffiliatesaccounts', array('id' => $affaccid));
  45. redir('action=edit&id=' . $id);
  46. }
  47.  
  48. if ($action == 'deletewithdrawal') {
  49. check_token('WHMCS.admin.default');
  50. delete_query('tblaffiliateswithdrawals', array('id' => $wid));
  51. redir('action=edit&id=' . $id);
  52. }
  53.  
  54. if ($action == 'addcomm') {
  55. check_token('WHMCS.admin.default');
  56. $amount = format_as_currency($amount);
  57. insert_query('tblaffiliateshistory', array('affiliateid' => $id, 'date' => toMySQLDate($date), 'affaccid' => $refid, 'description' => $description, 'amount' => $amount));
  58. update_query('tblaffiliates', array('balance' => '+=' . $amount), array('id' => (int) $id));
  59. redir('action=edit&id=' . $id);
  60. }
  61.  
  62. if ($action == 'withdraw') {
  63. check_token('WHMCS.admin.default');
  64. insert_query('tblaffiliateswithdrawals', array('affiliateid' => $id, 'date' => 'now()', 'amount' => $amount));
  65. update_query('tblaffiliates', array('balance' => '-=' . $amount, 'withdrawn' => '+=' . $amount), array('id' => (int) $id));
  66.  
  67. if ($payouttype == '1') {
  68. $result = select_query('tblaffiliates', '', array('id' => (int) $id));
  69. $data = mysql_fetch_array($result);
  70. $id = (int) $data['id'];
  71. $clientid = (int) $data['clientid'];
  72. addTransaction($clientid, '', 'Affiliate Commissions Withdrawal Payout', '0', '0', $amount, $paymentmethod, $transid);
  73. } else {
  74. if ($payouttype == '2') {
  75. $result = select_query('tblaffiliates', '', array('id' => (int) $id));
  76. $data = mysql_fetch_array($result);
  77. $id = (int) $data['id'];
  78. $clientid = (int) $data['clientid'];
  79. insert_query('tblcredit', array('clientid' => $clientid, 'date' => 'now()', 'description' => 'Affiliate Commissions Withdrawal', 'amount' => $amount));
  80. update_query('tblclients', array('credit' => '+=' . $amount), array('id' => $clientid));
  81. logActivity('Processed Affiliate Commissions Withdrawal to Credit Balance - User ID: ' . $clientid . ' - Amount: ' . $amount);
  82. }
  83. }
  84.  
  85. redir('action=edit&id=' . $id);
  86. }
  87.  
  88. if ($sub == 'delete') {
  89. check_token('WHMCS.admin.default');
  90. delete_query('tblaffiliates', array('id' => $ide));
  91. logActivity('Affiliate ' . $ide . ' Deleted');
  92. redir();
  93. }
  94.  
  95. ob_start();
  96.  
  97. if ($action == '') {
  98. $aInt->sortableTableInit('clientname', 'ASC');
  99. $query = "FROM `tblaffiliates` INNER JOIN tblclients ON tblclients.id=tblaffiliates.clientid WHERE tblaffiliates.id!=''";
  100.  
  101. if ($client) {
  102. $query .= " AND concat(firstname,' ',lastname) LIKE '%" . db_escape_string($client) . "%'";
  103. }
  104. ...............................................................................
  105. ......................................................
  106. ......................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement