CoverYourASP --> utils/Header.asp" --> Source

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
108 active users
1415 visitors today
1166 pages today
how is this done?
Tools I use

CoverYourASP
Copyright © 1999-2016 James Shaw.
All rights reserved.

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

This page shows the actual source code used on this site. If this is the first CYA source code you've seen you should read this overview first.

Did you know you can download all the source code (and the database) of this site? Then get my newsletter to be emailed when I update the source code!

Please spread the word by recommending my site to your friends and colleagues!

This is JScript (server-side JavaScript), not the more common VBScript. More...

utils/Header.asp

<%
// ============================================
// NOTE: all source code downloaded from CoverYourASP was written by
// James Shaw (unless stated otherwise), and is copyright (c) 2000-2002
// by James Shaw. You can use the code for any purpose, but do not
// publish or distribute the content in any way.
//
// See http://CoverYourASP.com/Legal.asp for up-to-date details.
// ============================================

var sPage = Request.ServerVariables ( "SCRIPT_NAME" );

// ============================================
// output common top of page
// ============================================
function Header ( sLocation )
{
   Out ( '<body bgcolor="#ffffff" link="#FF3300" vlink="#FF3300" alink="#CC0000">' );

   // should we make a plain page for printing?
   if ( !bPlainJane )
   {
      // table containing all of header
      Out ( '<table bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">' );

      if ( !bRunningOnCYA )
      {
         Out ( '<tr><td colspan="3" align="center">' );

            Out ( '<table width="100%" bgcolor="#ffffff" cellpadding="10" border="1"><tr><td align="center">' );

               Out ( '<h3><a href="http://CoverYourASP.com/">This entire site was downloaded from CoverYourASP!</a></h3>' );
               Out ( '<p>The software for this website is open source but the content is not.  All content is copyright James Shaw and may not be reproduced in whole or in part in any media (including public web sites and printed publications) without prior written consent from the author. <a href="http://CoverYourASP.com/Legal.asp">read more...</a>' );

            Out ( '</td></tr></table>' );

         Out ( '</td></tr>' );
      }

      if ( bRefered )
         Out ( '<tr><td colspan="3" align="center"><a href="/HowIMoved.html">You have been redirected to CoverYourASP.com - find out why and how!</a><br>&nbsp;</td></tr>' );

      Out ( '<tr>' );
      
      if ( bNoDynamic )   // add html comment for template use
         Out ( '<!-- top_top -->' );
      
      Out ( '<td width="190" align="left" valign="top">' );

         Out ( '<a href="/default.html"><img src="images/CYA_18460.gif" border="0" width="184" height="60"></a>' );

      Out ( '</td><td align="center" valign="top">' );

         ShowAd ( );

      Out ( '</td><td width="184"><b>' );

//         Out ( '&#0149; <a href="TheLibrary.asp">Books you need..</a><br>' );
//         Out ( '&#0149; <a href="/eu_url_httpCoverYourASP.tradepub.com.html">FREE Magazine Subscriptions!</a>' );   
      //   Out ( '<center><b><a href="http://www.discountasp.net/go/go.aspx?i=1739">ASP/.NET Web Hosting</a><br>* <a href="http://www.discountasp.net/go/go.aspx?i=1739">3 Months FREE</a> *<br><a href="http://www.discountasp.net/go/go.aspx?i=1739">CLICK HERE!</a></b></center>' );

      //   Out ( '<center><b>Wife/Girlfriend/Sister?<br/><a href="http://www.resistattack.com/Pepper-Spray/">Pepper Spray</a> & <br/><a href="http://www.resistattack.com/Stun-Guns/">Stun Gun Specials!</a><br/>KEEP THEM SAFE.</b></center>' );

      Out ( '</b></td></tr>' );
      Out ( '<tr><td width="190">&nbsp;</td><td colspan="2" align="left" valign="top">' );
         
         // show "breadcrumbs" if any sent in
         if ( sLocation != "" )
            Out ( '<a href="/default.html">CoverYourASP</a> --> ' + sLocation );

         Out ( '<p>' );

         if ( bNoDynamic )   // add html comment for template use
            Out ( '<!-- top_bottom -->' );
      
      Out ( '</tr></table>' );
   }

   // should we make a plain page for printing?
   if ( bPlainJane )
   {
      // table containing rest of body
      Out ( '<table bgcolor="#ffffff" width="600" border="0" cellpadding="0" cellspacing="0">' );
      Out ( '<tr><td align="center"><h5>You are viewing a plain-jane printable version of <a href="http://' + sHostDomain + sPage + '">http://' + sHostDomain + sPage + '</a>.</h5><a href="/PrinterFriendly.html">See how this was done</a><p>&nbsp;</td></tr><tr>' );
   }
   else
   {
      // table containing rest of body
      Out ( '<table bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">' );
      Out ( '<tr><td background="images/gx/navgap.gif" valign="top">' );

         if ( bNoDynamic )   // add html comment for template use
            Out ( '<!-- left_top -->' );
      
         NavTableTop ( 'Free membership' );

            ShowLoginStatus ( '', '' );
            
            Out ( '<br><a href="/MemberServices.html">Member Services</a>' );

            if ( IsLoggedIn ( ) )
               Out ( '<br><a href="/Personalize.html">Personalize the site</a>' );

         NavTableBottom ( );

         NavTableTop ( 'Site navigation' );

            Out ( '<a href="/CYA.html">Download the entire site!</a><br>' );
            Out ( '<a href="/Search.html">Search my articles</a><br>' );
            Out ( '<a href="/eu_url_httpCoverYourASP.tradepub.com.html">Free Magazines</a> <img src="/images/new.gif"><br>' );
            Out ( '<a href="/eu_url_httpCoverYourASP.htmlin.com.html">Browse the directory</a><br>' );
//            Out ( '<a href="/eu_url_httpwww.findsp.comhostingcobid.html">Find yourself a host!</a><br>' );

            Out ( '<hr width="50" align="left" color="#ff9900">' );

//            Out ( '<a href="/Subscribe.html">Get the free newsletter</a><br>' );
            Out ( '<a href="/Contact.html">Send me feedback</a><br>' );
            Out ( '<a href="/eu_url_httpwww.cafepress.comCoverYourASP.html">Buy my boxer shorts</a><br>' );

            Out ( '<hr width="50" align="left" color="#ff9900">' );

            // get QueryString if there is one
            var sQuery = '' + Request.QueryString ( );

            Out ( '<a href="Recommend.asp?refer=' + Server.URLEncode ( sPage + '?' + sQuery ) + '">Recommend this page</a><br>' );
            // client-side bookmark function
            Out ( '<script type="text/javascript" language="JavaScript1.2"><!--\nfunction Bookmark(){window.external.AddFavorite("http://CoverYourASP.com' + sPage + '","CoverYourASP!");}//-->\n</script>' );
            // only give bookmark option on IE
            Out ( '<script type="text/javascript"><!--\nif (document.all) document.write ( \'<a href="JavaScript:Bookmark()">Bookmark this page</a><br>\');//-->\n</script>' );

            if ( sQuery != '' )
               sQuery += '&';

            Out ( '<a href="' + sPage + '?' + sQuery + 'plain">Printer-friendly page</a><br>' );

            Out ( '<hr width="50" align="left" color="#ff9900">' );

//            Out ( '<a href="http://www.CoverYourASP.NET/">CoverYourASP.NET</a> <img src="/images/new.gif"><br>' );
            Out ( '<a href="/Resources.html">Resources I recommend</a><br>' );
            Out ( '<a href="/LinkToUs.html">Link to my site</a><br>' );
            Out ( '<a href="/Advertise.html">Advertising slashed!</a><br>' );
            Out ( '<a href="/Privacy.html">About your privacy</a><br>' );
            Out ( '<a href="/Legal.html">Legal stuff</a><br>' );

            // add this to new resources
            // <img src="/images/new.gif" width="25" height="9" border="0" alt="Check this out!" align="right">

         NavTableBottom ( );

         // dont show dynamic content if being used
         // on a 3rd party template
         if ( !bNoDynamic )
         {
            NavTableTop ( 'Site statistics' );
               // show some fun statistics stored in Application variables
            
               // lock the application so I can increment page counter
               Application.Lock ( );
               Application ( 'PagesToday' )++;
               Application ( 'HeadersViewed' )++;
               Application.Unlock ( );

               // display the data
               var nUsers = Application ( 'ActiveUsers' ) - 0;
               var nUsersToday = Application ( 'UsersToday' ) - 0;
               var nPagesToday = Application ( 'PagesToday' ) - 0;
               var bRebootToday = Application ( 'NewToday' ) - 0;

               Out ( nUsers + ' active user' + ( (nUsers==1) ? '!' : 's' ) + '<br>' );
               Out ( nUsersToday + ' visitor' + ( (nUsersToday==1) ? '' : 's' ) + ' today<br>' );
               Out ( nPagesToday + ' page' + ( (nPagesToday==1) ? '' : 's' ) + ' today<br>' );

               Out ( '<a href="/Application.html">' );

               if ( bRebootToday )
                  Out ( '(only part of today)' );
               else
                  Out ( 'how is this done?' );

               Out ( '</a>' );
            NavTableBottom ( );
         }


         NavTableTop ( 'Tools I use' );
         Out ('<p><a target="_blank" href="http://www.shareasale.com/r.cfm?b=37500&u=309402&m=2162&urllink=&afftrack="><img src="http://www.shareasale.com/image/rsssubmit_affiliate_120x60.gif" border=0></a></p>');
//Out ( '<font face="Arial" size="2"><a href="http://www.dotnetcharting.com/">ASP.NET Graph and Chart Component</a> with FREE developer version<br></font><font face="Arial" style="font-size: 3pt"><br></font><font face="Arial" size="2"><a href="http://www.dotnetcart.com/">ASP.NET Shopping Cart and E-commerce Control</a> with FREE trial download<br></font><font face="Arial" style="font-size: 3pt"><br></font><font face="Arial" size="2"><a href="http://www.dotnetserver.com/">ASP.NET Web Hosting</a> with free month and setup<br></font><font face="Arial" style="font-size: 3pt"><br></font><font face="Arial" size="2">$15 <a href="http://www.dotdnr.com/">Domain Name Registration</a> from .DNR.</font>');
         NavTableBottom ( );

   //      NavTableTop ( 'As seen on these sites' );

   //         Out ( 'Special thanks go to the sites that support me by publishing my articles.' );
   //         Out ( '<br><a href="/Resources.html">See more</a>' );

   //         Out ( '<center>' );

   //         ShowAffiliates ( 2 );

   //         Out ( '</center>' );

   //      NavTableBottom ( );

//         NavTableTop ( 'ASP Hosting' );

//            Out ( '<a href="http://www.cleverchaps.com/"></a><p>My site is hosted by Clever Chaps and I\'m very pleased with them.');
//            Out ( '<p><a href="/eu_url_httpeverplanet.com.html" target="CYAExternal">Check them out.</a>' );
//            Out ( '<p><font size="1"><i>They are not paying me or giving me discounts for saying this!</i></font>' );

//         NavTableBottom ( );

         NavTableTop ( 'CoverYourASP' );

            Out ( 'Copyright &copy; 1999-');
            {
            var d = new Date();
            Out (d.getYear());
            }
            Out (' <a href="http://www.ShawThing.com/">James Shaw</a>.<br>All rights reserved.<p>' );
            Out ( '&#0149; <a href="http://BritishInside.com/">ASP.NET Blog</a><br>' );
            Out ( '&#0149; <a href="http://www.asprss.com/">RSS submissions</a><br>' );
            Out ( '&#0149; <a href="http://www.CleverChaps.com/">E-commerce</a><br>' );

            Out ( '<p align="center"><a href="/eu_url_httpsourceforge.netprojectscoveryourasp.html" target="CYAexternal"> <img src="http://sourceforge.net/sflogo.php?group_id=53390&type=1" width="88" height="31" border="0" alt="Now open source with SourceForge!"></a>' );            
            
            NavTableBottom ( );

         if ( bNoDynamic )   // add html comment for template use
            Out ( '<!-- left_bottom -->' );
      
      Out ( '</td>' );
   }
}

// ============================================
// output top of nav box
// ============================================
function NavTableTop ( sTitle )
{
   Out ( '<table width="184" cellspacing="0" cellpadding="0" border="0">' );
   Out ( '<tr>' );
      Out ( '<td width="9" background="images/gx/navtopl.gif"><img src="images/gx/1pix.gif" width="9" height="24" alt="" border="0"></td>' );
      Out ( '<td width="150" background="images/gx/navtopr.gif" valign="middle" nowrap style="padding-right:23px;">' + sTitle + '</td>' );
   Out ( '</tr>' );
   Out ( '<tr>' );
      Out ( '<td width="9" background="images/gx/navl.gif"><img src="images/gx/1pix.gif" width="9" height="1" alt="" border="0"></td>' );
      Out ( '<td width="150" colspan="2" background="images/gx/navr.gif" style="padding-right:23px;">' );
}

// ============================================
// output bottom of nav box
// ============================================
function NavTableBottom ( sTitle )
{
   Out ( '</td></tr>' );
   Out ( '<tr><td colspan="3" height="18"><img src="images/gx/navftr.gif" width="184" height="18" alt="" border="0"></td></tr>' );
   Out ( '</table>' );
}

// ============================================
// output top of personalizable content
// ============================================
function ContentTableTop ( sTitle )
{
   Out ( '<table width="100%" cellspacing="5" cellpadding="0" border="0">' );
   Out ( '<tr bgcolor="#ff9900"><td>&nbsp;' + sTitle + '</td></tr>' );
   Out ( '<tr><td>' );
}

// ============================================
// output bottom of personalizable content
// ============================================
function ContentTableBottom ( sTitle )
{
   Out ( '</td></tr>' );
   Out ( '</table>' );
}

// ============================================
// output client-side script for IE bookmark
// ============================================
function Bookmark ( )
{
   // client-side bookmark function
   Out ( '<script type="text/javascript" language="JavaScript1.2"><!--\nfunction Bookmark(){window.external.AddFavorite("http://CoverYourASP.com/","CoverYourASP!");}//-->\n</script>' );
   // only give bookmark option on IE
   Out ( '<script type="text/javascript"><!--\nif (document.all) document.write ( \'<a href="JavaScript:Bookmark()">Bookmark</a>&nbsp;&nbsp;-&nbsp;&nbsp;\');//-->\n</script>' );
}
%>

Hopefully much of this is self-explanatory. If not, or if you see ways that I can improve the code, please drop me a line.

To see the source code for this page, click on the icon below.

Featured sponsor
My favorite resources


New Proposal Kit Professional 5.1
Brand yourself as a top professional: create quotes and amazing proposals and get many legal documents free!

The latter saved me 3 times the purchase price on the first day I owned it!

CoverYourASP Mugs, T-shirts, caps - even Boxer shorts...
I don't make a penny from these, but they're a lot of fun! Don't you need a new mouse mat?


See my source code
wherever you see this icon...

You can also download the entire site source code for FREE!


I share my content

Supporting ASPRSS

Do you need a quick and easy way to link to my articles? All the information you need is published with ASPRSS...


Qualify for Free Trade Magazines

Free subscriptions to industry leading publications for those who qualify!