Skip to content

Instantly share code, notes, and snippets.

@TobiasS1402
Created March 15, 2022 21:37
Show Gist options
  • Save TobiasS1402/63b070cedb76598461fc3cf8a6eb2f4c to your computer and use it in GitHub Desktop.
Save TobiasS1402/63b070cedb76598461fc3cf8a6eb2f4c to your computer and use it in GitHub Desktop.
if (str_contains($file_content, '<?')) {
// If found write this to the log for later reporting
error_log("Some hackers tried to upload code to our server. Pls check if we were compromised");
// Overwrite the offending file with a warning to the hackers.
$uploaded_file = fopen($target_file, "w");
fwrite($uploaded_file, "Nice try hackers!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment