<%
'#################################################################################
'## Copyright (C) 2000  Michael Anderson and Pierre Gorissen
'## 
'## 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.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to 
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'## 
'## 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.
'## 
'## Support can be obtained from support forums at:
'## http://forum.snitz.com 
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'## 
'## or
'## 
'## Snitz Communications 
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
'##  Part of the Avatar Mod by: Richard Kinser                                  ##
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp" -->
<% If Session(strCookieURL & "Approval") = "15916941253" Then %>
<!--#INCLUDE file="inc_functions.asp" -->
<!--#INCLUDE FILE="inc_code.asp" -->
<!--#INCLUDE file="inc_top.asp" -->
<table border="0" width="95%" align="center">
  <tr>
    <td width="33%" align="left" nowrap><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
    <img src="<%= strImageURL %>icon_folder_open.gif" height=15 width=15 border="0">&nbsp;<a href="default.asp">All Forums</a><br>
    <img src="<%= strImageURL %>icon_bar.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_folder_open.gif" height=15 width=15 border="0">&nbsp;<a href="admin_home.asp">Admin Section</a><br>
    <img src="<%= strImageURL %>icon_blank.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_bar.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_folder_open.gif" height=15 width=15 border="0">&nbsp;<a href="admin_avatar_home.asp">Avatar Setup</a><br>
    <img src="<%= strImageURL %>icon_blank.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_blank.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_bar.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_folder_open.gif" height=15 width=15 border="0">&nbsp;<a href="admin_review_avatar.asp">Review Avatars</a><br>
<%  if Request.Form("Method_Type") = "Write_Configuration" then %>
    	<img src="<%= strImageURL %>icon_blank.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_blank.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_blank.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_bar.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_folder_open_topic.gif" height=15 width=15 border="0">&nbsp;<% =ChkString(Request.Form("AvatarName"),"title") %></font></td>
<%  else %>
    	<img src="<%= strImageURL %>icon_blank.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_blank.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_blank.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_bar.gif" height=15 width=15 border="0"><img src="<%= strImageURL %>icon_folder_open_topic.gif" height=15 width=15 border="0">&nbsp;<% =ChkString(Request.QueryString("A_NAME"),"display") %></font></td>
<%  end if %>
  </tr>
</table>
<%
    if Request.Form("Method_Type") = "Write_Configuration" then

	txtURL = ChkString(Request.Form("AvatarURL"),"url")
	txtName = ChkString(Request.Form("AvatarName"),"")
	
	if txtURL = " " then 
		Err_Msg = Err_Msg & "<li>You Must Enter a URL for your Avatar!</li>"
	end if

	if txtName = " " then 
		Err_Msg = Err_Msg & "<li>You Must Enter a Name for your Avatar!</li>"
	end if

	if Err_Msg = "" then


		'## Forum_SQL - Do DB Update
		strSql = "UPDATE " & strTablePrefix & "AVATAR "
		strSql = strSql & " SET A_URL = '" & txtURL & "'"
		strSql = strSql & ",    A_NAME = '" & txtName & "'"
		strSql = strSql & ",    A_MEMBER_ID = " & ChkString(Request.Form("AvatarMemberID"),"")
		strSql = strSql & " WHERE A_ID = " & Request.Form("A_ID")

		my_Conn.Execute (strSql)
%>
		<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Avatar Updated!</font></p>
		<meta http-equiv="Refresh" content="2; URL=admin_review_avatar.asp">

		<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Congratulations!</font></p>

		<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="admin_review_avatar.asp">Back To Review/Edit Avatars</font></a></p>
<%	else %>
		<p align=center><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">There Was A Problem With Your Details</font></p>

		<table align=center border=0>
		  <tr>
		    <td><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
		      <ul>
			<% =Err_Msg %>
		      </ul>
		    </font></td>
		  </tr>
		</table>

		<p align=center><font face="<% =strDefaultFontFace %>" size=<% =strDefaultFontSize %>><a href="JavaScript:history.go(-1)">Go Back To Enter Data</a></font></p>
