• 06-03-2014, 11:43:25
    #1
    Arkadaşlar buradaki Güvenlik Kodu Captcha http://www.vyz.gen.tr/php-basit-guve...tcha#comment-7
    uygulamasını formumu ekledim ancak bir sitede çalışıyor ama çalışmasını istediğim diğer farklı hostingde çalışmıyor güvenlik kodunu gösteren resim yerine hatalı imaj resmi çıkıyor ?

    Bunun çözümü nedir bir bilen varmı.
  • 06-03-2014, 11:53:25
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    @MehmetKS; bu betiği çalıştırdığınızda çıktı ne oluyor?

    <?php
    	
    	if(extension_loaded("gd"))
    	{
    		echo "GD eklentisi kurulu";
    	}
    	else
    	{
    		echo "GD eklentisi kurulu değil";
    	}
  • 06-03-2014, 12:00:43
    #3
    saintx adlı üyeden alıntı: mesajı görüntüle
    @MehmetKS; bu betiği çalıştırdığınızda çıktı ne oluyor?

    <?php
    	
    	if(extension_loaded("gd"))
    	{
    		echo "GD eklentisi kurulu";
    	}
    	else
    	{
    		echo "GD eklentisi kurulu değil";
    	}


    Hocam çalışan hostumdada çalışmayandada GD eklentisi kurulu sonucu alıyorum
  • 06-03-2014, 12:13:07
    #4
    @MehmetKS;

    form sayfası;

    <?php
    
    	header("Content-Type: text/html; charset=UTF-8");
    	session_start();
    
    ?><!DOCTYPE HTML>
    <html>
    	<body>
    		<?php
    			if(isset($_POST['guvenlikKodu']) && $_POST['guvenlikKodu'])
    			{
    				$guvenlikKontrol = false;
    				
    				if($_POST['guvenlikKodu'] == $_SESSION['guvenlikKodu'])
    				{
    					$guvenlikKontrol = true;
    				}
    				
    				if($guvenlikKontrol)
    				{
    					echo 'Güvenlik resmi doğru!';
    				}
    				else
    				{
    					echo 'Güvenlik resmini yanlış girdiniz!';
    				}
    			}
    		?>
    		<br />
    		<form method="POST">
    			<label for="guvenlikKodu">Güvenlik Kodunu Giriniz: </label>
    			<input type="text" name="guvenlikKodu" id="guvenlikKodu" required />
    			<br />
    			<img src="captcha.php" />
    			<br />
    			<input type="submit" value="Gönder" />
    		</form>
    	</body>
    </html>
    captcha.php
    <?php
    	
    	session_start();
    	
    	$font = "arial.ttf";
    	$width = "84";
    	$height = "22";
    	$hane = "6";
    	
    	function rastgele($text)
    	{
    		$mevcut = "abcdefghjkmnprstuxvyz23456789ABCDEFGHJKMNPRSTUXVYZ";
    		$salla = "";
    		
    		for($i=0; $i < $text; $i++)
    		{
    			$salla .= $mevcut{rand(0,48)};
    		}
    		
    		return $salla;
    	}
    	
    	$metin = rastgele($hane);
    	
    	
    	$resim_yaz = imagecreate($width, $height);
    	imagecolorallocate($resim_yaz, 255, 255, 255);
    	
    	$text_renk = imagecolorallocate($resim_yaz, 255, 165, 0);
    	$bg1 = imagecolorallocate($resim_yaz, 244, 244, 244);
    	$bg2 = imagecolorallocate($resim_yaz, 227, 239, 253);
    	$bg3 = imagecolorallocate($resim_yaz, 207, 244, 204);
    	
    	header("Content-type: image/png");
    	imagettftext($resim_yaz, 26, -4, 4, 25, $bg1, $font, $metin);
    	imagettftext($resim_yaz, 30, -7, 0, 15, $bg2, $font, $metin);
    	
    	for($i=0; $i < ($width*$height) / 400; $i++)
    	{
    		imageline($resim_yaz, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $bg3);
    	}
    	
    	imagettftext($resim_yaz, 14, 3, 7, 17, $text_renk, $font, $metin);
    	imagepng($resim_yaz);
    	imagedestroy($resim_yaz);
    	
    	$_SESSION["guvenlikKodu"] = $metin;
    captcha.php'nin olduğu dizinde arial.ttf dosyası olması gerekiyor.
  • 06-03-2014, 15:04:11
    #5
    Var hocam arial ama olmuyor hosstta sorun ama nedir çözemedim.
  • 06-03-2014, 15:33:41
    #6
    @MehmetKS; error_log dosyası oluşuyor mu? oluşuyorsa içeriğini konuya ekleyebilir misin?
  • 06-03-2014, 16:06:33
    #7
    @MehmetKS, error_reporting(E_ALL); şeklinde yapıp sadece captcha.php çalıştırdığında ne çıkıyor örnek site yok mu bakalım bizde?
  • 07-03-2014, 11:26:24
    #8
    Arkadaşlar yardımlarınızdan dolayı teşekkürler hosting sağlayıcıyla görüştüm sorun halloldu

    Talebiniz ile ilgili olarak, path yolunuzu aşağıdaki gibi düzenlemenizi rica ederiz.

    $font = "/home/alanadi.com/httpdocs/arial.ttf";