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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:00:07+00:00 2026-05-17T22:00:07+00:00

Im using ajax call to insertmsg.php to insert a message. Now javascript isn’t a

  • 0

Im using ajax call to insertmsg.php to insert a message.

Now javascript isn’t a realtime language so i can not count on having an disabling button at the top of the ajax function.

So I wonder how I can make a timelimit to the insertmsg.php with:
mysql_query(“INSERT INTO.. , with a delay on 2 seconds, without storing last time the user wrote in the database. Or is that the only way? How can I do it with session maybe?

  • 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-17T22:00:07+00:00Added an answer on May 17, 2026 at 10:00 pm

    I think I understand what you want. But you English is very bad…

    You want to prevent the user from sending messages at intervals smaller than 2 seconds.

    You can do this both on the client side and on the server side, but the client side check can be easily disabled by a willing user.

    To do it on the server side, in PHP, you need to store the time when the user last sent a message.

    $_SESSION['lastMessageTime'] = time();
    

    When a call for a new insert is made you just check

    if(time() - $_SESSION['lastMessageTime'] <= 2)
        exit('Not allowed!')
    

    Don’t forget to enable you session before using the $_SESSION variable.


    Or maybe you want your script to do the insert with a delay of 2 seconds?

    You can wait in PHP with the sleep function. Or you can delay an action in JavaScript with setTimeout.

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

Sidebar

Related Questions

I am trying to pass a dataString to to an ajax call using JQuery.
I'm using $.post() to call a servlet using Ajax and then using the resulting
I am using .Net framework 2.0 / jQuery to make an Ajax call to
How would you access the cache from a jQuery ajax call? I'm using jquery
Help! I am using jQuery to make an AJAX call to fill in a
I am using the $.ajax function in jquery to make a call to an
Can you do ajax on ASP.net webform without using ajax toolkit? (Please post a
Hey guys How do I use the PHP variable $contact['id'] in my ajax call?
I'm using an ajax call to do a minor calculation then return the value
Heh, I'm using jQuery AJAX Call to pull data from a self hosted webservice

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.