'J', //capital i 'l' => 'm', //lowercase L '0' => '1', //zero 'O' => 'P' //capital o ); $pass = str_replace( array_keys( $arrReplace ) , $arrReplace , $pass ); //$pass = generatePassword( 5 , 4 ); // *** Set the session cookie so we know what the passcode is *** $_SESSION["pass"] = $pass; // *** Create the image resource *** $image = ImageCreatetruecolor(100, 20); // *** We are making two colors, white and black *** $clr_white = ImageColorAllocate($image, 255, 255, 255); $clr_black = ImageColorAllocate($image, 0, 0, 0); // *** Make the background black *** imagefill($image, 0, 0, $clr_black); // *** Set the image height and width *** imagefontheight(15); imagefontwidth(15); // *** Add the passcode in white to the image *** imagestring($image, 5, 30, 3, $pass, $clr_white); // *** Throw in some lines to trick those cheeky bots! *** imageline($image, 5, 1, 50, 20, $clr_white); imageline($image, 60, 1, 96, 20, $clr_white); // *** Output the newly created image in jpeg format *** imagejpeg($image); // *** Clear up some memory... *** imagedestroy($image); } ?>