What are some potential risks of downloading PHP files directly from a website?

Downloading PHP files directly from a website can pose security risks as the code may contain malicious scripts or vulnerabilities that could compromise your system. To mitigate this risk, it is recommended to only download PHP files from trusted sources or verify the code for any suspicious elements before executing it on your server.

// Example of verifying PHP file before executing
$filename = 'example.php';

if (strpos(file_get_contents($filename), 'malicious_code') === false) {
    include $filename;
} else {
    echo 'File contains malicious code, cannot execute.';
}