session variables and SVG documents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have the following problem with the Adobe SVG viewer:
I try to generate a SVG document using PHP. the following code is working
well under Firefox, as well as IE with ASV:

<?php

header("Content-type: image/svg+xml");

$graph_title = 'title';


print('<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>');
$svgwidth=500;
$svgheight=400;
?>

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "
http://www.w3.org/TR/SVG/DTD/svg10.dtd";>
<svg width="<?php echo $svgwidth; ?>px" height="<?php echo $svgheight; ?>px"
xmlns="http://www.w3.org/2000/svg";>
    <desc>This is a php-random rectangle test</desc>
<?php
srand((double) microtime() * 1000000); //initalizing random generator
for ($i = 0; $i < 20; $i+=1) {
    $x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for rand
function
    $y = floor(rand(0,$svgheight-1));
    $width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside of
viewbox
    $height = floor(rand(0,$svgheight-$y));
    $red = floor(rand(0,255));
    $blue = floor(rand(0,255));
    $green = floor(rand(0,255));
    $color = "rgb(".$red.",".$green.",".$
blue.")";
    print "\t<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\"
style=\"fill:$color;\"/>\n";
}
?>
    <text x="<?php echo $svgwidth/2;?>px" y="300" style="font-size:15;"
text-anchor="middle">The servers Date and Time is: <?php print
(strftime("%Y-%m-%d, %H:%M:%S")); ?></text>
    <text x="<?php echo $svgwidth/2;?>px" y="340" style="font-size:15;"
text-anchor="middle">You are running:</text>
    <text x="<?php echo $svgwidth/2;?>px" y="360" style="font-size:15;"
text-anchor="middle"><?php print $HTTP_USER_AGENT; ?></text>
</svg>

If now I want to include the session_start() at the beginning of the code,
in IE I got a pop-up dialog called "download file"

What am I doing wrong ?

Regards,
Aurelie

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux