Re: session variables and SVG documents

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

 



On Mon, 2010-02-01 at 11:37 +0100, Aurelie REYMUND wrote:

> 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


It sounds like it's the SVG plugin you're using on IE that's badly
misbehaving. That said, I've not seen any plugins that correctly pass
across the full headers that the browser would. I tried using sessions
once to secure media files by checking for a valid login against the
session id, but the plugins requesting the video clips didn't send any
cookie data in the header request. As such, it might be better to not
rely on it in this case.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[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