Papadopolis

registro onebip PHP

Aug 13th, 2013
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.14 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. set_time_limit(10);
  4.  
  5. /**
  6.  * Lista de dados retornados pela API
  7.  *
  8.  * -
  9.  * Erro=1 - Não foi possível criar a conta do onebip
  10.  * -
  11.  *
  12.  * -
  13.  * Erro=2 - Não foi possível confirmar a conta do onebip
  14.  * -
  15.  
  16.  *
  17.  * -
  18.  * Erro=3 - Operadora inexistente
  19.  * -
  20.  *
  21.  * -
  22.  * Erro=4 - Não foi possível enviar o pincode
  23.  * -
  24.  *
  25.  * -
  26.  * Erro=5 - Pincode incorreto
  27.  * -
  28.  *
  29.  * -
  30.  * Erro=6 - Login e/ou senha incorretos
  31.  * -
  32.  *
  33.  * -
  34.  * Etapa=1 - Conta do onebip criada com sucesso.
  35.  * Acao=1 - Enviar a cobrança de R$4 para o celular do jogador
  36.  * -
  37.  * */
  38. ?>
  39.  
  40. <?php
  41. include "init.php";
  42. include "prefixos.php";
  43.  
  44. __log(5, "IP ".getenv("REMOTE_ADDR")." executou o script do onebip");
  45.  
  46. $nospam     = new NoSpam;
  47. $onebip     = new OneBip;
  48.  
  49. $pincode    = $_GET["pincode"];
  50. $fundos     = null;
  51. $sessionID  = $_GET["sessionID"];
  52. $etapa      = $_GET["etapa"];
  53. $celular    = $_GET["celular"];
  54. $operadora  = $_GET["operadora"];
  55. $nick       = mysql_real_escape_string(trim($_GET["nick"]));
  56. $email      = mysql_real_escape_string(trim($_GET["email"]));
  57. $senha      = mysql_real_escape_string(trim($_GET["senha"]));
  58.  
  59. switch($etapa) {
  60.     case 1: // Criar conta do onebip
  61.         $containfo  = $onebip->novaConta($nick, $celular, null, null, $operadora);
  62.        
  63.         if(!$containfo)
  64.             die("Erro=1\r\n");
  65.        
  66.         /*
  67.         $x = 0;
  68.         $confirmado = false;
  69.         while(1) {
  70.             $lista = $nospam->listarEmails($containfo["username"]);
  71.             if(preg_match("/confirm your onebip/i", $lista[0][1])) {
  72.                 $email = $nospam->obterEmail($containfo["username"], $lista[0][2]);
  73.                
  74.                 preg_match("/(https.*?onebip.*?activation.*?\")/i", $email, $confirmlink);
  75.                 Request($confirmlink[1], 1, null, null, null);
  76.                 $confirmado = true;
  77.                 break;
  78.             }
  79.            
  80.             ++$x;
  81.            
  82.             if($x >= 25)
  83.                 break;
  84.             else
  85.                 sleep(1);
  86.         }
  87.        
  88.         if(!$confirmado)
  89.             die("Erro=2\r\n");
  90.         */
  91.            
  92.         $samp->ucpQuery("INSERT INTO onebip_info(NICK, ONEBIP_USER, ONEBIP_PASS, ONEBIP_CEL, ONEBIP_OPER) VALUES('{$nick}', '{$containfo["username"]}', '{$containfo["password"]}', '{$containfo["mobile"]}', '{$containfo["operadora"]}')");
  93.  
  94.         die("Etapa=2\r\n");
  95.     break;
  96.     case 2: // Enviar a cobrança para o celular do jogador
  97.         $info           = @mysql_fetch_array($samp->ucpQuery("SELECT * FROM onebip_info WHERE NICK = '{$nick}' LIMIT 0,1"));
  98.         $onebip_user    = $info["ONEBIP_USER"];
  99.         $onebip_pass    = $info["ONEBIP_PASS"];
  100.         $onebip_cel     = $info["ONEBIP_CEL"];
  101.         $onebip_oper    = $info["ONEBIP_OPER"];
  102.        
  103.         $request = Request("https://www.onebip.com/otms2/", 1, null,
  104.             "assign_fee=receiver&command=standard_pay&username=".ONEBIP_EMAIL."&item_name=".urlencode("Ativação de conta BRZ")."&price=380&currency=BRL&customer_email={$onebip_user}&custom%5B_payment_source%5D=emailrequest",
  105.             "https://www.onebip.com/otms/?assign_fee=receiver&command=standard_pay&username=".ONEBIP_EMAIL."&item_name=".urlencode("Ativação de conta BRZ")."&price=380&currency=BRL&customer_email={$onebip_user}&custom%5B_payment_source%5D=emailrequest"
  106.         );
  107.         $cks            = getCookies($request["data"][0]);
  108.         $cookiesPayment = $cks["inline"];
  109.         $sid            = $cks["PHPSESSID"];
  110.        
  111.         $onebip->payLogin($onebip_user, $onebip_pass, $cookiesPayment, $sid);
  112.         $cookiesLogin = $onebip->loginCookies;
  113.        
  114.         Request("https://www.onebip.com/otms2/?PHPSESSID=".$sid, 1, $cookiesPayment.$cookiesLogin, "content=pay", null);
  115.         Request("https://www.onebip.com/otms2/ajax/?PHPSESSID=".$sid."&action=resetotmprocessing", 1, $cookiesLogin, false, null);
  116.         $request = Request("https://www.onebip.com/otms2/ajax/?action=getpaymentmethod&PHPSESSID=".$sid, 1, $cookiesLogin, false, null);
  117.         Request("https://www.onebip.com/otms2/?PHPSESSID=".$sid, 1, $cookiesLogin, "content=dialog_otmprocessing", null);
  118.        
  119.        
  120.         $x = 0;
  121.         $break = false;
  122.         while(true) {
  123.             $req = Request("https://www.onebip.com/otms2/Processing/?PHPSESSID=".$sid, 1, $cookiesLogin, false, null);
  124.             $req = @json_decode($req["data"][1]);
  125.            
  126.             switch($req->state) {
  127.                 case "PAUSE": // Enviar PinCode
  128.                     if(stristr($req->infoMesasge, "A PIN has been sent")) {
  129.                         $samp->ucpQuery("UPDATE onebip_info SET SID='{$sid}', LOGIN_COOKIES='{$cookiesLogin}' WHERE NICK='{$nick}'");
  130.                         die("Etapa=3\r\n");
  131.                         $break = true;
  132.                     } else
  133.                         Request("https://www.onebip.com/otms2/Processing/?PHPSESSID=".$sid."&event=addfunds", 1, $cookiesLogin, false, null);
  134.                 break;
  135.             }
  136.            
  137.             ++$x;
  138.            
  139.             if($x >= 10 || $break) {
  140.                 if(!$break)
  141.                     die("Erro=4\r\n");
  142.                
  143.                 break;
  144.             }
  145.         }
  146.     break;
  147.     case 3: // Verificar se o PinCode é válido
  148.         $info           = @mysql_fetch_array($samp->ucpQuery("SELECT * FROM onebip_info WHERE NICK = '{$nick}' LIMIT 0,1"));
  149.         $onebip_user    = $info["ONEBIP_USER"];
  150.         $onebip_pass    = $info["ONEBIP_PASS"];
  151.         $onebip_cel     = $info["ONEBIP_CEL"];
  152.         $onebip_oper    = $info["ONEBIP_OPER"];
  153.         $onebip_sid     = $info["SID"];
  154.         $onebip_cookies = $info["LOGIN_COOKIES"];
  155.        
  156.         Request("https://www.onebip.com/otms2/ajax/?PHPSESSID=".$onebip_sid."&action=setpincode&pincode=".$pincode, 1, $onebip_cookies, false, null);
  157.        
  158.         $req = Request("https://www.onebip.com/otms2/Processing/?PHPSESSID=".$onebip_sid."&event=standardoptincheckpincode", 1, $onebip_cookies, false, null);
  159.         $req = @json_decode($req["data"][1]);
  160.        
  161.         if((bool)$req->closeHtmlContent) { // Pincode correto            
  162.             $x = 0;
  163.             $break = false;
  164.             while(true) {
  165.                 $req = Request("https://www.onebip.com/otms2/Processing/?PHPSESSID=".$onebip_sid, 1, $onebip_cookies, false, null);
  166.                 $req = @json_decode($req["data"][1]);
  167.                
  168.                 if(stristr($req->state, "END")) {
  169.                     $samp->ucpQuery("UPDATE onebip_info SET REGISTRADO=1 WHERE NICK='{$nick}'");
  170.                     die("Etapa=5\r\nRegistrar=1\r\n");
  171.                     $break = true;
  172.                 }
  173.                
  174.                 ++$x;
  175.                
  176.                 if($x >= 15 || $break)
  177.                     break;
  178.             }
  179.         } else
  180.             die("Erro=5\r\n");
  181.     break;
  182.     case "verificarlogin":
  183.         if($onebip->accLogin($email, $senha)) {
  184.             $samp->ucpQuery("INSERT INTO onebip_info(NICK, ONEBIP_USER, ONEBIP_PASS) VALUES('{$nick}', '{$email}', '{$senha}')");
  185.             die("Etapa=13\r\n");
  186.         } else
  187.             die("Erro=6\r\n");
  188.     break;
  189. }
  190. ?>
Advertisement
Add Comment
Please, Sign In to add comment