Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.25 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.0.8.0
  8. * @ Author : DeZender
  9. * @ Release on : 25.09.2017
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function StreamlinetoStreamline($params)
  15. {
  16. $maxconnection = $params['configoption4'];
  17. $is_trial = (($params['configoption5'] == 'Yes' ? '1' : '0'));
  18. $is_isplock = (($params['configoption6'] == 'Yes' ? '1' : '0'));
  19. $is_restreamer = (($params['configoption7'] == 'Yes' ? '1' : '0'));
  20. $Bouquets = $params['configoption10'];
  21. $syn_expiry = $params['configoption17'];
  22. $trial_period = (($params['configoption18'] != 0 ? '+' . $params['configoption18'] . ' hours' : '+24 hours'));
  23. $tblhostingdetails = \Illuminate\Database\Capsule\Manager::table( 'tblhosting' )->where( 'id', '=', $params['serviceid'] )->get( );
  24. $nextduedate = $tblhostingdetails[0]->nextduedate;
  25. $serviceid = $tblhostingdetails[0]->id;
  26. $con = XtreamCodeTestConnection( $params['pid'] );
  27. $xtreamConfig = \Illuminate\Database\Capsule\Manager::table( 'mod_xtreamConfig' )->get( );
  28. $returndata = array( );
  29.  
  30. if (isset( $xtreamConfig ) && !(empty( $xtreamConfig ))) {
  31. foreach ($xtreamConfig as $config) {
  32. $returndata[$config->setting] = $config->value;
  33. }
  34. }
  35.  
  36. if (isset( $returndata['configoption_field_name'] ) && !(empty( $returndata['configoption_field_name'] ))) {
  37. if (isset( $params['configoptions'] ) && !(empty( $params['configoptions'] ))) {
  38. foreach ($params['configoptions'] as $configname => $configvalue) {
  39. if ($configname == $returndata['configoption_field_name']) {
  40. $maxconnection += $configvalue;
  41. }
  42. }
  43. }
  44. }
  45.  
  46. $username = $params['username'];
  47. $password = $params['password'];
  48. $reseller_notes = $returndata['common_identifier'] . $serviceid;
  49. $result = mysqli_query( $con, 'SELECT username,id FROM users WHERE username=\'' . $username . '\' AND reseller_notes=\'' . $reseller_notes . '\'' );
  50.  
  51. if (!($result)) {
  52. $radiussqlerror = mysqli_error( $con );
  53. XtreamCode_WHMCSReconnect( );
  54. return 'XtreamCode Database Query Error: ' . $radiussqlerror;
  55. }
  56.  
  57. if (0 < mysqli_num_rows( $result )) {
  58. $xcuser = mysqli_fetch_assoc( $result );
  59. $xtreamuserid = $xcuser['id'];
  60. $checkmagdevice = $params['customfields'][$returndata['checkmagdevice']];
  61.  
  62. if (isset( $checkmagdevice ) && !(empty( $checkmagdevice )) && ($checkmagdevice == 'on')) {
  63. if (!(empty( $params['customfields'][$returndata['custom_field_mag']] ))) {
  64. $macexists = XtreamCode_CheckMAG( $params['customfields'][$returndata['custom_field_mag']], $con );
  65.  
  66. if (isset( $macexists ) && !(empty( $macexists ))) {
  67. return XtreamCode_UpdateMAG( $params );
  68. }
  69.  
  70. return XtreamCode_AddMAG( $params, $params['customfields'][$returndata['custom_field_mag']] );
  71. }
  72.  
  73. logModuleCall( 'XtreamCode', 'StreamlinetoStreamline', 'MAG Address field is requied for (Only MAG and Check MAG)', 'error' );
  74. return 'MAG Address field required, if you choose only MAG device';
  75. }
  76.  
  77. $expdate = 'NULL';
  78.  
  79. if (($is_trial == 1) && ($nextduedate != '0000-00-00')) {
  80. $expdate = strtotime( date( 'Y-m-d H:i:s', strtotime( $nextduedate ) ) );
  81. }
  82. else if (($syn_expiry == 'on') && ($nextduedate != '0000-00-00')) {
  83. $expdate = strtotime( date( 'Y-m-d H:i:s', strtotime( $nextduedate ) ) );
  84. }
  85. else if ($is_trial == 1) {
  86. $expdate = strtotime( date( 'Y-m-d H:i:s', strtotime( $trial_period ) ) );
  87. }
  88.  
  89. $query = 'UPDATE users SET `bouquet`=\'' . $Bouquets . '\',`exp_date`=' . $expdate . ',enabled=\'1\',`is_trial`=\'' . $is_trial . '\',`max_connections`=\'' . $maxconnection . '\',`is_restreamer`=\'' . $is_restreamer . '\',`is_isplock`=\'' . $is_isplock . '\' WHERE id=\'' . $xtreamuserid . '\'';
  90. $result = mysqli_query( $con, $query );
  91.  
  92. if (!($result)) {
  93. $radiussqlerror = mysqli_error( $con );
  94. XtreamCode_WHMCSReconnect( );
  95. return 'XtreamCode Database Query Error: ' . $radiussqlerror;
  96. }
  97.  
  98. if (!(empty( $params['customfields'][$returndata['custom_field_mag']] ))) {
  99. $macexists = XtreamCode_CheckMAG( $params['customfields'][$returndata['custom_field_mag']], $con );
  100.  
  101. if (isset( $macexists ) && !(empty( $macexists ))) {
  102. return XtreamCode_UpdateMAG( $params );
  103. }
  104.  
  105. return XtreamCode_AddMAG( $params, $params['customfields'][$returndata['custom_field_mag']] );
  106. }
  107.  
  108. $result = mysqli_query( $con, 'SELECT * FROM users WHERE reseller_notes=\'' . $reseller_notes . '\' AND is_mag=\'1\'' );
  109. $pairid = mysqli_fetch_assoc( $result );
  110. $xtreamuserid = $pairid['id'];
  111.  
  112. if (isset( $pairid['pair_id'] ) && !(empty( $pairid['pair_id'] ))) {
  113. mysqli_query( $con, 'DELETE FROM `mag_devices` WHERE user_id=\'' . $pairid['pair_id'] . '\'' );
  114. $result = mysqli_query( $con, 'DELETE FROM users WHERE reseller_notes=\'' . $reseller_notes . '\' AND is_mag=\'1\'' );
  115. mysqli_query( $con, 'UPDATE users SET pair_id=\'\' WHERE reseller_notes=\'' . $reseller_notes . '\'' );
  116. }
  117.  
  118. XtreamCode_WHMCSReconnect( );
  119. logModuleCall( 'XtreamCode', 'StreamlinetoStreamline', 'Upgrade Account: ' . $username, 'success' );
  120. return 'success';
  121. }
  122.  
  123. $checkmagdevice = $params['customfields'][$returndata['checkmagdevice']];
  124. ...................................................
  125. .........................
  126. ............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement