<%
'#################################################################################
'## Copyright (C) 2000  Michael Anderson
'## 
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or any later version.
'## 
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'## GNU General Public License for more details.
'## 
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
'## 
'## Correspondence and Questions can be sent to:
'## reinhold@bigfoot.com
'## 
'## or
'## 
'## Snitz Communications 
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
%>
<% set my_Conn = Server.CreateObject("ADODB.Connection") %> 
<% my_Conn.Open strConnString %>
<%
if (strAuthType = "nt") then
	call NTauthenticate()
	if (ChkAccountReg() = "1") then
		call NTUser()
	end if
end if
%>
<%
select case Request.Form("Method_Type")
	case "login"
		if (ChkUser2(Request.Form("Name"), Request.Form("Password")) = 4) or _
		(ChkUser2(Request.Form("Name"), Request.Form("Password")) = 3) or _
		(ChkUser2(Request.Form("Name"), Request.Form("Password")) = 2) or _
		(ChkUser2(Request.Form("Name"), Request.Form("Password")) = 1) then
			'## Sets cookies for the post form if asked for
			if strSetCookieToForum = 1 then
				Response.Cookies("User").Path = strCookieURL
			end if
			Response.Cookies("User")("Name") = Request.Form("Name")
			Response.Cookies("User")("Pword") = Request.Form("Password")
			Response.Cookies("User")("Cookies") = Request.Form("Cookies")
			Response.Cookies("User").Expires = dateAdd("d", 30, strForumTimeAdjust)
			Session("last_here_date") = ReadLastHereDate(Request.Cookies("User")("Name"))
			strLoginStatus = 1
		else
			strLoginStatus = 0
		end if
case "logout"
		Response.Cookies("User") = ""
		Response.Cookies("User").Expires = dateadd("d", -2, strForumTimeAdjust)
		Response.Cookies("User").Path = strCookieURL
		Response.Cookies("User") = ""
		Response.Cookies("User").Expires = dateadd("d", -2, StrForumTimeAdjust)
'		Session.Abandon
end select

mLev = cint(ChkUser2(Request.Cookies("User")("Name"), Request.Cookies("User")("Pword")))
%>

<html>

<head>
<title><% =strForumTitle %></title>
<meta name="copyright" content="This code is Copyright (C) 2000  Michael Anderson">
<script language="JavaScript">
<!-- hide from JavaScript-challenged browsers
function openWindow(url) {
  popupWin = window.open(url,'new_page','width=400,height=400')
}
function openWindow2(url) {
  popupWin = window.open(url,'new_page','width=400,height=450')
}
function openWindow3(url) {
  popupWin = window.open(url,'new_page','width=400,height=450,scrollbars=yes')
}
function openWindow4(url) {
  popupWin = window.open(url,'new_page','width=400,height=525')
}
// done hiding -->
</script>
<style type=text/css><!--
a:link    {color="<% =strLinkColor %>";text-decoration:<% =strLinkTextDecoration %>}
a:visited {color:"<% =strVisitedLinkColor %>";text-decoration:<% =strVisitedTextDecoration %>}
a:hover   {color:"<% =strHoverFontColor %>";text-decoration:<% =strHoverTextDecoration %>}
--></style>
</HEAD>

<body bgColor="<% =strPageBGColor %>" text="<% =strDefaultFontColor %>" link="<% =strLinkColor %>" aLink="<% =strActiveLinkColor %>" vLink="<% =strActiveLinkColor %>">

<a name="top"></a>

<font face="<% =strDefaultFontFace %>">
<table align="center" border="0" cellPadding="0" cellSpacing="0" width="100%">
  <tr>
    <td valign="top" width="50%"><a href="default.asp"><img alt="<% =strForumTitle %>" border="0" src="<%=strTitleImage%>"></a>
    </td>
    <td align="center" valign="top" width="50%">
    <table border="0" cellPadding="2" cellSpacing="0">
      <tr>
        <td align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b><% =strForumTitle %></b></font></td>
      </tr>
      <tr>
        <td align="center"><font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">
        <a href="<% =strHomeURL %>"><acronym title="Homepage">Retour</acronym></a>
        |
        <a href="javascript:openWindow4('pop_profile.asp?mode=Edit')"><acronym title="Edit your personal profile...">Votre profil</acronym></a>
        |
        <a href="policy.asp"><acronym title="Register to post to our forum...">S'enregistrer</acronym></a>
        |
        <a href="active.asp"><acronym title="See what topics have been active since your last visit...">Sujets en cours</acronym></a>
        |
        <a href="members.asp"><acronym title="Current members of these forums...">Membres</acronym></a>
        |
        <a href="search.asp"><acronym title="Perform a search by keyword, date, and/or name...">Recherche</acronym></a>
        |
        <a href="faq.asp"><acronym title="Answers to Frequently Asked Questions...">FAQ</acronym></a>
        </font></td>
      </tr>
<%
select case Request.Form("Method_Type")

	case "login"
%>
    </table>
    </td>
  </tr>
</table>
<%		if strLoginStatus = 0 then %>
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Your username and/or password were incorrect.</font></p>

<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Please either try again or register for an account.</font></p>
<%		else %>
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">You logged on successfully!</font></p>

<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Thank you for your participation.</font></p>
<%		end if %>
<meta http-equiv="Refresh" content="2; URL=<% =Request.ServerVariables("HTTP_REFERER") %>">

<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="<% =Request.ServerVariables("HTTP_REFERER") %>">Back To Forum</font></a></p>

<!--#INCLUDE FILE="inc_footer.asp" -->
<%		Response.End %>
<%	case "logout" %>
    </table>
    </td>
  </tr>
</table>

<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">You logged out successfully!</font></p>

<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Thank you for your participation.</font></p>

<meta http-equiv="Refresh" content="2; URL=<% =Request.ServerVariables("HTTP_REFERER") %>">

<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="<% =Request.ServerVariables("HTTP_REFERER") %>">Back To Forum</font></a></p>

<!--#INCLUDE FILE="inc_footer.asp" -->
<%		Response.End %>
<% end select %>
<% if (ChkUser2((Request.Cookies("User")("Name")), (Request.Cookies("User")("Pword"))) = 0) then %>
      <form action="<% =Request.ServerVariables("URL") %>" method="post" id=form1 name=form1>
      <INPUT type="hidden" name="Method_Type" value="login">
      <tr>
        <td align="center">
        <table>
          <tr>
<%	if (strAuthType = "db") then %>
            <td><font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>"><b>Nom:</b></font><br>
            <INPUT type="text" name="Name" size="10" value=""></td>
            <td><font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>"><b>Mot de passe:</b></font><br>
            <INPUT type="password" name="Password" size="10" value=""></td>
            <td valign="bottom">
<%		if strGfxButtons <> "0" then %>
            <INPUT src=button_login.gif type="image" value="Login" id=submit1 name=submit1 border=0 hspace=4>
<%		else %>
<%			if strGfxButtons = "0" then %>
            <INPUT type="submit" value="Login" id=submit1 name=submit1>
<%			end if %>
<%		end if %>
            </td>
<%	else %>
<%		if (strAuthType = "nt") then %>
            <td><font face="<% =strDefaultFontFace %>" size="1" color="red">Please <a href="policy.asp">register</a> to post in these Forums</font></td>
<%		end if %>
<%	end if %>
          </tr>
<%	if (lcase(strEmail) = "1") then %>
          <tr>
            <td colspan="3" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">
            <a href="JavaScript:openWindow('pop_pword.asp')">Forgot your <% if strAuthType = "nt" then %>admin <% end if %>Password?</a>
<%		if (lcase(strNoCookies) = "1") then %>
            |
            <a href="admin_home.asp">Admin Options</a>
<%		end if %>
           </font></td>
         </tr>
<%	end if %>
       </table>
       </td>
     </tr>
     </form>
<% else %>
     <form action="<% =Request.ServerVariables("URL") %>" method="post" id=form2 name=form2>
     <INPUT type="hidden" name="Method_Type" value="logout">
     <tr>
       <td align="center">
        <table>
          <tr>
            <td align="center">
            <font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">
            You are logged on as<br>
<%	if strAuthType="nt" then %>
            <b><% =session("username")%>&nbsp;(<% =session("userid") %>)</b>
            </font>
            </td>
            <td>&nbsp;
<%	else %>	
<%		if strAuthType = "db" then %>
            <b><% =Request.Cookies("User")("Name") %></b>
            </font>
            </td>
            <td>
<%			if strGfxButtons <> "0" then %>
            <INPUT src=button_logout.gif type="image" value="Logout" id=submit1 name=submit1 border=0 hspace=4> 
<%			else %>
<%				if strGfxButtons = "0" then %>
            <INPUT type="submit" value="Logout" id=submit1 name=submit1> 
<%				end if %>
<%			end if %>
<%		end if %>
<%	end if %>
            </td>
          </tr>
        </table>
        </td>
     </tr>
<%	if (mlev = 4) or (lcase(strNoCookies) = "1") then %>
     <tr>
       <td align="center">
       <font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">
       <a href="admin_home.asp">Admin Options</a>
       </font>
       </td>
     </tr>
<%	end if %>
     </form>
<% end if %>
   </table>
   </td>
 </tr>
</table>