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

  • Home
  • SEARCH
  • 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 4267858
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:57:23+00:00 2026-05-21T06:57:23+00:00

Simply put, I am trying to create a custom logger for visitors to a

  • 0

Simply put, I am trying to create a custom logger for visitors to a php site with mysql. In doing so, I found that I was inserting two entries for every single page load.

I have already ruled out the code running twice by accident.

   I put the query on every page, assuming it would work flawlessly. After realizing it was causing two entries to occur, I was confused and removed the query from the other pages, leaving it only on the index page.

   Utilizing PHP’s $_SERVER[‘HTTP_REFERER’] and $_SERVER[‘PHP_SELF’], I inserted the values into the log. To see where I was beforehand and where I was at currently.

   So let’s say I was on the create page, and I clicked a link to the ‘home’ page named index.php. The entries in the database would say referer was ‘create.php’ and the current page was ‘index.php’. However, a second entry would be inserted that said referer was ‘index.php’ and the current page was ‘index.php’

   I checked what would happen when I clicked a link to a page without the logger, so I clicked to go to the ‘create’ page. I checked the database and there was another entry, but ironically only one entry was inserted this time. This was weird because the create page has no code to log a visitor and it was only inserting one entry. However, it was saying that the referer was ‘create.php’ and current page was index.php. Which is backwards from what it should be.

    Doing more research, I decided to look into watching the headers live. So I checked using firefox and IE, where I realized that the headers get the page I’m requesting and also always gets the root page as well. For example, a request to create.php returns..

GET /create.php HTTP/1.1
GET /style/ HTTP/1.1
GET / HTTP/1.1

    I understand the first GET, for the page I request, I understand the second GET for the external stylesheet. The last one is what confuses me, although it seems to corroborate why I’m getting the duplicate entry.

    Since, there is no visitor log on the create.php page there is no first entry to the log, but once it loads the root page, the entry is created for the create.php being referer and the current page is the index.php page because it is loading the root page.

    Since, there is a visitor log on the index.php page, when I go from ‘create.php’ to ‘index.php’, the first GET creates an entry of ‘create.php’ being the referer and current page being ‘index.php’, but a second entry says that ‘index.php’ is the referer and the current page.

So I am pretty certain it is this reasoning for which I get a second entry.

Can anyone tell me why it is loading the root page on every request?

I’m using xampp for mac os x locally, and I understand it might be the default favicon. However, I just removed the icon and it still occurs, even though the favicon doesn’t display.

I can supply code samples and other things, it just seems irrelevant at this point because the insert query works, it just occurs twice when I clearly only execute it once.

  • 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-21T06:57:24+00:00Added an answer on May 21, 2026 at 6:57 am

    The “GET /” request is pulling index.php automatically.

    There is probably an invalid image SRC url, or script SRC, or link HREF, somewhere on the page. Those can cause regular-looking requests against the server in the background without realizing it. Review all your HTML for URLs and ensure they’re all valid server-side files. There could also be a server-side redirect for unknown files back to the home page.

    That or you have some JavaScript (potentially ads?) that’s doing an ajax request.

    We’ll need full source to really trace this down.

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

Sidebar

Related Questions

I am trying to create a custom jQuery selector that will put focus() on
I simply want to create something like that: <strong>blah blah</strong> I've been trying to
Simply put, is there a way to create a 2D javascript array using similar
Simply put; what does my $99 get me, that I can't already get for
Very simply put: I have a class that consists mostly of static public members,
Help, I'm trying to create a new post in my wordpress blog with custom
I'm trying to create an abstract class, defining an abstract method, that is to
I've create a custom admin module but i can't put a content in it,
I am trying to create a property that will make a pointer (byte*) from
I am trying to create a custom validator method for phone numbers. I would

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.