php header() equivalent in zope, translation please
I'm working on a website to be viewed in the eve-online in-game browser. This browser has a feature called "trusted site" that allows the server to extract information about the game character that is viewing the page... Once the website is "trusted" all of the variables are transferred over in the header section of the http request... My question relates to how to request this trusted status... They have provided a sample php script that has this behaviour, but I am very unfamiliar with php, and would be interested to see what the zope/python equivalent would be... Could anyone give me a translation for this line >>> header("eve.trustme: ... TIA! -e- |<? ini_alter("session.use_cookies","1"); ob_start(); ?> <HTML> <HEAD> <TITLE>Testpage</TITLE> </HEAD> <BODY> <? if (!(strpos($HTTP_USER_AGENT,"EVE-minibrowser")===false)) { if ($HTTP_SERVER_VARS["HTTP_EVE_TRUSTED"]=="no") { header("|eve.trustme:|http://www.mywebsite.net/::please| allow me to access your pilot information.|"); } else { ?> <b>Pilot:</b> <? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_CHARNAME”]; ?> <b>Location:</b> <? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_REGIONNAME”]; ?>/<? echo $|HTTP_SERVER_VARS[“|HTTP_EVE_CONSTELLATIONNAME”]; ?>/<? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_SOLARSYSTEMNAME”]; ?><BR> <? if (|$HTTP_SERVER_VARS[“|HTTP_EVE_STATIONNAME”] != "None") { ?> <b>Station:</b> <? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_STATIONNAME”]; ?><br> <? } } } ?> </BODY> </HTML> <? ob_end_flush(); ?>|
Ed Colmar wrote:
if (!(strpos($HTTP_USER_AGENT,"EVE-minibrowser")===false)) { if ($HTTP_SERVER_VARS["HTTP_EVE_TRUSTED"]=="no") { header("|eve.trustme:|http://www.mywebsite.net/::please| allow me to access your pilot information.|"); } else { ?> <b>Pilot:</b> <? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_CHARNAME”]; ?> <b>Location:</b> <? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_REGIONNAME”]; ?>/<? echo $|HTTP_SERVER_VARS[“|HTTP_EVE_CONSTELLATIONNAME”]; ?>/<? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_SOLARSYSTEMNAME”]; ?><BR> <? if (|$HTTP_SERVER_VARS[“|HTTP_EVE_STATIONNAME”] != "None") { ?> <b>Station:</b> <? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_STATIONNAME”]; ?><br>
Don't speak PHP (puh! ;-) but here's a guess from a python script: r = context.REQUEST if r.get('HTTP_USER_AGENT')=="EVE-minibrowser": if r.get('HTTP_EVE_TRUSTED')=='no': r.RESPONSE.setHeader( 'eve.trustme', 'http://www.mywebsite.net/::please| allow me to access your pilot information.' ) else: character_name = r.get('HTTP_EVE_CHARNAME') # etc print character_name # etc return printed cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (2)
-
Chris Withers -
Ed Colmar