Example #1
0
<?php

/**
 * Test for SecurityImage class
 * 
 */
include "SecurityImage.php";
$secim = new SecurityImage();
$secim->show();
/**
 * To include the security image in your form
 * you can link to it as an image, e.g
 * 
 * <img src="display.php" />
 * 
 */
Example #2
0
            }
        } elseif (!empty($framework)) {
            $form->addElement(new XoopsFormCaptcha('', 'xoopscaptcha', true, 4, 12, 12, 0, 0), true);
        }
        // SecurityImage by DuGris
        $form->addElement(new XoopsFormButton('', 'submit', $send, 'submit'));
        $form->display();
        echo "<div>" . _AM_WARN . "</div>";
    } else {
        echo "<table class='outer' width='100%'><th><center><font size='4'>" . $title . "</font></center></th></table><div style='color: red; font-weight: bold; text-decoration: blink; font-size: x-large; text-align:center'>" . _AM_NOELE . "</div>";
    }
    include_once XOOPS_ROOT_PATH . '/footer.php';
} else {
    // SecurityImage by DuGris
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    if (defined('SECURITYIMAGE_INCLUDED') && !SecurityImage::CheckSecurityImage()) {
        $redirect = XOOPS_URL . "/modules/" . $modversion["dirname"] . "/formulaire.php?id=" . $_GET['id'] . "&qcm=" . $_GET['qcm'];
        redirect_header($redirect, 2, _SECURITYIMAGE_ERROR);
        exit;
    } elseif (!empty($framework)) {
        include_once XOOPS_ROOT_PATH . '/Frameworks/captcha/captcha.php';
        $security = new XoopsCaptcha();
        if (!$security->verify(true)) {
            if (!empty($_POST['pical_eventid'])) {
                $redirect = XOOPS_URL . "/modules/piCal/?event_id=" . intval($_POST['pical_eventid']);
            } else {
                $redirect = XOOPS_URL . "/modules/" . $modversion["dirname"] . "/formulaire.php?id=" . $_GET['id'] . "&qcm=" . $_GET['qcm'];
            }
            redirect_header($redirect, 2, XOOPS_CAPTCHA_INVALID_CODE);
            exit;
        }
<?php

// code from www.sitepoint.com
// include security image class
require 'security-image.inc.php';
// start PHP session
session_start();
// get parameters
isset($_GET['width']) ? $iWidth = (int) $_GET['width'] : ($iWidth = 50);
isset($_GET['height']) ? $iHeight = (int) $_GET['height'] : ($iHeight = 25);
// create new image
$oSecurityImage = new SecurityImage($iWidth, $iHeight);
if ($oSecurityImage->Create()) {
    // assign corresponding code to session variable
    // for checking against user entered value
    $_SESSION['registration_form_security_code'] = $oSecurityImage->GetCode();
} else {
    echo 'Image GIF library is not installed.';
}