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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:11:15+00:00 2026-05-22T16:11:15+00:00

As proposed by Stopping Bot [SO] – PHP i’ve developed a anti-bot system in

  • 0

As proposed by Stopping Bot [SO] – PHP i’ve developed a anti-bot system in PHP which code can be viewed at https://codereview.stackexchange.com/questions/2362/anti-bot-comment-system-php

But anyone can obtain a token by viewing getToken.php
In SO they get the token from stackauth.com [i think so by viewing page code], but when i browsed it it just showed some text !
How can i do something like that ? [token to be passed only when requested by the code, not by the browser]

The process of generating and verifying token
in the form page

$hash=sha1($time.$myKey);
echo $time.'#'.$hash;

In the poster/verification page

$token=explode($_POST['token'],'#',2);
if (sha1($token[0].$myKey)==$token[1])
 echo 'A good Human';  

Edit
I do not store used token in the database, and a token get expired after [say] 5 minutes !
Think a bad user gets the token 2011-05-18 11:10:12#AhAShKey000000000 he can use the token to submit random text to 2011-05-18 11:15:12, how can i fix this issue ?

  • 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-22T16:11:16+00:00Added an answer on May 22, 2026 at 4:11 pm

    After reading all the answer carefully i’ve developed this [thanx to all the people for their valuable comment and answer]

    <?php
    $time = microtime();
    for ($i=1;$i<=10000;$i++)
     generateMath();
    
    echo 'Generating '.$i.' math Took '.(microtime()-$time);
    
    function generateMath()
    {
     $operands = array(43,45,42);
     $val = chr(rand(48,57));
     $ope = chr($operands[rand(0,2)]);
     $txt = $val.$ope; //42* 43+ 45- 47/
     $val2 = chr(rand(48,57));
     $txt .= $val2;
     $ans = 0;
     if ($ope == '+')
      $ans = $val + $val2;
     else if ($ope == '-')
      $ans = $val - $val2;
     else if ($ope == '*')
      $ans = $val * $val2;
     echo $txt.' -> '.$ans.'<br/>';
    }
    ?>  
    

    This can be enhanced by adding random number of spaces in $txt = $val.$spaces.$ope.$spaces.$val2;

    And it was faster than CAPCHA, people will have to do a really simple math if they post more than 30 or so comments in an hour !

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

Sidebar

Related Questions

in this tutorial is proposed this file system: XXXBundle |---Features | |----FeaturesContext.php |---ProductCategoryRelation.feature where
I've been given a copy of a proposed site agreement in which one of
I'm struggling with improving script which I proposed as an answer to How to
I spotted a proposed C# coding-standard which stated Try to offer an interface with
My company has a project for which I proposed using SharePoint Enterprise 2010. We
In regards to this Haacked blog , I'm hesitant to implement the proposed anti-JSON
I'm looking to model in an RDBMS a meeting which has several proposed times,
I work at a small php shop and I recently proposed that we move
I have this bookmarklet, which follows what was proposed in this topic : javascript:
I proposed what I think is a better syntax for ASP.NET MVC views in

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.