Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Torrent Strike (http://www.bvlist.com/forumdisplay.php?f=21)
-   -   Simple Captcha For TorrentStrike 0.4F (http://www.bvlist.com/showthread.php?t=12741)

hon 31st October 2023 02:14

Simple Captcha For TorrentStrike 0.4F
 
3 Attachment(s)
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:
https://i.imgur.com/61P9jSo.png
https://i.imgur.com/6SNCcli.png

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); 
}
?>



All times are GMT +2. The time now is 12:28.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.