• April 25, 2023

    I don’t have the capability to implement or execute scripts on a website. However, I can give you a general idea of how you can achieve the desired functionality.

    To track the IP address of a user when they visit your website, you can use a server-side scripting language like PHP or Node.js to access the $_SERVER[‘REMOTE_ADDR’] variable, which contains the user’s IP address.

    To prevent a user from scanning your website by opening multiple pages with different URLs, you can use session variables to keep track of the user’s browsing behavior. For example, you can create a session variable that stores the time when a user first visits your website. Then, on each subsequent page visit, you can check the session variable to see if the time difference between the current page visit and the first visit is too short. If it is, then you can assume that the user is scanning your website and take appropriate action, such as blocking their IP address or redirecting them to a warning page.

    Here’s some sample PHP code that demonstrates how you can use session variables to track a user’s browsing behavior:

    $currentTime = time();
    if (!isset($_SESSION['firstVisit'])) {
      // This is the user's first visit, so set the session variable
      $_SESSION['firstVisit'] = $currentTime;
    } else {
      // The user has visited before, so check the time difference
      $timeDiff = $currentTime - $_SESSION['firstVisit'];
      if ($timeDiff < 10) { // Block if the time difference is less than 10 seconds
        header("HTTP/1.0 403 Forbidden");

    Note that this code is just an example and should be customized to fit your specific needs. Also, keep in mind that IP blocking can be a controversial approach and may not be effective in all situations. You may want to consider other measures, such as rate limiting or CAPTCHA verification, to prevent malicious scanning of your website.


ประหยัดเวลากว่า 100 เท่า!

สร้างเว็บไซต์ ดูแลเว็บไซต์