sesion start panaudojau index.php faile pacioje pirmoje eiluteje.
netgi pabandymui sukuriau atskira faila
file.php
<?php
session_start();
echo '<img src=./image.php />';
echo "<br> testas".$_SESSION[sk3];
?>
image.php
<?php
header("Content-type: image/jpg");
$sk1 = rand(1,9);
$sk2 = rand(1,9);
$sk3 = $sk1+$sk2;
$_SESSION[sk3] = $sk3;
$string = ' ' . $sk1 .' + '. $sk2 . ' = ? ';
$font = 4;
$width = ImageFontWidth($font) * strlen($string);
$center = ceil(ImageFontHeight($font)/2);
$height = ImageFontHeight($font)*2;
$im = @imagecreatetruecolor ($width,$height);
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 255, 255, 255);
imagestring ($im, $font, 0, $center, $string, $text_color);
imagejpeg ($im);
imagedestroy($im);
?>
ir vistiek $_SESSION[sk3] neatvaizduoja