السلام عليكم ورحمة الله وبركاته
لقد أردت أن أجرب كود captcha ولكنه لم يعمل أردت التأكد من تفعيل extension php_gd2 فوجدته مفعل

هل هناك شيءٌ أخر علي فعله حتى يعمل الكود
شكراً
السلام عليكم ورحمة الله وبركاته
لقد أردت أن أجرب كود captcha ولكنه لم يعمل أردت التأكد من تفعيل extension php_gd2 فوجدته مفعل

هل هناك شيءٌ أخر علي فعله حتى يعمل الكود
شكراً
لتتأكد فعلا من أن gd مفعلة ضع التالي في صفحة PHP و أنظر هناك إن كان ل GD وجود:
<?php phpinfo(); ?>
''اللهم إني أسالك إيمانا دائما وأسألك قلبا خاشعا وأسألك علما نافعا وأسألك يقينا صادقا وأسألك دينا قيما وأسألك العافية من كل بلية''
'اللهم أغفر للمؤمنين و المؤمنات و المسلمين و المسلمات الأحياء منهم و الأموات'
www.it-scoop.com
هل يمكنك أن تضع السكريبت هنا، جرب أيضا تفريغ الكاش الخاص بالمتصفح.
''اللهم إني أسالك إيمانا دائما وأسألك قلبا خاشعا وأسألك علما نافعا وأسألك يقينا صادقا وأسألك دينا قيما وأسألك العافية من كل بلية''
'اللهم أغفر للمؤمنين و المؤمنات و المسلمين و المسلمات الأحياء منهم و الأموات'
www.it-scoop.com
هذا هو السكريبت
<?php
/*
Neoterranos & LkY
Page captcha.php
Génère un captcha.
Quelques indications : (utiliser l'outil de recherche et rechercher les mentions données)
Liste des fonctions :
--------------------------
Aucune fonction
--------------------------
Liste des informations/erreurs :
--------------------------
Aucune information/erreur
--------------------------
*/
session_start();
header ("Content-type: image/png");
$image = imagecreate(320, 100);
$blanc = imagecolorallocate($image, 255, 255, 255);
$noir = imagecolorallocate($image, 0, 0, 0);
$gris = imagecolorallocate($image, 200,200,200);
$jaune = imagecolorallocate($image, 255, 255, 0);
$rouge = imagecolorallocate($image, 200, 39, 45);
$vert = imagecolorallocate($image, 45, 255, 39);
$cyan = imagecolorallocate($image, 0, 255, 255);
$magenta = imagecolorallocate($image, 200, 0, 200);
$orange = imagecolorallocate($image, 255, 160, 0);
$bleu = imagecolorallocate($image, 60, 75, 200);
$bleuclair = imagecolorallocate($image, 156, 227, 254);
$vertf = imagecolorallocate($image, 20, 140, 17);
/*$Anoir = imagecolorallocatealpha($image, 0, 0, 0, 80);
$Ajaune = imagecolorallocatealpha($image, 255, 255, 0, 80);
$Ablanc = imagecolorallocatealpha($image, 255, 255, 255, 80);
$Arouge = imagecolorallocatealpha($image, 200, 39, 45, 80);
$Avert = imagecolorallocatealpha($image, 45, 200, 39, 80);
$Acyan = imagecolorallocatealpha($image, 0, 255, 255, 80);
$Amagenta = imagecolorallocatealpha($image, 255, 0, 255, 80);
$Aorange = imagecolorallocatealpha($image, 255, 128, 0, 80);
$Ableu = imagecolorallocatealpha($image, 39, 45, 200, 80);
$Ableuclair = imagecolorallocatealpha($image, 156, 227, 254, 80);
$A2noir = imagecolorallocatealpha($image, 0, 0, 0, 25);
$A2jaune = imagecolorallocatealpha($image, 255, 255, 0, 25);
$A2blanc = imagecolorallocatealpha($image, 255, 255, 255, 25);
$A2rouge = imagecolorallocatealpha($image, 200, 39, 45, 25);
$A2vert = imagecolorallocatealpha($image, 45, 200, 39, 25);
$A2cyan = imagecolorallocatealpha($image, 0, 255, 255, 25);
$A2magenta = imagecolorallocatealpha($image, 255, 0, 255, 25);
$A2orange = imagecolorallocatealpha($image, 255, 128, 0, 25);
$A2bleu = imagecolorallocatealpha($image, 39, 45, 200, 25);
$A2bleuclair = imagecolorallocatealpha($image, 156, 227, 254, 25);*/
//Toutes les couleurs
$colors = Array($vert, $noir, $jaune, $blanc, $rouge, $cyan, $magenta, $orange, $bleu, $bleuclair, $gris, $vertf);
$Tcolors = count($colors);
/*$colors2 = Array($Avert, $Anoir, $Ajaune, $Ablanc, $Arouge, $Acyan, $Amagenta, $Aorange, $Ableu, $Ableuclair);
$Tcolors2 = count($colors2);
$colors3 = Array($A2vert, $A2noir, $A2jaune, $A2blanc, $A2rouge, $A2cyan, $A2magenta, $A2orange, $A2bleu, $A2bleuclair);
$Tcolors3 = count($colors3);*/
//couleurs autorisées pour les caractères
$Lcolors = Array($noir, $rouge, $magenta, $bleu, $vertf);
$TLcolors = count($Lcolors);
$polices = Array('arial'); //Pensez à en rajouter !!
$Tpolices = count($polices);
//définition des caractères autorisés.
$carac = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$Tcarac = strlen($carac);
//définition des lignes noires
$nb_lignes = mt_rand(3,7);
$i = 1;
while($i<=$nb_lignes)
{
ImageLine($image, mt_rand(0,40), mt_rand(0,100), mt_rand(280, 320), mt_rand(0,100), $noir);
$i++;
}
//définition des lignes colorées.
$nb_lignes = mt_rand(3,7);
$i = 1;
while($i<=$nb_lignes)
{
ImageLine($image, mt_rand(0,40), mt_rand(0,100), mt_rand(280,320), mt_rand(0,100), $colors[mt_rand(0,$Tcolors-1)]);
$i++;
}
//définition des ellipses
$nb_ellipses = mt_rand(1,6);
$i = 1;
while($i<= $nb_ellipses)
{
ImageEllipse($image, mt_rand(0,320), mt_rand(0,100), 25+mt_rand(0,15), 25+mt_rand(0,15), $colors[mt_rand(0,$Tcolors-1)]);
$i++;
}
//définition des triangles
$nb_triangles = mt_rand(1,6);
$i = 1;
while($i<=$nb_triangles)
{
$array = Array(mt_rand(0,300), mt_rand(0,100), mt_rand(0,300), mt_rand(0,100), mt_rand(0,300), mt_rand(0,100));
ImagePolygon($image, $array, 3, $colors[mt_rand(0,$Tcolors-1)]);
$i++;
}
$aupifcolor = $Lcolors[mt_rand(0,$TLcolors-1)]; //la couleur des caractères
$ecart = 300/10+4; //écart entre les caractères
$_SESSION['captcha'] = ''; //La voilà !! Enfin !!
$i = 0;
while($i <= 7)
{
$lettre = $carac[mt_rand(0, $Tcarac-1)]; //choix de lettre
$_SESSION['captcha'] .= $lettre; //stockage
$taille = mt_rand(35,45); //taille
$angle = mt_rand(-35,35); //angle
$y = mt_rand(55, 60); //ordonnée
$police = $polices[mt_rand(0, $Tpolices-1)]; //police :p
imagettftext($image, $taille, $angle, $ecart*$i+15, $y, $aupifcolor, 'polices/'.$police.'.ttf', $lettre);
$i++;
}
imagepng($image); //On envoie et on prie :p
?>ملاحظة: السكريبت لوس من إنتاجي هو من إنتاج Neoterranos و LkY أخذته من موقع http://www.siteduzero.com/
تم تعديل هذه المشاركة بواسطة kaizuku في 10 يونيو 2011 في 20:44
الخطأ بسيط يا أخي، هذا سكريبت يحتاج إلى نوع خط كما هو مبين في السطر الآتي:
$polices = Array('arial'); //ضع إسم ملف نوع الخطو هنا نقوم بإستدعاء الخط من المجلد الذي يحتوي على الخطوط:
imagettftext($image, $taille, $angle, $ecart*$i+15, $y, $aupifcolor, 'polices/'.$police.'.ttf', $lettre);
بكل إختصار أنشئ مجلد بإسم polices و بداخله ضع ملف الخط بإسم arial.ttf.
''اللهم إني أسالك إيمانا دائما وأسألك قلبا خاشعا وأسألك علما نافعا وأسألك يقينا صادقا وأسألك دينا قيما وأسألك العافية من كل بلية''
'اللهم أغفر للمؤمنين و المؤمنات و المسلمين و المسلمات الأحياء منهم و الأموات'
www.it-scoop.com
لقد جربت السكريبت و عمل معي فقط تأكد من المسار.
''اللهم إني أسالك إيمانا دائما وأسألك قلبا خاشعا وأسألك علما نافعا وأسألك يقينا صادقا وأسألك دينا قيما وأسألك العافية من كل بلية''
'اللهم أغفر للمؤمنين و المؤمنات و المسلمين و المسلمات الأحياء منهم و الأموات'
www.it-scoop.com
هذا ما يحييرني أن السكريبت صحيح والمكتبة مفعلة ولكن لا يعمل
هناك شيءٌ ما ناقص علي فعله والأرجح أنه في إعدادات PHP
ولكن لا أعلم ماهو
جرب تغيير الآتي:
imagettftext($image, $taille, $angle, $ecart*$i+15, $y, $aupifcolor, $police.'.ttf', $lettre);
إجعل إسم الملف arial.ttf.
''اللهم إني أسالك إيمانا دائما وأسألك قلبا خاشعا وأسألك علما نافعا وأسألك يقينا صادقا وأسألك دينا قيما وأسألك العافية من كل بلية''
'اللهم أغفر للمؤمنين و المؤمنات و المسلمين و المسلمات الأحياء منهم و الأموات'
www.it-scoop.com
طبعاً هذا هو إسمه يعني أنا لست مبتدئ لدرجة أني لا أعرف هذه الأشياء أنا فاهم السكريبت جيداً ولكن كما سبق وقلت
هناك شيءٌ ما ناقص علي فعله والأرجح أنه في إعدادات PHP
انني أعمل على easyPHP ربما هناك إعدادات تختلف فيه عن باقي السيرفرات
اقتباسطبعاً هذا هو إسمه يعني أنا لست مبتدئ لدرجة أني لا أعرف هذه الأشياء أنا فاهم السكريبت جيداً ولكن كما سبق وقلت
لم أقصد هذا يا أخي، كل ما قمت به هو حذف المجلد لأتفادى مشكل التصاريح.
''اللهم إني أسالك إيمانا دائما وأسألك قلبا خاشعا وأسألك علما نافعا وأسألك يقينا صادقا وأسألك دينا قيما وأسألك العافية من كل بلية''
'اللهم أغفر للمؤمنين و المؤمنات و المسلمين و المسلمات الأحياء منهم و الأموات'
www.it-scoop.com
أنا أجرب الكود على سرفير محلي على الويندوز يعني ليس هناك مشكل تصاريح
هل تعرف موقع استضافة مجاني به مكتبة ال-gd مفعلة لكي أجرب عليه
شكراً لك واعذرني عذبتك معي
110mb.com عيبه الوحيد لايعطي قواعد بيانات أو freehostia.com.
''اللهم إني أسالك إيمانا دائما وأسألك قلبا خاشعا وأسألك علما نافعا وأسألك يقينا صادقا وأسألك دينا قيما وأسألك العافية من كل بلية''
'اللهم أغفر للمؤمنين و المؤمنات و المسلمين و المسلمات الأحياء منهم و الأموات'
www.it-scoop.com