Страница 2 из 2

Re: Не работает капча

Добавлено: 24 апр 2019, 15:53
Денис38
на опен сервере работает капча а на хостинге не хочет помогите вот код

Re: Не работает капча

Добавлено: 24 апр 2019, 15:55
Денис38
<?
session_start();

function __decode($text, $key) {
	$td = mcrypt_module_open ("tripledes", '', 'cfb', '');
	$iv_size = mcrypt_enc_get_iv_size ($td);
	$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
	if (mcrypt_generic_init ($td, $key, $iv) != -1) {
	$decode_text = substr(mdecrypt_generic ($td, base64_decode($text)),$iv_size);
	mcrypt_generic_deinit ($td);
	mcrypt_module_close ($td);
	return $decode_text; }
}
function hexToStr($hex) {
	$string='';
	for ($i=0; $i < strlen($hex)-1; $i+=2) { $string .= chr(hexdec($hex[$i].$hex[$i+1])); }
	return $string;
}



	$randomnr = __decode(hexToStr($_GET['id']), 'My#key-do-16-simvolov');
 
	$im = imagecreatetruecolor(70, 60);
 
	$white = imagecolorallocate($im, 255, 255, 255);
	$grey = imagecolorallocate($im, 219, 219, 219);
	$black = imagecolorallocate($im, 166, 66, 66);
	$color2 = imagecolorallocate($im, 159, 179, 204);

	imagefilledrectangle($im, 0, 0, 70, 60, $white);

	//path to font - this is just an example you can use any font you like:



	$fonts_c = 'ccp_1.otf';

	//$font// 
	$path_fonts = dirName(__FILE__).'/mane/fonts/'.$fonts_c;

	for($i=0;$i<4;$i++) {
	    imageline($im,0,rand()%50,100,rand()%100,$color2);
	}

	for($i=0;$i<15;$i++) {
    imagesetpixel($im,rand()%100,rand()%50,$grey);
	}
 
	imagettftext($im, rand(30,33), rand(2,8), 10, 45, $color2, $font, $randomnr);
 	
	//prevent caching on client side:
	header("Expires: Wed, 1 Jan 1997 00:00:00 GMT");
	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
	header("Cache-Control: no-store, no-cache, must-revalidate");
	header("Cache-Control: post-check=0, pre-check=0", false);
	header("Pragma: no-cache");
 
	header ("Content-type: image/gif");
	imagegif($im);
	imagedestroy($im);

?>