21
sailjapan
Re: NewBB Spam Posts - Any simple challenge hack avail?

Just wanted to say that I got Security Image working on my site at last.

Happy to assist anyone having trouble with it if their set up is similar to mine.
Namely:

xoops = 2.0.13.2
PHP = 4.4.1
MySQL = 4.1.21
cbb 1.16.2 (sometimes called 1.16a)
DuGris Security Image
Never let a man who does not believe something can be done, talk to a man that is doing it.

22
Tobias
Re: NewBB Spam Posts - Any simple challenge hack avail?
  • 2006/9/23 6:44

  • Tobias

  • Not too shy to talk

  • Posts: 172

  • Since: 2005/9/13


Thanks GlaDiaC, thanks Defkon1. With the kind help of the two of you, I finally got it to work on my site as well. XOOPS 2.24 and PhP 5+.

I'm currently using it with CBB3+. Should anyone not be able to figure out where to drop the code in that module, I will happily share what I've done.

23
chippyash
Re: NewBB Spam Posts - Any simple challenge hack avail?
  • 2006/9/25 17:45

  • chippyash

  • Friend of XOOPS

  • Posts: 501

  • Since: 2004/1/29


Code is not available at download location given by DuGris. If anyone knows where it is and wants to give it a permanent home, I'll take at xoobs.net.

I already wrote smething like this for my own use but am happy to give this a home.

regards
Ashley

24
sailjapan
Re: NewBB Spam Posts - Any simple challenge hack avail?

@akitson
the Security Image code is download-able here.

instructions for use with News 1.44 here.

instructions for use with Newbb 1.16 here (also works with 1.16a/1.16.2)

instructions for use with Wordbook 1.16 here.

instructions for use with Formulaire v.3.23 here.

instructions for use with WFdownloads v.3+ here.
Never let a man who does not believe something can be done, talk to a man that is doing it.

25
DuGris
Re: NewBB Spam Posts - Any simple challenge hack avail?
  • 2006/9/26 0:15

  • DuGris

  • Core Developer

  • Posts: 67

  • Since: 2004/3/14


A new version compatible PHP5 : HERE

26
chippyash
Re: NewBB Spam Posts - Any simple challenge hack avail?
  • 2006/9/26 7:04

  • chippyash

  • Friend of XOOPS

  • Posts: 501

  • Since: 2004/1/29


Here's the instructions for using with Liaise:

1/ copy files from distribution (NB on a XOOPS 2.2 installatio, copy only lines from language/lang/global.php that are required for securityimage to work: they are clear to see.)

2/ chmod the uploads/securityimage/cache directory to 0777

3/ add following line to end of root/class/xoopsformloader.php

Quote:
//added for DuGris security image
include_once XOOPS_ROOT_PATH."/class/xoopsform/securityimage.php";


4/ add following lines to root/modules/liase/index.php before the line that reads
include 'include/form_execute.php';

Quote:
// Hack for SecurityImage
include_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
if ( defined('SECURITYIMAGE_INCLUDED')) {
if (!SecurityImage::CheckSecurityImage() ) {
redirect_header( XOOPS_URL."/modules/liaise/index.php?form_id=".$form_id, 2, _SECURITYIMAGE_ERROR ) ;
exit();
}
} else {
die('Unable to load SecurityImage library');
}
// End Hack for SecurityImage


5/ add the following lines to root/modules/liaise/include/form_render.php after the line that reads (at about line 59)
$form_output->addElement(new XoopsFormHidden('form_id', $form->getVar('form_id')));

Quote:
// Hack for SecurityImage
if ( defined('SECURITYIMAGE_INCLUDED') ) {
$security_image = new SecurityImage( _SECURITYIMAGE_GETCODE );
if ($security_image->render()) {
$form_output->addElement($security_image, true);
}
else {
die('Unable to load SecurityImage library');
}
}
// End Hack SecurityImage


BTW, you can see this working at xoobs.net

Regards
Ashley

27
chippyash
Re: NewBB Spam Posts - Any simple challenge hack avail?
  • 2006/9/26 7:33

  • chippyash

  • Friend of XOOPS

  • Posts: 501

  • Since: 2004/1/29


DuGris

As you can see from my other posts, I've got this working with Liaise. I have a suggestion to enhance your hack:

Instead of simply displaying a message that the GD library is not available when it isn't you might consider substituting a text mode security number. I found this solution whilst looking into my own method of doing what you have done. Take a look at this code that I found on phpclasses.org

Quote:
/**
* Project: CheckSpam
* Version: 1.2.2
* File: checkspam.class.php
* Author: Giuseppe Leone (joseph@masterdrive.it)
* URL: http://www.masterdrive.it
* Note: Class that prevents Spam attacks
* License: GPL 2
* Last upd: 09 / 05 / 2006
*/

class checkspam {
/**
* Main setting parameters
*/
var $session_start = true; // Start or continue sessions
var $style = array(); // Define the main graphical settings for the non-graphic mode (CSS Style)
var $path = "./"; // Define the path of the class (as default value have the main document's root)

var $imagetext; // Image/Text verification content
var $tmp_img; // Temporary Image name
var $graphic; // Set the graphical mode to on, if the GD library is available with PNG support
var $sess_name; // The name of the session
var $sess_value; // The value of the session (SECRET CODE)
var $sess_counter = 0; // Number of session created in the same document
var $gd_info = array(); // Informations about GD Library

// Logs are stored into this variable
var $log = "LOG STARTS HERE:\n-----\n";

/**
* Constructor
*/
function checkspam(){
// Main directory
if(defined('CHECKSPAM_DIR')){
$this->path = CHECKSPAM_DIR;
}

// Delete the old images
$this->free();

// Initialize the default styles for the text mode verification
$this->style['text-align'] = "center";
$this->style['font-size'] = "20";
$this->style['font-family'] = "courier, verdana, arial";
$this->style['color'] = "#FF0000";
$this->style['background-color'] = "#F5F5F5";
$this->style['border-width'] = "2px";
$this->style['border-style'] = "solid";
$this->style['border-color'] = "#FFCC00";
$this->style['width'] = "80px";
$this->style['line-height'] = "20px";
}

/**
* Method to delete the old temporary verification Images
*/
function free(){
// Delete the all old temporary images
foreach(glob($this->path."*.png") as $tmp)
unlink($tmp);
}

/**
* Register a new session Session
*/
function register_session(){
// Register a new session with new value
$this->sess_name = "checkSpam".session_id().$this->sess_counter;
$this->sess_value = $this->create_secretcode();

$_SESSION[$this->sess_name] = $this->sess_value;
$this->write_log("Session: $this->sess_name registered successfully with the value of: $this->sess_value !");

// Increment session counter
$this->sess_counter++;
}

/**
* Starts generate the secret code
*/
function create_secretcode(){
return substr(md5(rand()),0,4);
}

/**
* Generate the temporary PNG image verfication
*/
function create_image(){
// Create the image
$this->imagetext = imagecreatetruecolor(80,30);
// Create the rectangle with borders
imagefilledrectangle($this->imagetext, 0, 0, 80, 30, imagecolorallocate($this->imagetext,150,150,150));
imagefilledrectangle($this->imagetext, 1, 1, 78, 28, imagecolorallocate($this->imagetext,255,255,255));
//Adding some verticals lines
for($i = 5; $i < 75; $i += 10){
//Draw the line
imageline(
$this->imagetext,
rand($i - 2, $i + 2),
1,
rand($i - 2, $i + 2),
28,
imagecolorallocate($this->imagetext,rand(150,200),rand(150,200),rand(150,200))
);
}
//Adding some horizontal lines
for($i = 5; $i < 30; $i += 10){
//Draw the line
imageline(
$this->imagetext,
1,
rand($i - 2, $i + 2),
78,
rand($i - 2, $i + 2),
imagecolorallocate($this->imagetext,rand(150,200),rand(150,200),rand(150,200))
);
}
// Add the secret code
$x = 5; // Space blank between evey character
for($i = 0; $i < strlen($this->sess_value); $i++){
imagettftext(
$this->imagetext,
18,
rand(-20,20),
$x,
rand(20,25),
imagecolorallocate($this->imagetext,rand(50,200),rand(50,200),rand(50,200)),
$this->path."fonts/hockey.ttf",
$this->sess_value{$i}
);
$x += 20;
}
//Applies some distortion effects
imagefilter($this->imagetext, IMG_FILTER_SMOOTH, 15);
// Save the temporary image into the path of the class
$this->tmp_img = $this->path.$this->sess_name.time();
imagepng($this->imagetext,$this->tmp_img.".png");
}

/**
* Build new image/text verification
*/
function create_imagetext(){
// Check if the graphic mode is enabled or the GD Library Extension is available
if($this->graphic && $this->check_gdlibrary()){
// Call the function to create the temporary image verfication
$this->create_image();
$this->imagetext = "tmp_img.".png\" border=\"0\" alt=\"secret code\" title=\"secret code\" />";
$this->write_log("Starts create IMAGE verification !");
}else{
// Text mode
$this->imagetext = "
foreach($this->style as $key => $value){
$this->imagetext .= "$key:$value; ";
}
$this->imagetext .= "\">$this->sess_value
";
$this->write_log("Starts create TEXT verification !");
}

}

/**
* Check if the GD library is available
* We can extends this methods to permit many other types of image format, such as JPEG, GIF and much more...
*/
function check_gdlibrary(){
if(function_exists('gd_info')){
$this->gd_info = gd_info();
if($this->gd_info['PNG Support']){
$this->write_log("GD Library Extension are available, version: ".$this->gd_info['GD Version']." with PNG Support !");
return true;
}else{
$this->write_log("GD Library Extension are available, version: ".$this->gd_info['GD Version']." without PNG Support !");
return false;
}
}else{
$this->write_log("GD Library Extension are not available !");
return false;
}
}

/**
* method to write to the log
* @param string $message Message to write to the log
*/
function write_log($message){
if(strlen($message) > 0)
$this->log .= date("[m d Y - H:i]")." $message\n";
}

/**
* Starts or continues Session
*/
function init_session(){
if(!session_id() && $this->session_start){
session_start();
$this->write_log("Sessions started !");
}else{
$this->write_log("Sessions is already started !");
}
}

/**
* Execute the complete procedure to create an anti-spam control
* @param char $type (0 = Text | 1 = Image) The type of verification
*/
function exec_checkspam($type = 1){
// Set the type of verification
$this->graphic = ($type == 1) ? true : false;
// Try to init or continue a session
$this->register_session();
// Starts building new code image/text verification
$this->create_imagetext();
}

/**
* Method to print out the Image/Text verification
*/
function print_imagetext(){
echo $this->imagetext;
}

/**
* Method to print out the Input Form
* @param string $params Some paramters for the input form
*/
function print_input($params = "name=\"secretcode\""){
// Check if exist an image / text code verification to input
if($this->sess_counter != 0){
echo "sess_name\" />";
echo "sess_value)."\" />";
$this->write_log("Input form printed out for: $this->sess_name !");
}else{
$this->write_log("Image or text does not exist for the verification of the code for: $this->sess_name !");
}
}

/**
* Method to verify the code sent by the form
* @param string $code The code sent by the form
*/
function verify($code){
// Try to retrieve information about the input
if(isset($_POST["checkspam"])){
// Work with POST values
$this->sess_value = $_SESSION[$_POST["checkspam"]];
}else{
if(isset($_GET["checkspam"])){
// Work with GET values
$this->sess_value = $_SESSION[$_GET["checkspam"]];
}else{
// No data to check
return false;
}
}
// Check the code
return ($code == $this->sess_value) ? true : false;
}

/**
* Method to print out the log
*/
function print_log(){
//Print out the log var content
echo "$this->log";
}
}
?>