<%	end if %>
<%  else %>
<%
	'## Forum_SQL - Get Avatars from DB
	strSql = "SELECT * "
	strSql = strSql & " FROM " & strTablePrefix & "AVATAR "
	strSql = strSql & " WHERE A_ID = " & Request.QueryString("A_ID")

	set rs = my_Conn.Execute (strSql)

        TxtURL = rs("A_URL")
        TxtName = rs("A_NAME")
        TxtMemberID = rs("A_MEMBER_ID")
%>
	<form action="admin_edit_avatar.asp" method="post" id="PostTopic" name="PostTopic">
	<input type="hidden" name="Method_Type" value="Write_Configuration">
	<input type="hidden" name="A_ID" value="<% =rs("A_ID") %>">
	<table border="0" cellspacing="0" cellpadding="0" align=center>
	  <tr>
	    <td bgcolor="<% =strPopUpBorderColor %>">
              <table border="0" cellspacing="1" cellpadding="1">
		<tr valign="center">
		  <td align="center" bgcolor="<% =strHeadCellColor %>" colspan="2"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strHeadFontColor %>"><b>Edit Avatar</b></font></td>
		</tr>
		<tr valign="center">
		  <td bgColor="<% =strPopUpTableColor %>" align="right"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Avatar URL:</b>&nbsp;</font></td>
		  <td bgColor="<% =strPopUpTableColor %>"><input maxLength="255" name="AvatarURL" value="<% =Trim(ChkString(TxtUrl,"display")) %>" size="40"></td>
		</tr>
		<tr valign="center">
		  <td bgColor="<% =strPopUpTableColor %>" align="right"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Avatar Name:</b>&nbsp;</font></td>
		  <td bgColor="<% =strPopUpTableColor %>"><input maxLength="50" name="AvatarName" value="<% =Trim(ChkString(TxtName,"display")) %>" size="40"></td>
		</tr>
		<tr valign="center">
		  <td bgColor="<% =strPopUpTableColor %>" align="right"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Reserved for Member:</b>&nbsp;</font></td>
		  <td bgColor="<% =strPopUpTableColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
  	  	  <select name="AvatarMemberID" size="1">
  	  	  <OPTION <% if IsNull(rs("A_MEMBER_ID")) or rs("A_MEMBER_ID") = " " or rs("A_MEMBER_ID") = "" or rs("A_MEMBER_ID") = 0 then %>selected<% end if %> VALUE="0">&nbsp;None</OPTION>
 		  <% '## Forum_SQL - Get Members from DB
		  strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID"
		  strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_NAME"
		  strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
 	  	  strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.M_NAME <> 'n/a' "
 	  	  strSql = strSql & " ORDER BY " & strMemberTablePrefix & "MEMBERS.M_NAME ASC"

		  set rs1 = Server.CreateObject("ADODB.Recordset")
		  rs1.cachesize = 20
		  rs1.open  strSql, my_Conn, 3

		  if rs1.EOF or rs1.BOF then  '## No replies found in DB
		  else
			  rs1.movefirst
			  rs1.pagesize = strPageSize
			  maxpages = cint(rs1.pagecount)
			  howmanyrecs = 0
			  rec = 1

  			  do until rs1.EOF '** %>
			  	<OPTION <% if rs("A_MEMBER_ID") = rs1("MEMBER_ID") then %>selected<% end if %> VALUE="<% =rs1("MEMBER_ID") %>">&nbsp;<% =rs1("M_NAME") %></OPTION>
			  <% rs1.MoveNext
	 		  rec = rec + 1
			  loop
		  end if
		  rs1.close
		  set rs1 = nothing %>
		  </select></font></td>
		</tr>
		<tr valign="center">
		  <td bgColor="<% =strPopUpTableColor %>" colspan="2" align="center"><input type="submit" value="Update Avatar" id="submit1" name="submit1"> <input type="reset" value="Reset Old Values" id="reset1" name="reset1"></td>
		</tr>
	      </table>
	    </td>
	  </tr>
        </table>
        </form>
        </font>
<%  end if %>
<!--#INCLUDE file="inc_footer.asp" -->
<% else %>
	<% Response.Redirect "admin_login.asp" %>
<% end if %>