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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:45:59+00:00 2026-06-13T18:45:59+00:00

I have no clue on how to make this to work, so I’m just

  • 0

I have no clue on how to make this to work, so I’m just looking for ideas currently, let me explain what I want to make;
Let’s say I have a button named “click”.
Everytime I press this button, it adds 1 to the database, so when I have pressed it 10 times, it holds the value “10” in the database column named “clicks”. This is already made though.
I just need something that can check how fast I was pressing the button the 10 times to make an anti botting system. So I thought that making a column in the database named “time” this “time” column resets itself every 10 seconds and adds 1 to the column everytime the “click” button is pressed. Then I can make something in my PHP script like this:
If time > 200 DELETE USER etc.

So if a someone should be able to get the “time” column on 200 before it resets itself, it must be a bot pressing since it is not human-like to press that many times in only 10 seconds.

I have read something about TIMESTAMP and INTERVAL but I cannot get it to woth the way I thought. I simply just need a column that will delete all data inside it, after a certain time.

Any suggestions are welcome!
Thanks in advance.

I’ve come this far with the code:

if (isset($_POST['djahff'])) { // The button
require_once('connectvars.php'); // The DB connection
    $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    $idsession = $_SESSION['id'];
    $result = mysqli_query($dbc, "INSERT INTO pbclickslogin SET cps=1, id='$idsession' ON DUPLICATE KEY UPDATE cps=cps+1"); // Adding 1 to the column "cps" where username=$username

    $data = mysql_query("SELECT TIMESTAMPDIFF(SECOND, NOW(), mark) > 10 FROM pbclickslogin WHERE username='$username'") // Checking if the difference from mark and now is 10 seconds I assume?
    or die(mysql_error());
while($info = mysql_fetch_array( $data )) {
$result = mysqli_query($dbc, "UPDATE pbclickslogin SET cps='0', mark=NOW() WHERE username='$username'"); // Updating cps and mark because the difference from mark and now was 10 seconds.
 }
}

The site updates everytime the button is pressed, it’s a button made with input type “submit”.

Uhmm I didn’t really understand you fully Algomorph but I assume it was because of my code posting mistakes. Sorry I am still new on this forum. Anyway I guess I have an update statement here etc.? Are there still the same problems as you mentioned before?

Ps. Thanks for noticing me about the forum format

I have now added a little more code:

if ($info[0] == 1) {
    $result = mysqli_query($dbc, "UPDATE pbclickslogin SET cps='0', mark=NOW() WHERE username='$username'"); // Updating cps and mark because the difference from mark and now was 10 seconds.
}

The code however, never Update now. I tried with ($info[‘0’] == 1) aswell but with no luck unfortunatly. Besides that I don’t really understand this now, what is $info[0]? Is it finding something inside the database that is 0 or something? I usually only use $info when calling on columns. Thanks again man 🙂

Another few changes were added, the code we’ve got now is as followed:

if (isset($_POST['djahff'])) { // The button

require_once('connectvars.php'); // The DB connection
    $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    $idsession = $_SESSION['id'];
    $result = mysqli_query($dbc, "INSERT INTO pbclickslogin SET cps=1, id='$idsession' ON DUPLICATE KEY UPDATE cps=cps+1"); // Adding 1 to the column "cps" where username=$username

    $data = mysql_query("SELECT TIMESTAMPDIFF(SECOND, mark, NOW() ) > 10 FROM pbclickslogin WHERE id='$idsession';") // Checking if the difference from mark and now is 10 seconds I assume?
    or die(mysql_error());
while($info = mysql_fetch_array( $data )) {
if ($info[0] == 1) {
    $result = mysqli_query($dbc, "UPDATE pbclickslogin SET cps='0', mark=NOW() WHERE id='$idsession'"); // Updating cps and mark because the difference from mark and now was 10 seconds.
}
 }
}

to Algomorph: Why did you change NOW() ) > 10 to NOW() ) > 1000 by the way?
Plus: The problem I am having at the moment is that when I press the button “djahff” it updates the timestamp “mark” but not the integer “cps”.

Thanks 🙂 – We’re getting closer!

  • 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-13T18:46:00+00:00Added an answer on June 13, 2026 at 6:46 pm

    I’m not sure which DBMS you’re using, but you could do exactly what you described the following way. Make two columns:

    • integer [clicks]
    • timestamp [mark]

    When the user clicks, check [mark] and compare it to current date & time. If there is a more than 10 second difference, set [clicks] to 1 and mark to the current date & time (NOW() function in mysql, current_timestamp() function in PostgreSQL).

    Otherwise, check [clicks]. If it exceeds 200, kick the user out. Otherwise, increment it by one.

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

Sidebar

Related Questions

Possible Duplicate: How can I make XSLT work in chrome? I have this XML
I have no clue of where to start on this. I've never done any
I have no clue how to validate this string. I am simply supplying an
I am new to Objective-C and I have no clue why this code is
I need to have a button to save the current web site (just like
Im totally new to javascript and i have no clue how to get this
I have no clue how i can get an existing object structure based on
I have no clue what an anonymous type is in C# nor how it
I have a clue about Object Oriented Programming: I need to have a parent
I have searched for hours however I still have no clue what is wrong

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.