Uname:Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64

403WebShell
403Webshell
Server IP : 13.126.101.145  /  Your IP : 216.73.217.84
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/rentals_updated/wp-content/plugins/api_manager/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/rentals_updated/wp-content/plugins/api_manager/includes/class-cat-lead-endpoint.php
<?php
if (!defined('ABSPATH')) exit; // Exit if accessed directly

class Cat_Lead_Endpoint {

    // Constructor to register the custom endpoint
    public function __construct() {
        add_action('init', [$this, 'register_custom_endpoint']);
    }

    // Register a custom endpoint
    public function register_custom_endpoint() {
        add_rewrite_rule('^cat-lead-endpoint/?$', 'index.php?cat_lead_endpoint=1', 'top');
        add_filter('query_vars', [$this, 'add_query_var']);
        add_action('template_redirect', [$this, 'handle_custom_endpoint']);
    }

    // Add custom query var for detection
    public function add_query_var($query_vars) {
        $query_vars[] = 'cat_lead_endpoint';
        return $query_vars;
    }

    // Handle requests to the custom endpoint
    public function handle_custom_endpoint() {
        if (get_query_var('cat_lead_endpoint') != 1) {
            return;
        }

        // Include WordPress functions for DB
        global $wpdb;

        // Basic Auth credentials
        $valid_username = 'RMS_USER'; // Replace with your username
        $valid_password = 'RMS_iTroSys123!'; // Replace with your password

        // Basic Authentication
        if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
            header('WWW-Authenticate: Basic realm="Restricted Area"');
            header('HTTP/1.0 401 Unauthorized');
            echo json_encode(['error' => 'Unauthorized: Missing credentials']);
            exit;
        }

        if ($_SERVER['PHP_AUTH_USER'] !== $valid_username || $_SERVER['PHP_AUTH_PW'] !== $valid_password) {
            header('HTTP/1.0 401 Unauthorized');
            echo json_encode(['error' => 'Unauthorized: Invalid credentials']);
            exit;
        }

        // Parse the incoming data
        $request_body = file_get_contents('php://input');
        $data = json_decode($request_body, true);

        if (empty($data['request_id']) || empty($data['phone'])) {
            header('HTTP/1.0 400 Bad Request');
            echo json_encode(['error' => 'Invalid data: Missing required fields']);
            exit;
        }

        // Sanitize data
        $request_id = sanitize_text_field($data['request_id']);
        $request_type = sanitize_text_field($data['request_type']);
        $current_request_status = sanitize_text_field($data['current_request_status']);
        $branch = sanitize_text_field($data['branch']);
        $created_date = sanitize_text_field($data['created_date']);
        $released_date = sanitize_text_field($data['released_date']);
        $first_received_date = sanitize_text_field($data['first_received_date']);
        $first_received_by = sanitize_text_field($data['first_received_by']);
        $closed_date = sanitize_text_field($data['closed_date']);
        $closed_by = sanitize_text_field($data['closed_by']);
        $disposition = sanitize_text_field($data['disposition']);
        $cart_info = sanitize_text_field($data['cart_info']);
        $rental_start_date = sanitize_text_field($data['rental_start_date']);
        $rental_end_date = sanitize_text_field($data['rental_end_date']);
        $utm_source = sanitize_text_field($data['utm_source']);
        $utm_medium = sanitize_text_field($data['utm_medium']);
        $utm_term = sanitize_text_field($data['utm_term']);
        $utm_content = sanitize_text_field($data['utm_content']);
        $utm_campaign = sanitize_text_field($data['utm_campaign']);
        $referring_url = sanitize_text_field($data['referring_url']);
        $first_name = sanitize_text_field($data['first_name']);
        $last_name = sanitize_text_field($data['last_name']);
        $email_id = sanitize_text_field($data['email_id']);
        $phone = sanitize_text_field($data['phone']);
        $company_name = sanitize_text_field($data['company_name']);
        $job_site_address = sanitize_text_field($data['job_site_address']);
        $job_site_city = sanitize_text_field($data['job_site_city']);
        $job_site_state = sanitize_text_field($data['job_site_state']);
        $job_site_postcode = sanitize_text_field($data['job_site_postcode']);
        $job_site_country = sanitize_text_field($data['job_site_country']);
        $delivery_status = sanitize_text_field($data['delivery_status']);
        $subscription_status = sanitize_text_field($data['subscription_status']);
        $zift_id = sanitize_text_field($data['zift_id']);
        $DLMA_dealer_code = sanitize_text_field($data['DLMA_dealer_code']);
        $google_Geocode = sanitize_text_field($data['google_Geocode']);
        $dealer_Email = sanitize_text_field($data['dealer_Email']);
        $Interface = sanitize_text_field($data['Interface']);
        $National_Account_Number = sanitize_text_field($data['National_Account_Number']);
        $Time_Zone = sanitize_text_field($data['Time_Zone']);


