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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:17:12+00:00 2026-05-12T14:17:12+00:00

The background: Ok, I run a legacy BBG over at ninjawars.net. There is an

  • 0

The background:
Ok, I run a legacy BBG over at ninjawars.net. There is an “attack” that players can make on other players that is initialized via form post. Essentially, we can simplify the situation to pretend that there’s a page, lets call it attack.php, with a giant “ATTACK” form post that submits to another php page, lets call it accept_attack.php, and the second page performs the attack functionality, lets say killing other player 1, 2, or 3.
The server runs PHP5, Postgresql, Apache

The problems:

  • If I hit that big “ATTACK” button, and it brings me to the accept_attack.php, I can then hit refresh three times, resubmitting each time, to attack again three times in succession.
  • If I open up three tabs of the first page, and hit attack on each page, I end up with three instantaneous attacks that kill players 1, 2, and 3 all at once, and I can just continually refresh to repeat.
  • Despite my attempts to have a “most recent attack” timer that gets saved to the database, players seem to be able to work around it, perhaps just by refreshing three copied tabs in a synchronized enough way, so that they may all retrieve the same timer (e.g. 10:00:00:0000 am) and thus proceed with the resulting processing.

The solution needed:

So how do I prevent the same processing of a certain script from being preformed all at once in triplicate?

Php, Social engineering, and/or javascript/jQuery solutions preferred (probably in about that order).

Edit:
Based on the answers, here’s what I did to (potentially, before stress testing) solve it:
The session answer seemed simplest/most comprehensible to implement, so I used that data store. I tested it and it seems to work, but there may be ways around it that I’m not aware of.

$recent_attack = null;
$start_of_attack = microtime(true);
$attack_spacing = 0.2; // fraction of a second
if(SESSION::is_set('recent_attack')){
    $recent_attack = SESSION::get('recent_attack');
}

if($recent_attack && $recent_attack>($start_of_attack-$attack_spacing)){
    echo "<p>Even the best of ninjas cannot attack that quickly.</p>";
    echo "<a href='attack_player.php'>Return to combat</a>";
    SESSION::set('recent_attack', $start_of_attack);
    die();
} else {
    SESSION::set('recent_attack', $start_of_attack);
}

If there’re ways to improve on that or ways that that is exploitable (beyond the one obvious to me that echoing stuff isn’t a good seperation of logic, I’d love to know. Along those lines, community-wiki-ed.

  • 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-12T14:17:13+00:00Added an answer on May 12, 2026 at 2:17 pm

    Similar to Godeke’s solutions. Couldn’t you generate a token with a hidden field on the “Attack” button form and store that in a session? Then on the accept-attack.php page you would check if the $_POST[‘token’] == $_SESSION[‘token’].

    so you would have something similar to this on the accept-attack.php page


    if($_POST['token'] == $_SESSION['token']){

           echo 'no cheating!';
                // or redirect to the attach page
       }else{
             $_SESSION['token'] = $_POST['token'];
             // then perform the attack
       } 
    

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

Sidebar

Related Questions

I've a legacy application using Asp.Net WebSite (winforms...) and I need run a background
I've read plenty of times that we only can run background tasks for location,
The Background I run an ASP.NET site using Graffiti CMS for a local charitable/service
There is a property called Application does not run in background and if we
I would like to create a program that will run in background as a
Background: I'm building a small application that will be run daily, pulling data from
I am trying to run a background thread (qthread) that needs to monitor a
In my application I need to have periodically run background tasks (which I can
I want to run a background task that reads input from a TextReader and
need a service that will run in background and it will awake after 30-120

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.