Sindbad~EG File Manager

Current Path : /home/copmadinaarea/public_html/wp-content__80fcb17/plugins/mozable/
Upload File :
Current File : /home/copmadinaarea/public_html/wp-content__80fcb17/plugins/mozable/ajax.php

<?php
define('WP_ADMIN', true);
require_once("../../../wp-load.php");

$data = $_POST;


if ($_GET['type'] == "activation_process") {

    $code = $_POST['purchase_code'];
    $domain = $_POST['domain'];
    $data = file_get_contents_curl("https://api.envato.com/v3/market/author/sale?code=" . $code);

    $res = json_decode($data, true);

    if (isset($res['error']) && $res['error']) {
        echo json_encode(array("status" => 0, "message" => $res['error']));
    } else {
        if (stripos($res['item']['name'], 'moZable') !== false) {
            $save_data = json_encode(array("time" => time(), "code" => $code, "domain" => $domain));
            $myfile = fopen("auth.json", "w") or die("Unable to open file!");
            fwrite($myfile, $save_data);
            fclose($myfile);
            echo json_encode(array("status" => 1));
        } else {
            echo json_encode(array("status" => 0));
        }
    }
}

if ($_GET['type'] == "save_push") {
    if ($data['title'] && $data['message']) {
        global $wpdb;
        $table_name = $wpdb->prefix . "moz_push";
        $wpdb->query("INSERT INTO $table_name (`title`,`message`, `api_key`) VALUES ('{$data['title']}', '{$data['message']}', '{$data['api_key']}')");
    }

} else if ($_GET['type'] == "save_apps") {

    global $wpdb;
    $table_name = $wpdb->prefix . "moz_apps";
    echo $wpdb->query("INSERT INTO $table_name (`server_id`, `name`,`packagename`, `platform`,`version`,`status`) VALUES ('{$data['server_id']}', '{$data['name']}', '{$data['packagename']}','{$data['platform']}', '{$data['version']}', '{$data['status']}')");

} else if ($_GET['type'] == "delete_app" && $_GET['server_id']) {

    $server_id = $_GET['server_id'];
    global $wpdb;
    $table_name = $wpdb->prefix . "moz_apps";
    $wpdb->delete($table_name, array('server_id' => $server_id));
    wp_redirect(admin_url().'?page=moz-plugin');
}



function file_get_contents_curl($url)
{
    if (extension_loaded('curl') === true) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36");
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer oJ26XbIX4IzDpbVaSzJ5hpv39wgTGAp5'));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        $data = curl_exec($ch);
        curl_close($ch);
    } else {
        $data = file_get_contents($url);
    }
    return $data;
}

?>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists