الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

سؤال عن رقم عشوائي

مغلق
بدأه zarzor_2010 في 20 أغسطس 2006 · 4 رد · 443 مشاهدة · في منتدى تطوير المواقع بـ PHP
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

من فضلكوا اريد ان لقوم بعمل script لتسجيل بيانات عضو .. و يكون فيه خانة الرقم العشوائي و الصوره الغير الواضحة التي تظهر و التي يقوم اليوزر بكتابة الرقم الموجود بالصورة لتأكيد عملية التسجيل...

أرجو ان يكون السؤال واضح

كيف يمكن عمل ذلك؟؟؟

#2

السلام عليكم

1- استعد

2- مد رجل

3- امسك ورقة وقلم واكتب طلباتك ايه بالتفصيل

ودور على دروس النماذج والتحقق من المتغيرات هتلاقيها في قسم ارشيف ال php هنا

هتلاقي ( دروس متقدمة ) هات الاول والثاني للاستاذ maveric وباذن الله هتلم الليلة كلها

وبالنسبة لعمل الرقم العشوائي هدورلك عليها حالا

اه امال اهم حاجة عندنا راحة الاعضاء الكرام :D

#3

شكرا جزيلا...و انا في انتظار القم العشوائي

#4

طيب قولى انتا عملت ايه فى الفورم والتحقق منه ؟؟؟

مش نعرف الاخبار الاول :D

#5

هذا الكود يعطيك صورة بالرقم العشوائي

<?php
 /*Send header*/
Header("Content-Type: image/png");
/* initialize a session. */
session_start();

/*We'll set this variable later.*/
$new_string;

/*register the session variable. */
session_register('new_string');

/* set up image*/
/*The first number is the width and the second is the height*/
$im = ImageCreate(200, 40);  


/*creates two variable to store color*/
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);

/*random string generator.*/
/*The seed for the random number*/
srand((double)microtime()*1000000); 

/*Runs the string through the md5 function--which is a function that encrypts a string, changing it into a 32 character string composed of numbers and lowercase letters*/

$string = md5(rand(0,9999)); 

/*Creates the new string. The first number is the point in the 32 character string where we will pull our string from. In other words, PHP will count (beginning at 0) 17 characters into the string. The 18th character in will be our beginning point (remember, PHP starts counting from 0). From there, PHP counts 5 characters from that point, and thus, we get our five character string. The second number is the length of our string--changing this number will give us different string lengths.*/
$new_string = substr($string, 17, 5);  

 /*fill image with black*/
ImageFill($im, 0, 0, $black);


 /*write string at coordinates (70,10) in the color white. (70, 10) puts the string almost in the middle of the image.*/
ImageString($im, 4, 70, 10, $new_string, $white);

 /*output to browser*/
ImagePNG($im, "verify.png");
ImageDestroy($im);  

?>

ولو وافيت ربك دون ذنب *** وناقشك الحساب إذاً هلكتا

ولم يظلمك في عملٍ ولكن *** عسير أن تقوم بما حملتا

هذا الموضوع مغلق.

مواضيع مشابهة