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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:40:39+00:00 2026-06-05T10:40:39+00:00

I have a problem, I need to receive data (just one string from a

  • 0

I have a problem, I need to receive data (just one string from a form, it’s a name what it receives):

$received_data = $_POST['data'];
$ip = checkip();

And the ‘user’ IP (it not needs cookies or session and I can’t use them), I must to save both datas (data and ip) on a database and allow to see 5 per hour, but allow to see the same that already saw, I mean the ‘data’ stored on database can see without limit, but only 5 differents datas (names) per hour, for example:

Can check: Martha, Jack, Lily, Mark and Peter (per hour, and the next hour can check others or maybe the same – depens on user).

And in the same hour can check the five names already checked, but not other til the next hour.

And if try to check Martha, Jack and then Martha again, (the second Martha) not counts, because it’s already checked in the same hour.

I don’t know how can I do it, could anybody help me?

Thank you in advanced, kind regards.

  • 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-06-05T10:40:41+00:00Added an answer on June 5, 2026 at 10:40 am
    function getRealIpAddr()
    {
        if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
        {
          $ip=$_SERVER['HTTP_CLIENT_IP'];
        }
        elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
        {
          $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        else
        {
          $ip=$_SERVER['REMOTE_ADDR'];
        }
        return $ip;
    }
    
    function maxSavePerHour($data, $ip, $maxSave = 5){
    
        $data = mysql_real_escape_string($data);
    
        // Get record matching within last hour
        $res = mysql_query("select * from table where data='$data' and ip='$ip' and lastinsert <= date_sub(NOW(), interval 1 hour)";
    
         $totalRows = mysql_num_rows($res);
    
        // If a record was NOT found within last hour matching everything then insert new record.
    
          // Compare records against max saves
          if($totalRows <= $maxSave){
            $storeData = true;
          }else{
            $storeData = false;
          }  
    
    
       if($storeData){
          $res = mysql_query("insert into table set data='$data', ip='$ip'";
          //Add more exception handling here....
        }
    
    }
    
    
    $ip = getRealIpAddr();
    $data = $_POST['data'];
    
    maxSavePerHour($data,$ip);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem i need to convert from my Array structure to std::vector<int> ...
I have a problem where I need to remove all code and triggers from
Well, I have the following problem: I need to delete a row from a
I have a problem. I need to get gradient from Blue to Red. My
I have class that extends 'IntentService' - this class occasionally receives data from a
I have 3 tables on which i need to select data from using ms-access
The Problem: I need to receive different types of content from a number of
Friends I have a problem We need to make a user control that has
I have a problem that I need to sort out in javascript I believe,
I have the following problem: I need to use XSLFO to generate a 2-column

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.