mohsen-star 37 ارسال شده در 19 خرداد، 2017 اشتراک گذاری ارسال شده در 19 خرداد، 2017 سلام گفتم یه نمونه کد کپچا قرار بدم برایکسایی که علاقه مند هستن یاد بگیرن که به چه صورت میشه کدامنیتی ساخت فایل اول برای مثال اسمش رو قار بدید index.php <?php session_start(); if(isset($_POST['sub'])){ if($_POST['ar']==$_SESSION['code']){ echo 'ok'; }else{ echo 'eror'; } } $text='[email protected]#$%^&**()__++jklmnopqrstuvwxyz123456789'; $code=null; for($i=1;$i<=5;$i++) { $start=rand(0,strlen($text)); $code.=substr($text,$start,1); } $_SESSION['code']=$code;?> <html> <head> <meta charset="utf-8"> <title>learn-net</title> </head> <body> <img src="file2.php"> <form action="index.php" method="post"> <input type="text" name="ar" value="<?php echo $_SESSION['code'];?>"> <input type="submit" name="sub"> </form> </body> </html> فایل دوم : بااسم file2.php <?php session_start(); header('Content-type: image/jpeg'); $code=$_SESSION['code']; $font_size=30; $image_width=200; $image_height=60; $image= imagecreate($image_width,$image_height); imagecolorallocate($image,220,220,220); $text_color= imagecolorallocate($image,0,0,0); imagettftext($image, $font_size,0,30,45, $text_color,'arial.ttf', $code); imagejpeg($image);?> لینک ارسال به اشتراک گذاری در سایت های دیگر تنظیمات بیشتر اشتراک گذاری ...
ارسال های توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.