Example Trust Program
The following program is a simple example that requires trust to work. If
it does not have trust it asks for it through use of an HTTP header. If it
does have trust it displays a list of EVE-related variables. The code is
available in both PHP and ASP (ASP version courtesy of Dave White).
PHP Version
<?php
if ($_SERVER['HTTP_EVE_TRUSTED'] == 'no')
{
header('eve.trustMe:http://' . $_SERVER['HTTP_HOST'] . '/eve/::Please trust me, I\'m nice');
print '<html><body>';
print '<h1>Trust Required</h1>';
print 'I need to be trusted to work properly';
}
else
{
print '<html><body>';
print '<h1>Trusted Connection</h1>';
}
print '<h1>Eve Variables</h1>';
foreach ($_SERVER as $k=>$v)
{
if (preg_match('/^HTTP_EVE_/', $k))
{
print htmlentities($k) . ' is ' . htmlentities($v) . '<br>';
}
}
print '</body></html>';
?>
ASP Version
If Request.ServerVariables("HTTP_EVE.TRUSTED")="no" Then
Response.AddHeader "eve.trustMe","http://" & Request.ServerVariables("HTTP_HOST") & "/::Optional message"
Response.Write(Request.ServerVariables("HTTP_EVE.TRUSTED"))
Else
For each VarName in Request.ServerVariables
If InStr((VarName),"HTTP_EVE") Then
Response.Write(VarName & " : " & Request.ServerVariables(VarName) & "<br>")
End If
Next
End If