[mapserver-users] $_SESSION variable substitution

Stephen Woodbridge woodbri at swoodbridge.com
Wed Mar 4 22:17:44 EST 2009


The short answer is no.

The longer answer is $_SESSION is a php variable and it only exist while 
php is executing. When you call mapserver cgi, it is not running in the 
php environment. and if you use it in a template, there is not for 
mapserver to tell the webserver that it needs to run php processor over 
the results of the out of mapserver, ie. the processed template.

If you really need to do this you might be able convert the info you 
need into cookie or change you mapserver request to include the info you 
need on its url than then use url substitution.

Or you might develop you application in php/mapscript where it will run 
in the php environment.

It might help more to explain why you think you need to do this, and 
people might be able to offer other ways to do something similar.

-Steve W

Greg Luker wrote:
> Hi mapserver-users,
> 
> I would like to use a $_SESSION variable in a mapfile FILTER statement. 
> I have tried variations of:
> 
> (in calling HTML template):
> 
> <input type="hidden" name="myvar" value="<?php echo $_SESSION['user']; ?>">
> 
> (in mapfile):
> 
> FILTER "WHERE site_last_survey_who = '%myvar%'"
> 
> but I can't get it to work - in this case the browser displays the WEB 
> ERROR "errors.html" webpage and mapserver puts the following error in 
> mapserver.log:
> 
> msDrawMap(): Image handling error. Failed to draw layer named 'pts'.
> msOGRFileNextShape(): OGR error. Syntax error, 2 extra tokens
> 
> Is it possible to do what I want? (BTW CGI mapserver v5.2)
> 
> Thanks,
> Greg.
> 
> 
> 
> 
> Greg Luker
> GIS Lab Manager, Southern Cross University
> Lismore, AUSTRALIA.
> gluker at scu.edu.au
> phone 61 2 66203026
> 
> 
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list