Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start(); //Set Sessions Available To Set & Get
- $width = 100; // Width of the Image
- $height = 60; //Height of the Image
- $textCNG = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',11)),0,rand(4,7)); //Created random Text
- $text = $textCNG; //Set Final Text to Randomized Text
- $_SESSION['captcha'] = $text; //Set Session Text
- header ("Content-type: image/png"); //Set HTML Header
- $img = ImageCreate ($width, $height) or die ("Cannot Initialize new GD image stream"); //Create New Image
- $background_color = ImageColorAllocate ($img, 255, 255, 255); //Set Background Color
- $style_color = ImageColorAllocate ($img, 59, 59, 59); //Set Style Color
- $text_color = ImageColorAllocate ($img, 120, 95, 95); //Set Text Color
- for($i >= 0; $i <= rand(2,5); $i++){
- imageline($img,0,rand()%$height,$width,rand()%$height,$style_color);//Set Random Lines Into The Image
- }
- for($i >= 0; $i <= rand(220,440); $i++){
- imagesetpixel($img,rand()%$width,rand()%$height,$style_color); //Set Dots Into The Image
- }
- imagestring($img, 5, 22, 22, $text, $text_color); //Write Image Text
- ImagePng ($img); //Show the image
- imagedestroy($img); //Destroy the image
- ?>
Advertisement
Add Comment
Please, Sign In to add comment