View Single Post
  #1  
Old 31st October 2023, 02:14
hon hon is offline
Senior Member
 
Join Date: Oct 2020
P2P
Posts: 66
Default Simple Captcha For TorrentStrike 0.4F
This is a simple captcha system for TorrentStrike 0.4F

It is extremely lightweight and it will not slow down the old servers.
  • No MySQL need.
  • Not storing all the images.
  • gif as image format (~=100-120bytes each img)

Preview:
Click the image to open in full size.
Click the image to open in full size.

Installation:
1. Copy captcha.php to TorrentStrike 0.4F root.
2. Add this row to the form.
PHP Code:
<tr><td class="rowhead"><img src='captcha.php?ext=.gif' onClick="this.src='captcha.php?ext=.gif';" title="Click to refresh."></td><td class="row1" align="left"><input type="text" size="6" name="captacha" /></td></tr
3. Add these rows for verification in takelogin / takesignup / recover... for verification.
PHP Code:
require_once("captcha.php");
if(!
verifycaptcha($captacha)){
    
bark("Bad captcha.");

PHP Code:
<?php
/* +----------------+
   | hon Captcha    |
   +----------------+
   | Simple Captcha |
   | Ver: 1.0.00    |
   | hon Code 2023  |
   | D30-M10-Y2023  |
   +----------------+
    https://hon-code.blogspot.com/
    https://honcode.blogspot.com/
*/


/*======================================+
 | Example usage:                       |
 +--------------------------------------+
    Firstly place this file on the root path of TorrentStrike 0.4F
 
    Frontend [login]:
    =============
<tr><td class="rowhead"><img src='captcha.php?ext=.gif' onClick="this.src='captcha.php?ext=.gif';" title="Click to refresh."></td><td class="row1" align="left"><input type="text" size="6" name="captacha" /></td></tr>

    Backend [takelogin] (place it before the username and password checks):
    =============
require_once("captcha.php");
if(!verifycaptcha($captacha)){
    bark("Bad captcha.");
}
    
 +======================================*/
function mkcaptcha(){
    if(
session_status() === PHP_SESSION_NONE)
        @
session_start();
    unset(
$_SESSION['hon_captcha']);
    
$_SESSION['hon_captcha']=rand(100000,999999);
}
function 
verifycaptcha($e){
    if(
session_status()===PHP_SESSION_NONE)
        @
session_start();
    if(
intval($_SESSION['hon_captcha'])===intval($e))
        return 
true;
    else
        return 
false;
}

if(isset(
$_GET['ext'])){
    if(
session_status() === PHP_SESSION_NONE)
        
session_start();

    
$hnimg=imagecreate(46,16);
    
imagecolorallocate($hnimgrand(0,180), rand(0,180), rand(0,180)); 

    
$txtcolor=imagecolorallocate($hnimg,255,255,255);

    
mkcaptcha();
    
imagestring($hnimg,3,2,1,$_SESSION['hon_captcha'],$txtcolor); 

    
header("Content-Type: image/gif"); 

    
imagegif($hnimg); 
    
imagedestroy($hnimg); 
}
?>
Attached Thumbnails
screencapture-localhost-login-php-2023-10-31-01_19_00.png  
Attached Images
 
Attached Files
File Type: php captcha.php (1.7 KB, 1 views)
__________________
TorrentTrader4Ever

If you want help about TorrentTrader send me a PM.

Last edited by hon; 31st October 2023 at 02:28.
Reply With Quote
The Following 2 Users Say Thank You to hon For This Useful Post:
Fynnon (1st November 2023), Timisoreanul (6th December 2023)