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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:41:13+00:00 2026-05-27T20:41:13+00:00

I need to store a record for a user per IP address to limit

  • 0

I need to store a record for a user per IP address to limit the rate at which a certain IP address can perform an action.

I know that storing the IP in a database would work but I am worried that on a small VPS with limited resources, too much processing power would be taken by the MySQL process. Is there another way of storing data for an IP?

I thought of a system similar to:

/ips/
/ips/127/
/ips/127/0
/ips/127/0/0
/ips/127/0/0/1.txt

Sample Code:

$ip_parts = explode('.', $_SERVER['REMOTE_ADDR']);
$records = intval(file_get_contents('ips/' . implode('/', $ip_parts)));

if($records > 50) {
    echo 'Error - credits used.';
} else {
    // Do something
}

With the 1.txt file containing the needed data. Would I encounter issues with the number of files or folders causing this method to be slower than a database?

  • 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-27T20:41:13+00:00Added an answer on May 27, 2026 at 8:41 pm

    Check out this question / answer on ServerFault regarding DBMS optimization. You’re trying to reinvent the wheel for no particular reason (unless you won’t ever use MySQL on that VPS). And, while on the subject of storing IP addresses in MySQL, take a look at the INET_ATOI() function for MySQL.

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

Sidebar

Related Questions

An inexperienced question: I need to store about 10 unknown-length text fields per record
In my program, we store a user's IP address in a record. When we
I need a db to store, i.e. user records. Regular stuff: name, e-mail, address,
I need to store large amounts of metering data in a database. A record
I have id values for products that I need store. Right now they are
I need to store phone numbers in a table. Please suggest which datatype should
I need to store user entered changes to a particular table, but not show
I am coding a psychology experiment in Python. I need to store user information
I have a Car table and User table which store car and user particular.
I need to create a stored proc that will return records (more than one

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.