Security [SOLVED]: How to store IP address that accesses a specific url into a file

Security [SOLVED]: How to store IP address that accesses a specific url into a file

Home Forums Security Security [SOLVED]: How to store IP address that accesses a specific url into a file

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36744

    Anonymous

    QuestionQuestion

    I’m no coder and I’m running into an issue. What I would like to do is to store into a file all the IPs that try accessing specific URLS so that I can build a list of IPs of people that are either trying to see if my site is made with a specific CMS or try to hack their way into it.

    I know I can access such data in the server log files but automating the task would save me a lot of time in the long run.

    Is there so code that I could add on the specific URLs that would do this?

    #36745

    Anonymous

    Accepted AnswerAnswer

    <?php
    $pathToLogFile="";
    file_put_contents($pathToLogFile, "nIP Address". $_SERVER["REMOTE_ADDR"],FILE_APPEND)
    ?>
    

    Remember to provide an absolute path if you’re placing this file in multiple directories, and make sure you initialize a blank file at that path

    Source: https://stackoverflow.com/questions/47947139/how-to-store-ip-address-that-accesses-a-specific-url-into-a-file
    Author: dGRAMOP
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.