Do you like my tutorials?

Then consider supporting me on Ko-fi

Talking about Php and WordPress.

Like some of you noticed during these days, my blog was hacked.

Someone injected an encoded javascript code into my footer.php theme making my site open an iframe with some badware.

The same old things that happen when you’re famous :)

The boring part of this story is now I check for my WP files every day, to prevent code injection, until I’ll find the way hackers use to inject such code.

So I developed a very basic plugin to do this job for me. It scans my themes directory and outputs the files modified in the last 24 hours.

I don’t know if I’ll turn this prototype into a real, finished, plugin… but meanwhile you can take a look at the code:

$date){
                    echo "
  • ".$start_dir."/".$file." -> ".date("Y-m-d H:i:s",filemtime($start_dir."/".$file))."
  • "; } } } } function mt_toplevel_page(){ $date = date("Y-m-d",strtotime("-1 day"))." 00:00:00"; echo "

    Searching for files modified after ".$date."

    "; echo "
      "; date_tree(get_theme_root(),$date); echo "
    "; } ?>

    And outputs something like this:

    Searching for files modified after 2009-10-07 00:00:00
    footer.php -> 2009-10-07 23:31:56
    header.php -> 2009-10-08 17:58:14

    If you want to try it, simply create a new file into your plugins directory and paste this code.

    If you see some interesting use out of it by adding some options, let me know and maybe I’ll finish it.

    Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.