Файл: captcha.php
Строк: 19
<?
        
        
        
        
        
          session_start();
          
          header("Content-Type: image/png");
          
          $_SESSION['control'] = rand(0,9).rand(0,9).rand(0,9).rand(0,9);
          
          $code = $_SESSION['control'];
          
          $img=imagecreatetruecolor(50, 20);
          
          $x1=0;
          
          $x2=60;
          
          $y1=rand(0, 30);
          
          $y2=rand(0, 30);
          
          imagefill($img, 0, 0, 0xffffff);
          
          $textcolor = imagecolorallocate ($img, 53, 82, 108);
          
          imageline($img, $x1, $y1, $x2, $y2, $textcolor);
          
          $x1=rand(0, 50);
          
          $x2=rand(0, 50);
          
          $y1=0;
          
          $y2=30;
          
          imageline($img, $x1, $y1, $x2, $y2, $textcolor);
          
          imagestring($img, 4, 12, 3, $code, $textcolor);
          
          imagepng($img);
          
          imagedestroy($img);          
?>