        // Database table name
        $table_name = $wpdb->prefix . 'cat_lead';

        // Ensure the table exists
        $wpdb->query("
            CREATE TABLE IF NOT EXISTS $table_name (
            id INT(11) NOT NULL AUTO_INCREMENT,
            request_id VARCHAR(11) NOT NULL,
            request_type VARCHAR(25),
            current_request_status VARCHAR(25),
            branch VARCHAR(25),
            created_date TIMESTAMP,
            released_date TIMESTAMP,
            first_received_date TIMESTAMP,
            first_received_by VARCHAR(255),
            closed_date TIMESTAMP,
            closed_by VARCHAR(255),
            disposition TEXT,
            cart_info TEXT,
            rental_start_date DATE,
            rental_end_date DATE,
            utm_source VARCHAR(25),
            utm_medium VARCHAR(25),
            utm_term VARCHAR(25),
            utm_content VARCHAR(25),
            utm_campaign VARCHAR(25),
            referring_url VARCHAR(25),
            first_name VARCHAR(255),
            last_name VARCHAR(255),
            email_id VARCHAR(255),          
            phone VARCHAR(20),
            company_name VARCHAR(150),
            job_site_address TEXT,
            job_site_city VARCHAR(25),
            job_site_state VARCHAR(25),
            job_site_postcode VARCHAR(20),
            job_site_county VARCHAR(25),
            delivery_status VARCHAR(25),
            subscription_status VARCHAR(25),
            zift_id VARCHAR(25),
            DLMA_dealer_code VARCHAR(25),
            google_Geocode VARCHAR(100),
            dealer_Email VARCHAR(255),
            Interface VARCHAR(25),
            National_Account_Number VARCHAR(25),
            Time_Zone VARCHAR(25),  
            last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
            PRIMARY KEY (id)
            ) " . $wpdb->get_charset_collate()
        );

        // Insert the data
        $inserted = $wpdb->insert($table_name, [
        'request_id' => $request_id,
        'request_type' => $request_type,
        'current_request_status' => $current_request_status,
        'branch' => $branch,
        'created_date' => $created_date,
        'released_date' => $released_date,
        'first_received_date' => $first_received_date,
        'first_received_by' => $first_received_by,
        'closed_date' => $closed_date,
        'closed_by' => $closed_by,
        'disposition' => $disposition,
        'cart_info' => $cart_info,
        'rental_start_date' => $rental_start_date,
        'rental_end_date' => $rental_end_date,
        'utm_source' => $utm_source,
        'utm_medium' => $utm_medium,
        'utm_term' => $utm_term,
        'utm_content' => $utm_content,
        'utm_campaign' => $utm_campaign,
        'referring_url' => $referring_url,
        'first_name' => $first_name,
        'last_name' => $last_name,
        'email_id' => $email_id,       
        'phone' => $phone,
        'company_name' => $company_name,
        'job_site_address' => $job_site_address,
        'job_site_city' => $job_site_city,
        'job_site_state' => $job_site_state,
        'job_site_postcode' => $job_site_postcode,
        'job_site_county' => $job_site_country,
        'delivery_status' => $delivery_status,
        'subscription_status' => $subscription_status,
        'zift_id' => $zift_id,
        'DLMA_dealer_code' => $DLMA_dealer_code,
        'google_Geocode' => $google_Geocode,
        'Interface' => $Interface,
        'National_Account_Number' => $National_Account_Number,
        'Time_Zone' => $Time_Zone,
        'last_updated' => current_time('mysql'),
        ]);

        // Return the response
        if ($inserted) {
            header('Content-Type: application/json');
            echo json_encode(['success' => 'Data saved successfully']);
        } else {
            header('HTTP/1.0 500 Internal Server Error');
            echo json_encode(['error' => 'Failed to save data']);
        }
        exit;
    }
}

// Initialize the endpoint
new Cat_Lead_Endpoint();


Youez - 2016 - github.com/yon3zu
LinuXploit