403Webshell
Server IP : 127.0.0.1  /  Your IP : 192.168.99.1
Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9
System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64
User : Administrator ( 0)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  D:/bpkd_29052026/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : D:/bpkd_29052026//submit-contact.php
<?php
require_once 'admin/config/database.php';
require_once 'admin/config/security.php';

setSecurityHeaders();
session_start();

// Rate limiting
if (!checkRateLimit('contact', 2, 600)) { // Maks 2 pesan per 10 menit
    die(json_encode(['error' => 'Terlalu banyak pesan. Silakan tunggu 10 menit.']));
}

// Check form time
if (!checkFormTime(5)) { // Minimal 5 detik
    logSuspiciousActivity('fast_contact', 'Contact form submitted too fast');
    die(json_encode(['error' => 'Invalid submission']));
}

// Validate honeypot
if (!validateHoneypot()) {
    logSuspiciousActivity('contact_honeypot', 'Honeypot triggered');
    die(json_encode(['error' => 'Bot detected']));
}

// Validate CSRF
if (!isset($_POST['csrf_token']) || !validateCSRFToken($_POST['csrf_token'])) {
    logSuspiciousActivity('contact_csrf', 'Invalid CSRF token');
    die(json_encode(['error' => 'Invalid security token']));
}

// Validate captcha
if (!validateCaptcha($_POST['captcha'] ?? '')) {
    die(json_encode(['error' => 'Jawaban captcha salah']));
}

// Validate inputs
$name = validateInput($_POST['name'] ?? '', 'name');
$email = validateInput($_POST['email'] ?? '', 'email');
$phone = validateInput($_POST['phone'] ?? '', 'phone');
$subject = validateInput($_POST['subject'] ?? '', 'string');
$message = validateInput($_POST['message'] ?? '', 'string');

// Validasi
if (!$name || strlen($name) < 3 || strlen($name) > 50) {
    die(json_encode(['error' => 'Nama tidak valid']));
}

if (!$email) {
    die(json_encode(['error' => 'Email tidak valid']));
}

if ($phone && !validateInput($phone, 'phone')) {
    die(json_encode(['error' => 'Nomor telepon tidak valid']));
}

if (!$subject || strlen($subject) < 3 || strlen($subject) > 100) {
    die(json_encode(['error' => 'Subjek harus antara 3-100 karakter']));
}

if (!$message || strlen($message) < 10 || strlen($message) > 2000) {
    die(json_encode(['error' => 'Pesan harus antara 10-2000 karakter']));
}

// Filter spam keywords
$spam_keywords = ['viagra', 'casino', 'lottery', 'prize', 'winner', 'bitcoin', 'crypto'];
$message_lower = strtolower($message);
foreach ($spam_keywords as $keyword) {
    if (strpos($message_lower, $keyword) !== false) {
        logSuspiciousActivity('spam_keyword', "Message contains: $keyword");
        die(json_encode(['error' => 'Pesan terdeteksi sebagai spam']));
    }
}

// Save to database
$ip_address = $_SERVER['REMOTE_ADDR'];
$user_agent = $_SERVER['HTTP_USER_AGENT'];

$sql = "INSERT INTO contacts (name, email, phone, subject, message, ip_address, user_agent, status, created_at) 
        VALUES (?, ?, ?, ?, ?, ?, ?, 'unread', NOW())";

$stmt = executeQuery($conn, $sql, [$name, $email, $phone, $subject, $message, $ip_address, $user_agent], 'sssssss');

if ($stmt) {
    // Kirim email notifikasi ke admin
    $to = "admin@instansi.com";
    $email_subject = "Pesan Kontak Baru: $subject";
    $email_message = "Nama: $name\nEmail: $email\nPhone: $phone\n\nPesan:\n$message";
    mail($to, $email_subject, $email_message);
    
    echo json_encode(['success' => 'Pesan berhasil dikirim. Terima kasih!']);
} else {
    logSuspiciousActivity('contact_db_error', 'Failed to save contact');
    echo json_encode(['error' => 'Gagal mengirim pesan. Silakan coba lagi.']);
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit