<?php session_start(); $rand_code = rand(1000, 9999); $_SESSION['rand_code'] = $rand_code; $dir = "fonts/"; $image = imagecreatetruecolor(60, 30); $black = imagecolorallocate($image, 0, 0, 0); $color = imagecolorallocate($image, 200, 100, 90); $white = imagecolorallocate($image, 230, 230, 250); imagefilledrectangle($image,0,0,399,99,$white); imagettftext ($image, 10, 0, 10, 20, $color, $dir."verdana.ttf", $_SESSION['rand_code']); header("Content-type: image/png"); imagepng($image); ?>