Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7168071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:42:20+00:00 2026-05-28T14:42:20+00:00

Ok i made a small script, which sets a $_SESSION[$_SERVER[‘REMOTE_ADDR’]] the problem, it dont

  • 0

Ok i made a small script, which sets a $_SESSION[$_SERVER[‘REMOTE_ADDR’]] the problem, it dont works with bots, if i go to my webpage and make page refresh it works, but it is not working with bots.

When i look in the session dir, i see 1000s of session files, with ips in it, but the session variable is always = 1, so my thinking, when the bot connects to my site, it always sets a new Session instead of increasing the session variable. Any idea how i can fix this. Here is my code:

   <?php
        session_start();
        if(isset($_SESSION[$_SERVER['REMOTE_ADDR']])){

            $_SESSION[$_SERVER['REMOTE_ADDR']]++;

            if($_SESSION[$_SERVER['REMOTE_ADDR']] % 2 == 0) {
            // DO SOMETHING
}

        } else {
            $_SESSION[$_SERVER['REMOTE_ADDR']] = 1;
        }
    ?>

EDIT FOR JON:

That script above gets executed on all pages of my site:

The Session Variable: gets build so $_SERVER[‘REMOTE_ADDR’] for example is = 127.0.0.1

so my SESSION variable would be $_SESSION[‘127.0.0.1’];

So when the IP goes, to other pages of my site x,y,1,2,3,5 the $_SESSION[‘127.0.0.1’] variable gets an increment of 1

But this dont works for bots.

Jon i thought: SESSION are serverside, so that vars get stored on the server, i dont want set any cookies.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:42:21+00:00Added an answer on May 28, 2026 at 2:42 pm

    You cannot “fix” this. If someone wants to scrape parts of your site that do not require a session being in a specific state (e.g. logged in user) then they will not bother with storing your session id cookies and returning them to you. And without a session id, each time they will look like a new session to you.

    What exactly are you trying to accomplish here?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a small script which basically uses jQuery uplodify to upload files to
I've made a small program which has 2 buttons and each does certain thing.
In Windows, I made a small script to compile and then run a Java
I've made a small script in my machine, and an alias in .bashrc that
I have a PHP script which works fine in PHP 5, but not in
i have made an small script to allow users to build they page or
I have just made a small little app of a Python wxPython script with
I made small program to divide large pictures and take part of them. When
I have made a small log service that i want to publish to a
I have made a small application in Java and I would like to make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.