AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.112
Web Server : Apache
System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : coopiak ( 151928)
PHP Version : 8.3.23
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coopiak/amisdesseniors-fr/nice/components/com_rsfeedback/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/nice/components/com_rsfeedback/helpers/captcha.php
<?php
/**
 * @package RSFeedback!
 * @copyright (C) 2010-2018 www.rsjoomla.com
 * @license GPL, http://www.gnu.org/copyleft/gpl.html
 */

defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Factory;

class RSFeedbackCaptcha
{
	protected $code = null;

	protected function getFont()
	{
		return __DIR__ . '/monofont.ttf';
	}

	protected function generateCode($chars = 4) {
		$possible = 'aAbBcCdDeEfFgGhHjJkKLmMnNpPqQrRstTvVwWxXyYzZ2346789';
		$count = strlen($possible) - 1;
		$this->code = '';

		for ($i = 0; $i < $chars; $i++) {
			$this->code .= substr($possible, mt_rand(0, $count), 1);
		}

		Factory::getSession()->set('com_rsfeedback.captcha', $this->code);

		return $this->code;
	}

	public function getImage($chars = 4) {
		try {
			if (!function_exists('imagecreate')) {
				throw new Exception('imagecreate() not available.');
			}

			if (!function_exists('imagettfbbox')) {
				throw new Exception('imagettfbbox() not available.');
			}

			$code = $this->generateCode($chars);
			$font = $this->getFont();
			$font_size = 40;

			$box = imagettfbbox($font_size, 0, $font, 'M');

			$char_w = abs($box[4] - $box[0]);
			$char_h = abs($box[5] - $box[1]);

			$width = $char_w * ($chars + 2);
			$height = $char_h * 2.2;

			// Create the image
			$image = imagecreate(ceil($width), ceil($height));

			// Get a random text color
			$r = mt_rand(0, 255);
			$g = mt_rand(0, 255);
			$b = mt_rand(0, 255);

			// Fill the background with a complementary color
			imagecolorallocate($image, ($r < 128) ? 255 : 0, ($g < 128) ? 255 : 0, ($b < 128) ? 255 : 0);

			// Allocate text color
			$color = imagecolorallocate($image, $r, $g, $b);

			// Get a random angle
			$angle = mt_rand( 0, 5 ) * (mt_rand(0, 1) == 1 ? -1 : 1);

			// Get the box size
			$text_box_size = imagettfbbox($font_size, $angle, $font, $code);

			// Calculate position
			$x = ceil(($width - $text_box_size[4]) / 2);
			$y = ceil(($height - $text_box_size[5]) / 2);

			// Set a shadow
			$shadow_color = imagecolorallocate($image, floor($r / 2), floor($g / 2), floor($b / 2));
			imagettftext($image, $font_size, $angle, $x - 1, $y + 3, $shadow_color, $font, $code);

			// Write our text
			imagettftext($image, $font_size, $angle, $x, $y, $color, $font, $code);

			header('Content-Type: image/jpeg');

			imagejpeg($image);
			imagedestroy($image);
		} catch (Exception $e) {
			Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
		}
	}

	public function check($value) {
		if (!strlen($value)) {
			return false;
		}

		$code = Factory::getSession()->get('com_rsfeedback.captcha', '');

		if (!strlen($code)) {
			return false;
		}

		$caseSensitive = RSFeedbackHelper::getConfig('captcha_cases');

		if (!$caseSensitive) {
			$value = strtolower($value);
			$code = strtolower($code);
		}

		return (string) $value === (string) $code;
	}
}

Anon7 - 2022
AnonSec Team