خطا‌‌ها‌ی زیر رخ داد:
Warning [2] preg_replace_callback(): Requires argument 2, 'mwsshcode_check("$1","$2")', to be a valid callback - Line: 197 - File: inc/plugins/mwsshcode.php PHP 7.3.4 (Linux)
File Line Function
[PHP]   errorHandler->error
/inc/plugins/mwsshcode.php 197 preg_replace_callback
/inc/class_plugins.php 139 mwsshcode_run
/inc/class_parser.php 187 pluginSystem->run_hooks
/inc/functions_post.php 721 postParser->parse_message
/showthread.php 1063 build_postbit
Warning [2] preg_replace_callback(): Requires argument 2, 'mwsshcode_check("$1","$2")', to be a valid callback - Line: 197 - File: inc/plugins/mwsshcode.php PHP 7.3.4 (Linux)
File Line Function
[PHP]   errorHandler->error
/inc/plugins/mwsshcode.php 197 preg_replace_callback
/inc/class_plugins.php 139 mwsshcode_run
/inc/class_parser.php 187 pluginSystem->run_hooks
/inc/functions_post.php 752 postParser->parse_message
/showthread.php 1063 build_postbit




رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
تولید CAPTCHA راحت و قوی و قابل تنظیم
#1
[shcode=php]<?php

// Configuration
$height = 75;
$width = 300;
$length = 6;
$lineCount = 25;
$circleCount = 25;
$maxRadius = 50;
$space = 40;

// Generate random code
session_start();
$alpha = array_merge(range('a', 'z'), range('0', '9'));
$string = '';
for($i = 0; $i < $length; $i++) {
   $string .= $alpha[rand() % count($alpha)];
}
$_SESSION['captcha'] = $string;

// Create image
header('Content-type: image/png');
$im = imagecreate($width, $height);

// Create colors
$backColor = imagecolorallocate($im, 255, 255, 255);
$textColor = imagecolorallocate($im, 0, 127, 255);
$lineColor = imagecolorallocate($im, 127, 191, 255);

// Assign font
$font = './Disney.ttf';
$fontsize = $height * 0.75;

// Calculate the bounding box of the text
$box = imagettfbbox($fontsize, 0, $font, $string);

// Start position of the text
$positionX = ($width - $space * $length) / 2;

// Rotation Direction (1: Anti-clockwise, -1: Clockwise)
$direction = 1;

// Fill the image with background color
imagefill($im, $width / 2, $height / 2, $backColor);

// Write the text in the image using font, rotation, position, etc.
for($i = 0; $i < $length; $i++) {
   $char = substr($string, $i, 1);
   imagettftext($im, $fontsize, (rand() % 30 * $direction), $positionX, ($height - $box[5]) / 2 - 2, $textColor,  $font, $char);
   $direction = -$direction;
   $positionX += $space;
}

// Add lines to the image
for($i = 0; $i < $lineCount; $i++) {
   $x1 = rand() % $width;
   $y1 = rand() % $height;
   $x2 = rand() % $width;
   $y2 = rand() % $height;
   imageline($im, $x1, $y1, $x2, $y2, $lineColor);
}

// Add circles to the image
for($i = 0; $i < $circleCount; $i++) {
   $cx = rand() % $width;
   $cy = rand() % $height;
   $rx = rand() % $maxRadius;
   $ry = rand() % $maxRadius;
   $start = rand() % 360;
   $end = rand() % 360;
   imagearc($im, $cx, $cy, $rx, $ry, $start, $end, $lineColor);
}

imagepng($im);
imagedestroy($im);

?>[/shcode]
پاسخ
تشکر شده توسط: php




کاربران در حال بازدید این موضوع: 1 مهمان