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 543947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:36:12+00:00 2026-05-13T10:36:12+00:00

I wound up inheriting a site which seems like it was originally designed to

  • 0

I wound up inheriting a site which seems like it was originally designed to provide access to registered users then decided it wanted public access with the exception of specific restricted features. The access control is decent, however, what’s boggling my mind is why anyone would add an entry to their database for each unique visitor.

The authentication code checks for the existence of the cookie and session and if it does not exist creates a limited user account and sets the cookie as such:


$session = md5(time() . "sitename" . $_SERVER['REMOTE_ADDR']);
setcookie("sitename",$session, time()+ 14 * 24 * 3600, "/",".sitename.com");
mysql_query("INSERT user(session,permissions) VALUES ($session, $permissions)");
$this->ActiveUser = mysql_insert_id();

There’s a cron job on the server set to to run nightly that cleans up these sessions and reset the auto_increment value to the last registered user id + 1. While the clean-up script is good it seems to disregard the glaring design flaw that a flood of traffic (unique users) could make the INT value for the user id reach its mysql max value: 2147483647. Updating the user id to be large int would help, but only (theoretically) for so long. Also, if say there are 50 visitors between the last registered user and the first new registered user id of the day the auto_increment values in between will never be reused.

The site has good reporting metrics for visitors and members alike providing metrics on what items a user viewed, if it ended up in their shopping cart, and if they purchased that item by registering for an account.

I think the authentication function could be redesigned using SESSION variables for visitors and the shopping cart without touching the database and creating unused auto_increment values. The down side is that they would loose the custom reporting.

Obviously a trade off, but figured I’d post it here and see what thoughts were . Thanks!

  • 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-13T10:36:12+00:00Added an answer on May 13, 2026 at 10:36 am

    Do you have any idea how many requests 2 billion are? Do the math at 10 unique visitors per second, 24 hours per day, and see how many years it takes to get there.

    I’ve been running highly used membership sites for years, and they never even remotely got close to overflowing their int4 primary key.

    My opinion is this is a non-issue.

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

Sidebar

Related Questions

I'm building a site using PHP which allows users to add in a lot
My (rails 3.1) site currently does routing for objects using ids like so: /object/show/:id
I have an ecommerce site built on OpenCart (1.5.0 i believe), which after inserting
I got site for selling products. In my database I have 3 tables: Users,
I would like to add a simple chat functionality to my web site. I
I've seen a great answer to a similar question which explains, by inheriting all
I am working on a site that allows users to enter their phone number
I have a site which displays job vacancies. The data is provided as an
I have many pages on a site im developing, in which each page has
I made an error when I was working and wound up with a commit

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.