T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/.cursor-server/data/User/History/-3d687056/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/.cursor-server/data/User/History/-3d687056/YUVD.php
<?php
// Database Connection Test Script
// This script tests the database connection and verifies the credit system tables

echo "šŸ”§ Testing Database Connection and Credit System Setup...\n\n";

try {
    // Test database connection
    require_once 'config/database.php';
    $pdo = getDBConnection();
    echo "āœ… Database connection successful!\n\n";
    
    // Test users table structure
    echo "šŸ“‹ Checking users table structure...\n";
    $stmt = $pdo->query("DESCRIBE users");
    $columns = $stmt->fetchAll(PDO::FETCH_COLUMN);
    
    $required_columns = ['credits', 'subscription_expires', 'commercial_rights_expires', 'expiration_warning_sent'];
    $missing_columns = [];
    
    foreach ($required_columns as $column) {
        if (!in_array($column, $columns)) {
            $missing_columns[] = $column;
        }
    }
    
    if (empty($missing_columns)) {
        echo "āœ… Users table has all required credit columns\n";
    } else {
        echo "āŒ Missing columns in users table: " . implode(', ', $missing_columns) . "\n";
        echo "   Run the database_updates.sql script to add these columns\n";
    }
    
    // Test credit-related tables
    $tables_to_check = [
        'credit_purchases' => 'Credit purchases tracking',
        'credit_transactions' => 'Credit transaction history',
        'track_purchases' => 'Track purchase records',
        'user_follows' => 'User following relationships',
        'music_tracks' => 'Music tracks storage'
    ];
    
    echo "\nšŸ“‹ Checking credit system tables...\n";
    foreach ($tables_to_check as $table => $description) {
        try {
            $stmt = $pdo->query("SELECT COUNT(*) FROM $table LIMIT 1");
            echo "āœ… $table table exists ($description)\n";
        } catch (Exception $e) {
            echo "āŒ $table table missing ($description)\n";
        }
    }
    
    // Test log files
    echo "\nšŸ“‹ Checking log files...\n";
    $log_files = [
        'logs/credit_expirations.log' => 'Credit expiration events',
        'logs/user_credits.log' => 'User credit operations',
        'logs/stripe_actions.log' => 'Stripe webhook events',
        'logs/track_purchases.log' => 'Track purchase events',
        'logs/track_purchase_errors.log' => 'Track purchase errors'
    ];
    
    foreach ($log_files as $file => $description) {
        if (file_exists($file) && is_writable($file)) {
            echo "āœ… $file exists and writable ($description)\n";
        } else {
            echo "āŒ $file missing or not writable ($description)\n";
        }
    }
    
    // Test cron script
    echo "\nšŸ“‹ Checking cron script...\n";
    if (file_exists('cron/expire_credits.php')) {
        echo "āœ… Cron script exists (cron/expire_credits.php)\n";
    } else {
        echo "āŒ Cron script missing (cron/expire_credits.php)\n";
    }
    
    // Test webhook script
    echo "\nšŸ“‹ Checking webhook script...\n";
    if (file_exists('webhooks/stripe.php')) {
        echo "āœ… Webhook script exists (webhooks/stripe.php)\n";
    } else {
        echo "āŒ Webhook script missing (webhooks/stripe.php)\n";
    }
    
    // Sample data test
    echo "\nšŸ“‹ Testing sample data operations...\n";
    
    // Test user credit update
    try {
        $stmt = $pdo->prepare("UPDATE users SET credits = 10 WHERE id = 1 LIMIT 1");
        $stmt->execute();
        echo "āœ… User credit update test successful\n";
    } catch (Exception $e) {
        echo "āŒ User credit update test failed: " . $e->getMessage() . "\n";
    }
    
    // Test credit transaction insert
    try {
        $stmt = $pdo->prepare("INSERT INTO credit_transactions (user_id, amount, type, description) VALUES (1, 10, 'purchase', 'Test transaction')");
        $stmt->execute();
        echo "āœ… Credit transaction insert test successful\n";
        
        // Clean up test data
        $stmt = $pdo->prepare("DELETE FROM credit_transactions WHERE description = 'Test transaction'");
        $stmt->execute();
    } catch (Exception $e) {
        echo "āŒ Credit transaction insert test failed: " . $e->getMessage() . "\n";
    }
    
    echo "\nšŸŽ‰ Database and credit system setup test complete!\n";
    echo "\nšŸ“ Next steps:\n";
    echo "1. Run database_updates.sql if any tables/columns are missing\n";
    echo "2. Run ./setup_cron.sh to set up the cron job\n";
    echo "3. Test the cron job manually: php cron/expire_credits.php\n";
    echo "4. Monitor logs for any issues\n";
    
} catch (Exception $e) {
    echo "āŒ Database connection failed: " . $e->getMessage() . "\n";
    echo "\nšŸ”§ Please check your database configuration in config/database.php\n";
}
?> 

CasperSecurity Mini