Jump to content

anti flood remaining time to countdown?


Go to solution Solved by Jacques1,

Recommended Posts

hey all hope all good? well am back after sometime with an issue. well i got my anti flood working ok but what i need is instead of showing time i need to show backward countdown seconds types for next post. my current code which i wrote looks like this what must i do to get anti clock seconds till 1hours is over?

 

$stmt = "SELECT * FROM floodcontrol WHERE memberID = :memberID AND time >= DATE_SUB(NOW(), INTERVAL 1 HOUR)";
        $stmt = $db->prepare($stmt);
        $stmt->bindParam(':memberID', $uid, PDO::PARAM_STR);
        $stmt->execute();
        $f = $stmt->fetch();
$floodcontrol = $stmt->rowCount();
$nextpost = date("H:i:s A", strtotime($f['time'].' +1 hour'));

 

regards

Link to comment
https://forums.phpfreaks.com/topic/302106-anti-flood-remaining-time-to-countdown/
Share on other sites

flood? anti clock?

 

Whatever are you trying to say?

Well in my classified post page im stopping users for an hour till they can make another post, the current nextpost var displays the time an hour from post the original post time. I do i make it reverse as in 130 seconds remaining until you make your next post.

 

I hope you get my point?

Edited by lovephp
  • Solution

I have no idea what a “classified post” is, but if you want an actual countdown, you need JavaScript.

 

For example: Make an Ajax request, use PHP to calculate the number of seconds until the next possible submission, then start a JavaScript timer which shows and counts down those seconds. There are thousands of example scripts.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.