Hope it helps

Regards
Ashley

28
LucaNet
Re: NewBB Spam Posts - Any simple challenge hack avail?
  • 2006/10/19 21:00

  • LucaNet

  • Friend of XOOPS

  • Posts: 90

  • Since: 2006/5/25


I like SecurityImage but I think the images are not enough clear.

Greetings!

29
sailjapan
Re: NewBB Spam Posts - Any simple challenge hack avail?

images not clear?

Change the fonts in uploads/securityimage/fonts/

change the values of the following in root/class/xoopsform/securityimage.php

Reduce the number of digits.
Quote:
$NumChar (int) = Nombre de caractères du code


Increase the font size.
Quote:
$MinFontSize (int) = Taille minimum pour la hauteur du texte
$MaxFontSize (int) = Taille maximum pour la hauteur du texte


Choose your background.
Quote:
$BackgroundType (int) = Type de fond


Reduce the colours used for fonts.
Quote:
$NumBackground (int) = Nombre de couleurs pour le fond d'image (0 = blanc)



Quote:
Type de fond :
0=Grille
1=Cercles
2=Lignes
3=Rectangles
4=Ellipses
5=Polygones
100=Fichier (GIF/JPG/PNG)
Never let a man who does not believe something can be done, talk to a man that is doing it.

30
LucaNet
Re: NewBB Spam Posts - Any simple challenge hack avail?
  • 2006/10/19 23:38

  • LucaNet

  • Friend of XOOPS

  • Posts: 90

  • Since: 2006/5/25


Thank you sail,

the changes in root/class/xoopsform/securityimage.php are enough simple, but I don't understand how can I change the fonts in uploads/securityimage/fonts/

Can you explain me that?

Also, should I give chmod 755 to root/class/xoopsform/securityimage.php?

Login

Who's Online

344 user(s) are online (309 user(s) are browsing Support Forums)


Members: 0


Guests: 344


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits