Advertisement
Guest User

Untitled

a guest
Apr 7th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. <?php
  2. if(isset($_GET['action']) {
  3. $panelUrl = "http://51.254.45.5/api.php";
  4. if($_GET['action'] == "newline" && isset($_GET['id']) && isset($_GET['package'])) {
  5. if($_GET['package'] == 1) {
  6. $price = 8;
  7. $time = strtotime("+1 month");
  8. } else if($_GET['package'] == 2) {
  9. $price = 14;
  10. $time = strtotime("+2 month");
  11. } else if($_GET['package'] == 3) {
  12. $price = 20;
  13. $time = strtotime("+3 month");
  14. }
  15.  
  16. $api_result = json_decode(file_get_contents($pannelUrl."?action=req_user&sub=credits&amount=-".$price."&id=".$_GET['id'], false, $context));
  17.  
  18. if($api_result['result']) {
  19. $username = isset($_GET['user']) ? $_GET['user'] : "";
  20. $password = isset($_GET['pw']) ? $_GET['pw'] : "";
  21. $max_connections = 1;
  22. $reseller = $_GET['id'];
  23. $bouquet_ids = array(1, 2, 3);
  24. $expire_date = strtotime($_GET['package']);
  25.  
  26. $post_data = array( 'user_data' => array(
  27. 'username' => $username,
  28. 'password' => $password,
  29. 'max_connections' => $max_connections,
  30. 'is_restreamer' => $reseller,
  31. 'exp_date' => $expire_date,
  32. 'bouquet' => json_encode( $bouquet_ids ) ) );
  33.  
  34. $opts = array( 'http' => array(
  35. 'method' => 'POST',
  36. 'header' => 'Content-type: application/x-www-form-urlencoded',
  37. 'content' => http_build_query( $post_data ) ) );
  38.  
  39. $context = stream_context_create($opts);
  40. $api_result = json_decode( file_get_contents($pannelUrl."?action=user&sub=create", false, $context));
  41.  
  42. if($api_result['result'] == false) {
  43. echo "Error occurred: ".$api_result['error'];
  44. $api_result = json_decode(file_get_contents($pannelUrl."?action=req_user&sub=credits&amount=".$price."&id=".$_GET['id'], false, $context));
  45. }
  46. } else {
  47. echo "Error occurred: ".$api_result['error'];
  48. }
  49. }
  50. }
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement