• NullMasters - Please Only Handle Nulling Requests That Have Been Given The Approved Badge.

  • You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Please some one null this script

Rohitkumar

Active member
Jul 27, 2020
175
59
28
Nicobar
www.neogram.dev
I want this script nulled if someone @NullMaster knows how to null it then please help me.
Android Online Live TV Streaming | Babiato Forums
You can tell me what to remove in this code [i know php but only basic]
Index.php
Code:
<?php

session_start();

require_once '../includes/lb_helper.php'; // Include LicenseBox external/client api helper file
$api = new LicenseBoxAPI(); // Initialize a new LicenseBoxAPI object

$filename = 'database.sql';

$product_info=$api->get_latest_version();

//print_r($product_info);
//exit;

?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"/>
    <title><?php echo $product_info['product_name']; ?> - Installer</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css"/>
    <style type="text/css">
      body, html {
        background: #F7F7F7;
      }
    </style>
  </head>
  <body>
    <?php
      $errors = false;
      $step = isset($_GET['step']) ? $_GET['step'] : '';
    ?>
    <div class="container">
      <div class="section">
        <div class="column is-6 is-offset-3">
          <center>
            <h1 class="title" style="padding-top: 20px"><?php echo $product_info['product_name']; ?> Installer</h1><br>
          </center>
          <div class="box">
            <?php
            switch ($step) {
              default: ?>
                <div class="tabs is-fullwidth">
                  <ul>
                    <li class="is-active">
                      <a>
                        <span><b>Requirements</b></span>
                      </a>
                    </li>
                    <li>
                      <a>
                        <span>Verify</span>
                      </a>
                    </li>
                    <li>
                      <a>
                        <span>Database</span>
                      </a>
                    </li>
                    <li>
                      <a>
                        <span>Finish</span>
                      </a>
                    </li>
                  </ul>
                </div>
                <?php
                // Add or remove your script's requirements below
                if(phpversion() < "7.2"){
                  $errors = true;
                  echo "<div class='notification is-danger' style='padding:12px;'><i class='fa fa-times'></i> Current PHP version is ".phpversion()."! minimum PHP 7.2 or higher required.</div>";
                }else{
                  echo "<div class='notification is-success' style='padding:12px;'><i class='fa fa-check'></i> You are running PHP version ".phpversion()."</div>";
                }
                if(!extension_loaded('mysqli')){
                  $errors = true;
                  echo "<div class='notification is-danger' style='padding:12px;'><i class='fa fa-times'></i> MySQLi PHP extension missing!</div>";
                }else{
                  echo "<div class='notification is-success' style='padding:12px;'><i class='fa fa-check'></i> MySQLi PHP extension available</div>";
                }
                if(!extension_loaded('curl')){
                  $errors = true;
                echo "<div class='notification is-danger' style='padding:12px;'><i class='fa fa-times'></i> Curl PHP extension missing!</div>";
                }else{
                  echo "<div class='notification is-success' style='padding:12px;'><i class='fa fa-check'></i> Curl PHP extension available</div>";
                }
                if(!extension_loaded('pdo')){
                  $errors = true;
                echo "<div class='notification is-danger' style='padding:12px;'><i class='fa fa-times'></i> PDO PHP extension missing!</div>";
                }else{
                  echo "<div class='notification is-success' style='padding:12px;'><i class='fa fa-check'></i> PDO PHP extension available</div>";
                }
                if(!extension_loaded('json')){
                  $errors = true;
                  echo "<div class='notification is-danger' style='padding:12px;'><i class='fa fa-times'></i> JSON PHP extension missing!</div>";
                }else{
                  echo "<div class='notification is-success' style='padding:12px;'><i class='fa fa-check'></i> JSON PHP extension available</div>";
                }
               

                ?>

                <div style='text-align: right;'>
                  <?php if($errors==true){ ?>
                  <a href="#" class="button is-link" disabled>Next</a>
                  <?php }else{ ?>
                  <a href="index.php?step=0" class="button is-link">Next</a>
                  <?php } ?>
                </div><?php
                break;
              case "0": ?>
                <div class="tabs is-fullwidth">
                  <ul>
                    <li>
                      <a>
                        <span><i class="fa fa-check-circle"></i> Requirements</span>
                      </a>
                    </li>
                    <li class="is-active">
                      <a>
                        <span><b>Verify</b></span>
                      </a>
                    </li>
                    <li>
                      <a>
                        <span>Database</span>
                      </a>
                    </li>
                    <li>
                      <a>
                        <span>Finish</span>
                      </a>
                    </li>
                  </ul>
                </div>
                <?php
                  $license_code = null;
                  $client_name = null;
                  if(!empty($_POST['license'])&&!empty($_POST['client'])){
                    $license_code = strip_tags(trim($_POST["license"]));
                    $client_name = strip_tags(trim($_POST["client"]));
                    /* Once we have the license code and client's name we can use LicenseBoxAPI's activate_license() function for activating/installing the license, if the third parameter is empty a local license file will be created which can be used for background license checks. */
                    $activate_response = $api->activate_license($license_code,$client_name);

                    $_SESSION['envato_buyer_name']=$client_name;
                    $_SESSION['envato_purchase_code']=$license_code;

                    if(empty($activate_response)){
                      $msg='Server is unavailable.';
                    }else{

                      $msg=$activate_response['message'];
                    }
                    if($activate_response['status'] != true){ ?>
                      <form action="index.php?step=0" method="POST">
                        <div class="notification is-danger"><?php echo ucfirst($msg); ?></div>
                        <div class="field">
                          <label class="label">Purchase Code. (<a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code" target="_blank">Where Is My Purchase Code?</a>)</label>
                          <div class="control">
                            <input class="input" type="text" placeholder="enter your purchase/license code" name="license" required>
                          </div>
                        </div>
                        <div class="field">
                          <label class="label">Envato user name</label>
                          <div class="control">
                            <input class="input" type="text" placeholder="enter your name/envato username" name="client" required>
                          </div>
                        </div>
                        <div style='text-align: right;'>
                          <button type="submit" class="button is-link">Verify</button>
                        </div>
                      </form><?php
                    }else{ ?>
                      <form action="index.php?step=1" method="POST">
                        <div class="notification is-success"><?php echo ucfirst($msg); ?></div>
                        <input type="hidden" name="lcscs" id="lcscs" value="<?php echo ucfirst($activate_response['status']); ?>">
                        <div style='text-align: right;'>
                          <button type="submit" class="button is-link">Next</button>
                        </div>
                      </form><?php
                    }
                  }else{ ?>
                    <form action="index.php?step=0" method="POST">
                      <div class="field">
                        <label class="label">Purchase Code. (<a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code" target="_blank">Where Is My Purchase Code?</a>)</label>
                        <div class="control">
                          <input class="input" type="text" placeholder="enter your purchase/license code" name="license" required>
                        </div>
                      </div>
                      <div class="field">
                        <label class="label">Envato user name</label>
                        <div class="control">
                          <input class="input" type="text" placeholder="enter your name/envato username" name="client" required>
                        </div>
                      </div>
                      <div style='text-align: right;'>
                        <button type="submit" class="button is-link">Verify</button>
                      </div>
                    </form>
                  <?php }
                break;
              case "1": ?>
                <div class="tabs is-fullwidth">
                  <ul>
                    <li>
                      <a>
                        <span><i class="fa fa-check-circle"></i> Requirements</span>
                      </a>
                    </li>
                    <li>
                      <a>
                        <span><i class="fa fa-check-circle"></i> Verify</span>
                      </a>
                    </li>
                    <li class="is-active">
                      <a>
                        <span><b>Database</b></span>
                      </a>
                    </li>
                    <li>
                      <a>
                        <span>Finish</span>
                      </a>
                    </li>
                  </ul>
                </div>
                <?php
                  if($_POST && isset($_POST["lcscs"])){
                    $valid = strip_tags(trim($_POST["lcscs"]));
                    $db_host = strip_tags(trim($_POST["host"]));
                    $db_user = strip_tags(trim($_POST["user"]));
                    $db_pass = strip_tags(trim($_POST["pass"]));
                    $db_name = strip_tags(trim($_POST["name"]));
                    // Let's import the sql file into the given database
                    if(!empty($db_host)){
                      $con = @mysqli_connect($db_host, $db_user, $db_pass, $db_name);
                      if(mysqli_connect_errno()){ ?>
                        <form action="index.php?step=1" method="POST">
                          <div class='notification is-danger'>Failed to connect to MySQL: <?php echo mysqli_connect_error(); ?></div>
                          <input type="hidden" name="lcscs" id="lcscs" value="<?php echo $valid; ?>">
                          <div class="field">
                            <label class="label">Database Host</label>
                            <div class="control">
                              <input class="input" type="text" id="host" placeholder="enter your database host" name="host" required>
                            </div>
                          </div>
                          <div class="field">
                            <label class="label">Database Username</label>
                            <div class="control">
                              <input class="input" type="text" id="user" placeholder="enter your database username" name="user" required>
                            </div>
                          </div>
                          <div class="field">
                            <label class="label">Database Password</label>
                            <div class="control">
                              <input class="input" type="text" id="pass" placeholder="enter your database password" name="pass">
                            </div>
                          </div>
                          <div class="field">
                            <label class="label">Database Name</label>
                            <div class="control">
                              <input class="input" type="text" id="name" placeholder="enter your database name" name="name" required>
                            </div>
                          </div>
                          <div style='text-align: right;'>
                            <button type="submit" class="button is-link">Import</button>
                          </div>
                        </form><?php
                        exit;
                      }
                      $templine = '';
                      $lines = file($filename);
                      foreach($lines as $line){
                        if(substr($line, 0, 2) == '--' || $line == '')
                          continue;
                        $templine .= $line;
                        $query = false;
                        if(substr(trim($line), -1, 1) == ';'){
                          $query = mysqli_query($con, $templine);
                          $templine = '';
                        }
                      }

                      $dataFile = "../includes/connection.php";
                      $fhandle = fopen($dataFile,"r");
                      $content = fread($fhandle,filesize($dataFile));

                      $content = str_replace('db_name', $db_name, $content);

                      $content = str_replace('db_uname', $db_user, $content);

                      $content = str_replace('db_password', $db_pass, $content);

                      $content = str_replace('db_hname', $db_host, $content);

                      $fhandle = fopen($dataFile,"w");
                      fwrite($fhandle,$content);
                      fclose($fhandle);

                      // Update envato client details

                      $sql="UPDATE tbl_settings SET `envato_buyer_name` = '".$_SESSION['envato_buyer_name']."',  `envato_purchase_code` = '".$_SESSION['envato_purchase_code']."',  `envato_purchased_status` = '1' WHERE `id`='1'";

                      mysqli_query($con, $sql);

                    ?>
                    <form action="index.php?step=2" method="POST">
                      <div class='notification is-success'>Database was successfully imported.</div>
                      <input type="hidden" name="dbscs" id="dbscs" value="true">
                      <div style='text-align: right;'>
                        <button type="submit" class="button is-link">Next</button>
                      </div>
                    </form><?php
                  }else{ ?>
                    <form action="index.php?step=1" method="POST">
                      <input type="hidden" name="lcscs" id="lcscs" value="<?php echo $valid; ?>">
                      <div class="field">
                        <label class="label">Database Host</label>
                        <div class="control">
                          <input class="input" type="text" id="host" placeholder="enter your database host" name="host" required>
                        </div>
                      </div>
                      <div class="field">
                        <label class="label">Database Username</label>
                        <div class="control">
                          <input class="input" type="text" id="user" placeholder="enter your database username" name="user" required>
                        </div>
                      </div>
                      <div class="field">
                        <label class="label">Database Password</label>
                        <div class="control">
                          <input class="input" type="text" id="pass" placeholder="enter your database password" name="pass">
                        </div>
                      </div>
                      <div class="field">
                        <label class="label">Database Name</label>
                        <div class="control">
                          <input class="input" type="text" id="name" placeholder="enter your database name" name="name" required>
                        </div>
                      </div>
                      <div style='text-align: right;'>
                        <button type="submit" class="button is-link">Import</button>
                      </div>
                    </form><?php
                }
              }else{ ?>
                <div class='notification is-danger'>Sorry, something went wrong.</div><?php
              }
              break;
            case "2": ?>
              <div class="tabs is-fullwidth">
                <ul>
                  <li>
                    <a>
                      <span><i class="fa fa-check-circle"></i> Requirements</span>
                    </a>
                  </li>
                  <li>
                    <a>
                      <span><i class="fa fa-check-circle"></i> Verify</span>
                    </a>
                  </li>
                  <li>
                    <a>
                      <span><i class="fa fa-check-circle"></i> Database</span>
                    </a>
                  </li>
                  <li class="is-active">
                    <a>
                      <span><b>Finish</b></span>
                    </a>
                  </li>
                </ul>
              </div>
              <?php
              if($_POST && isset($_POST["dbscs"])){
                $valid = $_POST["dbscs"];
                session_destroy();
                ?>
                <center>
                  <div class='notification is-success'><?php echo $product_info['product_name']; ?> is successfully installed.</div>
                  <br>
                  <p>You can now login using your username: <strong>admin</strong> and default password: <strong>admin</strong></p><br><strong>
                  <p><a class='button is-link' href='../index.php'>Login</a></p></strong>
                  <br>
                  <p class='help has-text-grey'>The first thing you should do is change your account details.</p>
                </center>
                <?php
              }else{ ?>
                <div class='notification is-danger'>Sorry, something went wrong.</div><?php
              }
            break;
          } ?>
        </div>
      </div>
    </div>
  </div>
  <div class="content has-text-centered">
    <p>Copyright <?php echo date('Y'); ?> nemosofts.com, All rights reserved.</p><br>
  </div>
</body>
</html>

ic_helper.php
Code:
<?php if(count(get_included_files()) == 1) exit("No direct script access allowed");

define("LB_API_DEBUG", false);
define("LB_SHOW_UPDATE_PROGRESS", true);

define("LB_TEXT_CONNECTION_FAILED", 'Server is unavailable at the moment, please try again.');
define("LB_TEXT_INVALID_RESPONSE", 'Server returned an invalid response, please contact support.');
define("LB_TEXT_VERIFIED_RESPONSE", 'Verified! Thanks for purchasing.');
define("LB_TEXT_PREPARING_MAIN_DOWNLOAD", 'Preparing to download main update...');
define("LB_TEXT_MAIN_UPDATE_SIZE", 'Main Update size:');
define("LB_TEXT_DONT_REFRESH", '(Please do not refresh the page).');
define("LB_TEXT_DOWNLOADING_MAIN", 'Downloading main update...');
define("LB_TEXT_UPDATE_PERIOD_EXPIRED", 'Your update period has ended or your license is invalid, please contact support.');
define("LB_TEXT_UPDATE_PATH_ERROR", 'Folder does not have write permission or the update file path could not be resolved, please contact support.');
define("LB_TEXT_MAIN_UPDATE_DONE", 'Main update files downloaded and extracted.');
define("LB_TEXT_UPDATE_EXTRACTION_ERROR", 'Update zip extraction failed.');
define("LB_TEXT_PREPARING_SQL_DOWNLOAD", 'Preparing to download SQL update...');
define("LB_TEXT_SQL_UPDATE_SIZE", 'SQL Update size:');
define("LB_TEXT_DOWNLOADING_SQL", 'Downloading SQL update...');
define("LB_TEXT_SQL_UPDATE_DONE", 'SQL update files downloaded.');
define("LB_TEXT_UPDATE_WITH_SQL_IMPORT_FAILED", 'Application was successfully updated but automatic SQL importing failed, please import the downloaded SQL file in your database manually.');
define("LB_TEXT_UPDATE_WITH_SQL_IMPORT_DONE", 'Application was successfully updated and SQL file was automatically imported.');
define("LB_TEXT_UPDATE_WITH_SQL_DONE", 'Application was successfully updated, please import the downloaded SQL file in your database manually.');
define("LB_TEXT_UPDATE_WITHOUT_SQL_DONE", 'Application was successfully updated, there were no SQL updates.');

if(!LB_API_DEBUG){
    @ini_set('display_errors', 0);
}

if((@ini_get('max_execution_time')!=='0')&&(@ini_get('max_execution_time'))<600){
    @ini_set('max_execution_time', 600);
}
@ini_set('memory_limit', '256M');

class LicenseBoxAPI{

    private $product_id;
    private $api_url;
    private $api_key;
    private $api_language;
    private $current_version;
    private $verify_type;
    private $verification_period;
    private $current_path;
    private $root_path;
    private $license_file;

    public function __construct(){
        $this->product_id = '03E0F0FF';
        $this->api_url = 'http://license.thivapro.com/';
        $this->api_key = '176D93DE3584DEF0A3EA';
        $this->api_language = 'english';
        $this->current_version = 'v1.0.0';
        $this->verify_type = 'envato';
        $this->verification_period = 365;
        $this->current_path = realpath(__DIR__);
        $this->root_path = realpath($this->current_path.'/..');
        $this->license_file = $this->current_path.'/.lic';
    }

    public function check_local_license_exist(){
        return is_file($this->license_file);
    }

    public function get_current_version(){
        return $this->current_version;
    }

    private function call_api($method, $url, $data){
        $curl = curl_init();
        switch ($method){
            case "POST":
                curl_setopt($curl, CURLOPT_POST, 1);
                if($data)
                    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
                break;
            case "PUT":
                curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
                if($data)
                    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);                         
                break;
              default:
                  if($data)
                    $url = sprintf("%s?%s", $url, http_build_query($data));
        }
        $this_server_name = getenv('SERVER_NAME')?:
            $_SERVER['SERVER_NAME']?:
            getenv('HTTP_HOST')?:
            $_SERVER['HTTP_HOST'];
        $this_http_or_https = ((
            (isset($_SERVER['HTTPS'])&&($_SERVER['HTTPS']=="on"))or
            (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])and
                $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
        )?'https://':'http://');
        $this_url = $this_http_or_https.$this_server_name.$_SERVER['REQUEST_URI'];
        $this_ip = getenv('SERVER_ADDR')?:
            $_SERVER['SERVER_ADDR']?:
            $this->get_ip_from_third_party()?:
            gethostbyname(gethostname());
        curl_setopt($curl, CURLOPT_HTTPHEADER,
            array('Content-Type: application/json',
                'LB-API-KEY: '.$this->api_key,
                'LB-URL: '.$this_url,
                'LB-IP: '.$this_ip,
                'LB-LANG: '.$this->api_language)
        );
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
        curl_setopt($curl, CURLOPT_TIMEOUT, 30);
        $result = curl_exec($curl);
        if(!$result&&!LB_API_DEBUG){
            $rs = array(
                'status' => FALSE,
                'message' => LB_TEXT_CONNECTION_FAILED
            );
            return json_encode($rs);
        }
        $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        if($http_status != 200){
            if(LB_API_DEBUG){
                $temp_decode = json_decode($result, true);
                $rs = array(
                    'status' => FALSE,
                    'message' => ((!empty($temp_decode['error']))?
                        $temp_decode['error']:
                        $temp_decode['message'])
                );
                return json_encode($rs);
            }else{
                $rs = array(
                    'status' => FALSE,
                    'message' => LB_TEXT_INVALID_RESPONSE
                );
                return json_encode($rs);
            }
        }
        curl_close($curl);
        return $result;
    }

    public function check_connection(){
        $data_array =  array();
        $get_data = $this->call_api(
            'POST',
            $this->api_url.'api/check_connection_ext',
            json_encode($data_array)
        );
        $response = json_decode($get_data, true);
        return $response;
    }

    public function get_latest_version(){
        $data_array =  array(
            "product_id"  => $this->product_id
        );
        $get_data = $this->call_api(
            'POST',
            $this->api_url.'api/latest_version',
            json_encode($data_array)
        );
        $response = json_decode($get_data, true);
        return $response;
    }

    public function activate_license($license, $client, $create_lic = true){
        $data_array =  array(
            "product_id"  => $this->product_id,
            "license_code" => $license,
            "client_name" => $client,
            "verify_type" => $this->verify_type
        );
        $get_data = $this->call_api(
            'POST',
            $this->api_url.'api/activate_license',
            json_encode($data_array)
        );
        $response = json_decode($get_data, true);
        if(!empty($create_lic)){
            if($response['status']){
                $licfile = trim($response['lic_response']);
                file_put_contents($this->license_file, $licfile, LOCK_EX);
            }else{
                @chmod($this->license_file, 0777);
                if(is_writeable($this->license_file)){
                    unlink($this->license_file);
                }
            }
        }
        return $response;
    }

    public function verify_license($time_based_check = false, $license = false, $client = false){
        if(!empty($license)&&!empty($client)){
            $data_array =  array(
                "product_id"  => $this->product_id,
                "license_file" => null,
                "license_code" => $license,
                "client_name" => $client
            );
        }else{
            if(is_file($this->license_file)){
                $data_array =  array(
                    "product_id"  => $this->product_id,
                    "license_file" => file_get_contents($this->license_file),
                    "license_code" => null,
                    "client_name" => null
                );
            }else{
                $data_array =  array();
            }
        }
        $res = array('status' => TRUE, 'message' => LB_TEXT_VERIFIED_RESPONSE);
        if($time_based_check && $this->verification_period > 0){
            ob_start();
            if(session_status() == PHP_SESSION_NONE){
                session_start();
            }
            $type = (int) $this->verification_period;
            $today = date('d-m-Y');
            if(empty($_SESSION["349c6d29c6805a6"])){
                $_SESSION["349c6d29c6805a6"] = '00-00-0000';
            }
            if($type == 1){
                $type_text = '1 day';
            }elseif($type == 3){
                $type_text = '3 days';
            }elseif($type == 7){
                $type_text = '1 week';
            }elseif($type == 30){
                $type_text = '1 month';
            }elseif($type == 90){
                $type_text = '3 months';
            }elseif($type == 365) {
                $type_text = '1 year';
            }else{
                $type_text = $type.' days';
            }
            if(strtotime($today) >= strtotime($_SESSION["349c6d29c6805a6"])){
                $get_data = $this->call_api(
                    'POST',
                    $this->api_url.'api/verify_license',
                    json_encode($data_array)
                );
                $res = json_decode($get_data, true);
                if($res['status']==true){
                    $tomo = date('d-m-Y', strtotime($today. ' + '.$type_text));
                    $_SESSION["349c6d29c6805a6"] = $tomo;
                }
            }
            ob_end_clean();
        }else{
            $get_data = $this->call_api(
                'POST',
                $this->api_url.'api/verify_license',
                json_encode($data_array)
            );
            $res = json_decode($get_data, true);
        }
        return $res;
    }

    public function deactivate_license($license = false, $client = false){
        if(!empty($license)&&!empty($client)){
            $data_array =  array(
                "product_id"  => $this->product_id,
                "license_file" => null,
                "license_code" => $license,
                "client_name" => $client
            );
        }else{
            if(is_file($this->license_file)){
                $data_array =  array(
                    "product_id"  => $this->product_id,
                    "license_file" => file_get_contents($this->license_file),
                    "license_code" => null,
                    "client_name" => null
                );
            }else{
                $data_array =  array();
            }
        }
        $get_data = $this->call_api(
            'POST',
            $this->api_url.'api/deactivate_license',
            json_encode($data_array)
        );
        $response = json_decode($get_data, true);
        if($response['status']){
            @chmod($this->license_file, 0777);
            if(is_writeable($this->license_file)){
                unlink($this->license_file);
            }
        }
        return $response;
    }

    public function check_update(){
        $data_array =  array(
            "product_id"  => $this->product_id,
            "current_version" => $this->current_version
        );
        $get_data = $this->call_api(
            'POST',
            $this->api_url.'api/check_update',
            json_encode($data_array)
        );
        $response = json_decode($get_data, true);
        return $response;
    }

    public function download_update($update_id, $type, $version, $license = false, $client = false, $db_for_import = false){
        if(!empty($license)&&!empty($client)){
            $data_array =  array(
                "license_file" => null,
                "license_code" => $license,
                "client_name" => $client
            );
        }else{
            if(is_file($this->license_file)){
                $data_array =  array(
                    "license_file" => file_get_contents($this->license_file),
                    "license_code" => null,
                    "client_name" => null
                );
            }else{
                $data_array =  array();
            }
        }
        ob_end_flush();
        ob_implicit_flush(true); 
        $version = str_replace(".", "_", $version);
        ob_start();
        $source_size = $this->api_url."api/get_update_size/main/".$update_id;
        echo LB_TEXT_PREPARING_MAIN_DOWNLOAD."<br>";
        if(LB_SHOW_UPDATE_PROGRESS){echo '<script>document.getElementById(\'prog\').value = 1;</script>';}
        ob_flush();
        echo LB_TEXT_MAIN_UPDATE_SIZE." ".$this->get_remote_filesize($source_size)." ".LB_TEXT_DONT_REFRESH."<br>";
        if(LB_SHOW_UPDATE_PROGRESS){echo '<script>document.getElementById(\'prog\').value = 5;</script>';}
        ob_flush();
        $temp_progress = '';
        $ch = curl_init();
        $source = $this->api_url."api/download_update/main/".$update_id;
        curl_setopt($ch, CURLOPT_URL, $source);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_array);
        $this_server_name = getenv('SERVER_NAME')?:
            $_SERVER['SERVER_NAME']?:
            getenv('HTTP_HOST')?:
            $_SERVER['HTTP_HOST'];
        $this_http_or_https = ((
            (isset($_SERVER['HTTPS'])&&($_SERVER['HTTPS']=="on"))or
            (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])and
                $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
        )?'https://':'http://');
        $this_url = $this_http_or_https.$this_server_name.$_SERVER['REQUEST_URI'];
        $this_ip = getenv('SERVER_ADDR')?:
            $_SERVER['SERVER_ADDR']?:
            $this->get_ip_from_third_party()?:
            gethostbyname(gethostname());
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'LB-API-KEY: '.$this->api_key,
            'LB-URL: '.$this_url,
            'LB-IP: '.$this_ip,
            'LB-LANG: '.$this->api_language)
        );
        if(LB_SHOW_UPDATE_PROGRESS){curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, array($this, 'progress'));}
        if(LB_SHOW_UPDATE_PROGRESS){curl_setopt($ch, CURLOPT_NOPROGRESS, false);}
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
        echo LB_TEXT_DOWNLOADING_MAIN."<br>";
        if(LB_SHOW_UPDATE_PROGRESS){echo '<script>document.getElementById(\'prog\').value = 10;</script>';}
        ob_flush();
        $data = curl_exec($ch);
        $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        if($http_status != 200){
            if($http_status == 401){
                curl_close($ch);
                exit("<br>".LB_TEXT_UPDATE_PERIOD_EXPIRED);
            }else{
                curl_close($ch);
                exit("<br>".LB_TEXT_INVALID_RESPONSE);
            }
        }
        curl_close($ch);
        $destination = $this->root_path."/update_main_".$version.".zip";
        $file = fopen($destination, "w+");
        if(!$file){
            exit("<br>".LB_TEXT_UPDATE_PATH_ERROR);
        }
        fputs($file, $data);
        fclose($file);
        if(LB_SHOW_UPDATE_PROGRESS){echo '<script>document.getElementById(\'prog\').value = 65;</script>';}
        ob_flush();
        $zip = new ZipArchive;
        $res = $zip->open($destination);
        if($res === TRUE){
            $zip->extractTo($this->root_path."/");
            $zip->close();
            unlink($destination);
            echo LB_TEXT_MAIN_UPDATE_DONE."<br><br>";
            if(LB_SHOW_UPDATE_PROGRESS){echo '<script>document.getElementById(\'prog\').value = 75;</script>';}
            ob_flush();
        }else{
            echo LB_TEXT_UPDATE_EXTRACTION_ERROR."<br><br>";
            ob_flush();
        }
        if($type == true){
            $source_size = $this->api_url."api/get_update_size/sql/".$update_id;
            echo LB_TEXT_PREPARING_SQL_DOWNLOAD."<br>";
            ob_flush();
            echo LB_TEXT_SQL_UPDATE_SIZE." ".$this->get_remote_filesize($source_size)." ".LB_TEXT_DONT_REFRESH."<br>";
            if(LB_SHOW_UPDATE_PROGRESS){echo '<script>document.getElementById(\'prog\').value = 85;</script>';}
            ob_flush();
            $temp_progress = '';
            $ch = curl_init();
            $source = $this->api_url."api/download_update/sql/".$update_id;
            curl_setopt($ch, CURLOPT_URL, $source);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data_array);
            $this_server_name = getenv('SERVER_NAME')?:
                $_SERVER['SERVER_NAME']?:
                getenv('HTTP_HOST')?:
                $_SERVER['HTTP_HOST'];
            $this_http_or_https = ((
                (isset($_SERVER['HTTPS'])&&($_SERVER['HTTPS']=="on"))or
                (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])and
                    $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
            )?'https://':'http://');
            $this_url = $this_http_or_https.$this_server_name.$_SERVER['REQUEST_URI'];
            $this_ip = getenv('SERVER_ADDR')?:
                $_SERVER['SERVER_ADDR']?:
                $this->get_ip_from_third_party()?:
                gethostbyname(gethostname());
            curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                'LB-API-KEY: '.$this->api_key,
                'LB-URL: '.$this_url,
                'LB-IP: '.$this_ip,
                'LB-LANG: '.$this->api_language)
            );
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
            echo LB_TEXT_DOWNLOADING_SQL."<br>";
            if(LB_SHOW_UPDATE_PROGRESS){echo '<script>document.getElementById(\'prog\').value = 90;</script>';}
            ob_flush();
            $data = curl_exec($ch);
            $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            if($http_status!=200){
                curl_close($ch);
                exit(LB_TEXT_INVALID_RESPONSE);
            }
            curl_close($ch);
            $destination = $this->root_path."/update_sql_".$version.".sql";
            $file = fopen($destination, "w+");
            if(!$file){
                exit(LB_TEXT_UPDATE_PATH_ERROR);
            }
            fputs($file, $data);
            fclose($file);
            echo LB_TEXT_SQL_UPDATE_DONE."<br><br>";
            if(LB_SHOW_UPDATE_PROGRESS){echo '<script>document.getElementById(\'prog\').value = 95;</script>';}
            ob_flush();
            if(is_array($db_for_import)){
                if(!empty($db_for_import["db_host"])&&!empty($db_for_import["db_user"])&&!empty($db_for_import["db_name"])){
                    $db_host = strip_tags(trim($db_for_import["db_host"]));
                    $db_user = strip_tags(trim($db_for_import["db_user"]));
                    $db_pass = strip_tags(trim($db_for_import["db_pass"]));
                    $db_name = strip_tags(trim($db_for_import["db_name"]));
                    $con = @mysqli_connect($db_host, $db_user, $db_pass, $db_name);
                    if(mysqli_connect_errno()){
                        echo LB_TEXT_UPDATE_WITH_SQL_IMPORT_FAILED;
                    }else{
                        $templine = '';
                        $lines = file($destination);
                        foreach($lines as $line){
                            if(substr($line, 0, 2) == '--' || $line == '')
                                continue;
                            $templine .= $line;
                            $query = false;
                            if(substr(trim($line), -1, 1) == ';'){
                                $query = mysqli_query($con, $templine);
                                $templine = '';
                            }
                        }
                        @chmod($destination,0777);
                        if(is_writeable($destination)){
                            unlink($destination);
                        }
                        echo LB_TEXT_UPDATE_WITH_SQL_IMPORT_DONE;
                    }
                }else{
                    echo LB_TEXT_UPDATE_WITH_SQL_IMPORT_FAILED;
                }
            }else{
                echo LB_TEXT_UPDATE_WITH_SQL_DONE;
            }
            if(LB_SHOW_UPDATE_PROGRESS){echo '<script>document.getElementById(\'prog\').value = 100;</script>';}
            ob_flush();
        }else{
            if(LB_SHOW_UPDATE_PROGRESS){echo '<script>document.getElementById(\'prog\').value = 100;</script>';}
            echo LB_TEXT_UPDATE_WITHOUT_SQL_DONE;
            ob_flush();
        }
        ob_end_flush();
    }

    private function progress($resource, $download_size, $downloaded, $upload_size, $uploaded){
        static $prev = 0;
        if($download_size == 0){
            $progress = 0;
        }else{
            $progress = round( $downloaded * 100 / $download_size );
        }
        if(($progress!=$prev) && ($progress == 25)){
            $prev = $progress;
            echo '<script>document.getElementById(\'prog\').value = 22.5;</script>';
            ob_flush();
        }
        if(($progress!=$prev) && ($progress == 50)){
            $prev=$progress;
            echo '<script>document.getElementById(\'prog\').value = 35;</script>';
            ob_flush();
        }
        if(($progress!=$prev) && ($progress == 75)){
            $prev=$progress;
            echo '<script>document.getElementById(\'prog\').value = 47.5;</script>';
            ob_flush();
        }
        if(($progress!=$prev) && ($progress == 100)){
            $prev=$progress;
            echo '<script>document.getElementById(\'prog\').value = 60;</script>';
            ob_flush();
        }
    }

    private function get_ip_from_third_party(){
        $curl = curl_init ();
        curl_setopt($curl, CURLOPT_URL, "http://ipecho.net/plain");
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
        curl_setopt($curl, CURLOPT_TIMEOUT, 10);
        $response = curl_exec($curl);
        curl_close($curl);
        return $response;
    }

    private function get_remote_filesize($url){
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_HEADER, TRUE);
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_NOBODY, TRUE);
        $this_server_name = getenv('SERVER_NAME')?:
            $_SERVER['SERVER_NAME']?:
            getenv('HTTP_HOST')?:
            $_SERVER['HTTP_HOST'];
        $this_http_or_https = ((
            (isset($_SERVER['HTTPS'])&&($_SERVER['HTTPS']=="on"))or
            (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])and
                $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
        )?'https://':'http://');
        $this_url = $this_http_or_https.$this_server_name.$_SERVER['REQUEST_URI'];
        $this_ip = getenv('SERVER_ADDR')?:
            $_SERVER['SERVER_ADDR']?:
            $this->get_ip_from_third_party()?:
            gethostbyname(gethostname());
        curl_setopt($curl, CURLOPT_HTTPHEADER, array(
            'LB-API-KEY: '.$this->api_key,
            'LB-URL: '.$this_url,
            'LB-IP: '.$this_ip,
            'LB-LANG: '.$this->api_language)
        );
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
        $result = curl_exec($curl);
        $filesize = curl_getinfo($curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
        if ($filesize){
            switch ($filesize){
                case $filesize < 1024:
                    $size = $filesize .' B'; break;
                case $filesize < 1048576:
                    $size = round($filesize / 1024, 2) .' KB'; break;
                case $filesize < 1073741824:
                    $size = round($filesize / 1048576, 2) . ' MB'; break;
                case $filesize < 1099511627776:
                    $size = round($filesize / 1073741824, 2) . ' GB'; break;
            }
            return $size;
        }
    }
}
 
Thanks for your helping advise, i would love if you can help me.
This is license box integration, you can follow this documentation for removing the license.

You said you know basics then i think you should try it your own.
You can tell me what to remove in this code [i know php but only basic]
 

Attachments

  • documentation.zip
    918.4 KB · Views: 79
can anybody tell me how to integrate license on any php script using licensebox script
 
i don't understand if you make simple video i can pay for it via paypal i'm student i'm pay only little bit money not huge amount

I am sorry. There is a very detailed explanation with examples included. If you cannot figure it out then you need to study more about PHP
I can show you how to do it but I can't teach you the logic of it. That's something you have to find it yourself.
If you don't think it for yourself and just follow some tutorials then it's useless for whatever you want to use it.
 
I am sorry. There is a very detailed explanation with examples included. If you cannot figure it out then you need to study more about PHP
I can show you how to do it but I can't teach you the logic of it. That's something you have to find it yourself.
If you don't think it for yourself and just follow some tutorials then it's useless for whatever you want to use it.
ok
 
I am sorry. There is a very detailed explanation with examples included. If you cannot figure it out then you need to study more about PHP
I can show you how to do it but I can't teach you the logic of it. That's something you have to find it yourself.
If you don't think it for yourself and just follow some tutorials then it's useless for whatever you want to use it.
Hey I'm not talking about licensebox because probem of licensebox have been resolved but the next problem is coming from the key that developer is integrated with his app and can be taken from his website after entering purchase code.
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock