When/where/how/why does $max get added to $x? It seems to happen in the if() in the for loop.
<?
$ki=0;
$buffer=0;
$imgx=640;
$imgy=480;
$im = ImageCreate($imgx, $imgy);
$black = imagecolorallocate($im, 0, 0, 0);
$grey = imagecolorallocate($im, 200, 200, 200);
$blue = imagecolorallocate($im, 0, 0, 255);
$y=1;
if(!$max)
{$max=240;}
while($x++<$max)
{
while($y++<$max)
{
if($q[$y]==0){$q[$x*$y]=1;}
}
$y=1;}
for($x=0;$x<($max*2);$x++)
{if($q[$x]==0){
//imageline($im, $ki, ($imgy-buffer), $ki+=4, ($imgy-$x), $grey);
}
$buffer=$x;
}
Header("Content-Type: image/png");
imagepng($im);
//imagedestroy($im);
?>
<?
$ki=0;
$buffer=0;
$imgx=640;
$imgy=480;
$im = ImageCreate($imgx, $imgy);
$black = imagecolorallocate($im, 0, 0, 0);
$grey = imagecolorallocate($im, 200, 200, 200);
$blue = imagecolorallocate($im, 0, 0, 255);
$y=1;
if(!$max)
{$max=240;}
while($x++<$max)
{
while($y++<$max)
{
if($q[$y]==0){$q[$x*$y]=1;}
}
$y=1;}
for($x=0;$x<($max*2);$x++)
{if($q[$x]==0){
//imageline($im, $ki, ($imgy-buffer), $ki+=4, ($imgy-$x), $grey);
}
$buffer=$x;
}
Header("Content-Type: image/png");
imagepng($im);
//imagedestroy($im);
?>