utils/init.asp
<%
// ============================================
// note: all source code downloaded from coveryourasp was written by
// james shaw (unless stated otherwise), and is copyright (c) 2000 by
// james shaw. you may use this source code on your web sites, but
// please dont publish or distribute in any way.
//
// i would appreciate an html comment in any code you use, i.e.
// <!– portions (c) james@coveryourasp.com–>
// (see footer(), documented in ssi.asp for details on how to do this)
//
// <shameless plug>
// please contact me to discuss any asp contract work you may have.
// </shameless plug>
// ============================================
// ============================================
// the standard meta tags to start document
// ============================================
function init ( stitle, skeywords )
{
out ( <!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http://www.w3.org/tr/rec-
html40/loose.dtd"> );
out ( <html><head> );
out ( <base target="_top"> );
// for any browsers
out ( <link rev=made href="mailto:james@coveryourasp.com"> );
out ( <meta name="resource-type" content="document"> );
out ( <meta http-equiv="content-type" content="text-html; charset=iso8859-1"> );
out ( <meta http-equiv="pics-label" content=\(pics-1.1 "http://www.rsac.org/ratingsv01.html" l gen
true comment "rsaci north america server" for "http://coveryourasp.com/" on "2000.09.08t03:03-0800" r (n 0
s 0 v 0 l 0))\> );
// for spiders only – i hide these lines from browsers
var sbrowser = "" + request.servervariables ( http_user_agent );
if ( ( -1 == sbrowser.indexof ( mozilla ) && -1 == sbrowser.indexof ( opera ) ) || isdebug () )
{
// its an unknown browser – probably a spider
out ( <meta name="author" content="james shaw"> );
out ( <meta name="keywords" content="coveryourasp, cya, james shaw, asp, active server pages,
active, server, pages, scripts, microsoft, iis, email, cdonts, form, access, database, free code, source,
code, programmer, programming, developer, development, javascript, jscript, com, atl, c++ );
// add any passed-in keywords
if ( skeywords != undefined )
out ( , + skeywords );
out ( "><meta name="description" content="live examples and full source code for solving practical
problems using asp (active server pages), c++ atl com components, server and client-side javascript and
dhtml."> );
}
else
{
// its a known browser – show "throwaway" keywords so we dont arouse suspicion!
out ( <meta name="keywords" content="james shaw"> );
out ( <meta name="description" content="james shaw\s site"> );
}
out ( <title> + stitle + </title> );
out ( <style> );
out ( a:link { color:#ff3300; } );
out ( a:vlink { color:#ff3300; } );
out ( a:alink { color:#cc0000; } );
out ( body { font:8pt/11pt verdana;} );
out ( table { font:8pt/11pt verdana;} );
out ( </style></head> );
}
// ============================================
// are we being run from a special debug url?
// ============================================
var bdebug;
function isdebug ( )
{
// for efficiency, only work out if were in debug mode
// the first time were used on a page.
if ( bdebug == undefined )
{
// the test can be if were on localhost (i.e. on development machine)
/*
var sserver = "" + request.servervariables ( "server_name" );
bdebug = ( -1 != sserver.indexof ( "localhost" ) );
*/
//..or for demo purposes, if a certain querystring exists
bdebug = ( 0 != request.querystring ( "debug" ).count );
}
return bdebug;
}
// ============================================
// shorthand to save me typing response.write all the time!
// ============================================
function out ( shtml )
{
response.write ( shtml );
}
// ============================================
// only display when special url
// ============================================
function debugout ( shtml )
{
if ( !isdebug () )
return;
out ( shtml );
}
%>
