rendered paste body<?php class vcode_engine{ function generate_code(){ if (empty($_SESSION['validation_image'])){ $code=""; //set up code and validation $letter = range( 'A', 'Z' ); $numbers = range( '0', '9' ); $all = array_merge( $letter, $numbers ); for ( $counter1 = 0; $counter1 < 6; $counter1++ ) { shuffle( $all ); $random = rand( 0, 35 ); // generate code $code = $code.' '.$all[$random]; } return $code; }else{ session_unset($_SESSION['validation_image']); } } function image_validation(){ $vcode = $this -> generate_code(); #require('conf_system.php'); $_SESSION['validation_image']=str_replace(" ","",$vcode); $im = imagecreate(130, 30); // white background and blue text $bg = imagecolorallocate($im, 255, 255, 255); $textcolor = imagecolorallocate($im, 0, 0, 0); // write the string at the top left imagettftext($im, 12, 0, 20, 27, $textcolor, "libs/vcode/font/mdlabs.ttf", $vcode); // output the image #header("Content-type: image/jpg"); imagejpeg ($im, "libs/vcode/images/verify.jpg"); imagedestroy($im); echo "<img src=\"libs/vcode/images/verify.jpg\" alt=\"verification image\">"; }}