<%
'***********************************************************************
'** Copyright (C) 2001 - 2004 Max Yuan All Rights Reserved
'**
'** By using this program, you are agreeing to the terms of the
'** GNU General Public License.
'**
'** 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 MaxWebPortal must remain intact
'** in the scripts and in the outputted HTML.
'** The "powered by" text/logo with a link back to 
'** http://www.maxwebportal.com in the footer of the pages MUST
'** remain visible when the pages are viewed on the internet or intranet.
'**
'** Support can be obtained from support forums at:
'** http://www.maxwebportal.com
'**
'** Email: maxwebportal@hotmail.com
'** ICQ: 148111300
'***********************************************************************
'** This Page Contains source code of Snitz Forums 2000
'***********************************************************************
'#################################################################################
'## 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
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_adminvar.asp" --><%If Session(strCookieURL & "Approval") = "256697926329" and instr(strWebMaster,lcase(strAdmin1UserName)&",") <> 0 and not lcase(strAdmin1UserName) = "" and not lcase(strAdmin1UserName) = " " Then %>
<!--#INCLUDE file="inc_functions.asp" -->
<!--#INCLUDE file="inc_top.asp" -->
<table width="100%" align="center" border=0>
  <tr>
    <td width="33%" align="left" nowrap><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
    <img src="icon_folder_open.gif" height=15 width=15 border="0">&nbsp;<a href="default.asp">Home</a><br>
    <img src="icon_blank.gif" height=15 width=15 border="0"><img src="icon_folder_open.gif" height=15 width=15 border="0">&nbsp;<a href="admin_home.asp">Admin&nbsp;Section</a><br>
    <img src="icon_blank.gif" height=15 width=15 border="0"><img src="icon_blank.gif" height=15 width=15 border="0"><img src="icon_folder_open_topic.gif" height=15 width=15 border="0">&nbsp;Private Messages Maintenance<br>
    </font></td>
  </tr>
</table>
<%
	if Request.Form("Method_Type") = "Write_Configuration" then 
		Err_Msg = ""
		if Err_Msg = "" then

			'## Delete private messages
			strMessageDays = datetostr(dateAdd("d",-Request.Form("strMessageDays"),strForumTimeAdjust))
			strSql = "DELETE FROM " & strTablePrefix & "PM "
			strSql = strSql & "WHERE M_SENT < '" & strMessageDays & "'"
			if Request.Form("UnRead") = "yes" then
				strSql = strSql & " AND M_READ = 0"
			else
				strSql = strSql & " AND M_READ = 1"
			end if

			my_Conn.Execute (strSql)

%>
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Messages Deleted!</font></p>
<meta http-equiv="Refresh" content="2; URL=admin_home.asp">
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="admin_home.asp">Back To Admin Home</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 %>
<%
	strMessage15Days = datetostr(dateAdd("d",-15,strForumTimeAdjust))
	strMessage30Days = datetostr(dateAdd("d",-30,strForumTimeAdjust))
	strMessage45Days = datetostr(dateAdd("d",-45,strForumTimeAdjust))
	strMessage60Days = datetostr(dateAdd("d",-60,strForumTimeAdjust))

	if strDBType = "access" then
		strSqL = "SELECT count(M_TO) as [pmcount] " 
	else
        	strSQL = "SELECT count(M_TO) as pmcount " 
    	end if
	strSql = strSql & " FROM " & strTablePrefix & "PM "
	strSql = strSql & " WHERE M_READ = 1"

	Set rsPM = my_Conn.Execute(strSql)
	pmcountr = rsPM("pmcount")

	rsPM.close
	set rsPM = nothing

	if strDBType = "access" then
		strSqL = "SELECT count(M_TO) as [pmcount] " 
	else
        	strSQL = "SELECT count(M_TO) as pmcount " 
    	end if
	strSql = strSql & " FROM " & strTablePrefix & "PM "
	strSql = strSql & " WHERE M_READ = 0"

	Set rsPM = my_Conn.Execute(strSql)
	pmcountu = rsPM("pmcount")

	rsPM.close
	set rsPM = nothing

	if strDBType = "access" then
		strSqL = "SELECT count(M_TO) as [pmcount] " 
	else
        	strSQL = "SELECT count(M_TO) as pmcount " 
    	end if
	strSql = strSql & " FROM " & strTablePrefix & "PM "
	strSql = strSql & " WHERE M_SENT < '" & strMessage15Days & "' AND M_READ = 1"

	Set rsPM = my_Conn.Execute(strSql)
	pmcount15r = rsPM("pmcount")

	rsPM.close
	set rsPM = nothing

	if strDBType = "access" then
		strSqL = "SELECT count(M_TO) as [pmcount] " 
	else
        	strSQL = "SELECT count(M_TO) as pmcount " 
    	end if
	strSql = strSql & " FROM " & strTablePrefix & "PM "
	strSql = strSql & " WHERE M_SENT < '" & strMessage15Days & "' AND M_READ = 0"

	Set rsPM = my_Conn.Execute(strSql)
	pmcount15u = rsPM("pmcount")

	rsPM.close
	set rsPM = nothing

	if strDBType = "access" then
		strSqL = "SELECT count(M_TO) as [pmcount] " 
	else
        	strSQL = "SELECT count(M_TO) as pmcount " 
    	end if
	strSql = strSql & " FROM " & strTablePrefix & "PM "
	strSql = strSql & " WHERE M_SENT < '" & strMessage30Days & "' AND M_READ = 1"

	Set rsPM = my_Conn.Execute(strSql)
	pmcount30r = rsPM("pmcount")

	rsPM.close
	set rsPM = nothing

	if strDBType = "access" then
		strSqL = "SELECT count(M_TO) as [pmcount] " 
	else
        	strSQL = "SELECT count(M_TO) as pmcount " 
    	end if
	strSql = strSql & " FROM " & strTablePrefix & "PM "
	strSql = strSql & " WHERE M_SENT < '" & strMessage30Days & "' AND M_READ = 0"

	Set rsPM = my_Conn.Execute(strSql)
	pmcount30u = rsPM("pmcount")

	rsPM.close
	set rsPM = nothing

	if strDBType = "access" then
		strSqL = "SELECT count(M_TO) as [pmcount] " 
	else
        	strSQL = "SELECT count(M_TO) as pmcount " 
    	end if
	strSql = strSql & " FROM " & strTablePrefix & "PM "
	strSql = strSql & " WHERE M_SENT < '" & strMessage45Days & "' AND M_READ = 1"

	Set rsPM = my_Conn.Execute(strSql)
	pmcount45r = rsPM("pmcount")

	rsPM.close
	set rsPM = nothing

	if strDBType = "access" then
		strSqL = "SELECT count(M_TO) as [pmcount] " 
	else
        	strSQL = "SELECT count(M_TO) as pmcount " 
    	end if
	strSql = strSql & " FROM " & strTablePrefix & "PM "
	strSql = strSql & " WHERE M_SENT < '" & strMessage45Days & "' AND M_READ = 0"

	Set rsPM = my_Conn.Execute(strSql)
	pmcount45u = rsPM("pmcount")

	rsPM.close
	set rsPM = nothing

	if strDBType = "access" then
		strSqL = "SELECT count(M_TO) as [pmcount] " 
	else
        	strSQL = "SELECT count(M_TO) as pmcount " 
    	end if
	strSql = strSql & " FROM " & strTablePrefix & "PM "
	strSql = strSql & " WHERE M_SENT < '" & strMessage60Days & "' AND M_READ = 1"

	Set rsPM = my_Conn.Execute(strSql)
	pmcount60r = rsPM("pmcount")

	rsPM.close
	set rsPM = nothing

	if strDBType = "access" then
		strSqL = "SELECT count(M_TO) as [pmcount] " 
	else
        	strSQL = "SELECT count(M_TO) as pmcount " 
    	end if
	strSql = strSql & " FROM " & strTablePrefix & "PM "
	strSql = strSql & " WHERE M_SENT < '" & strMessage60Days & "' AND M_READ = 0"

	Set rsPM = my_Conn.Execute(strSql)
	pmcount60u = rsPM("pmcount")

	rsPM.close
	set rsPM = nothing
%>
<br>
<table border="0" cellspacing="0" cellpadding="0" align=center>
  <tr>
    <td bgcolor="<% =strPopUpBorderColor %>">
      <table border="0" cellspacing="1" cellpadding="4">
	<tr valign="top">
	  <td bgColor="<% =strHeadCellColor %>" align="center" colspan="3"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Current Private Message Counts</b></font></td>
	</tr>
	<tr valign="top">
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Time Period</b></font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Read</b></font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Unread</b></font></td>
	</tr>
	<tr valign="top">
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">All</font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><% =pmcountr %></font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><% =pmcountu %></font></td>
	</tr>
	<tr valign="top">
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">Older than 15 days</font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><% =pmcount15r %></font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><% =pmcount15u %></font></td>
	</tr>
	<tr valign="top">
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">Older than 30 days</font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><% =pmcount30r %></font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><% =pmcount30u %></font></td>
	</tr>
	<tr valign="top">
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">Older than 45 days</font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><% =pmcount45r %></font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><% =pmcount45u %></font></td>
	</tr>
	<tr valign="top">
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">Older than 60 days</font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><% =pmcount60r %></font></td>
	  <td bgColor="<% =strPopUpTableColor %>" align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><% =pmcount60u %></font></td>
	</tr>
      </table>
    </td>
  </tr>
</table>
<br>
<form action="admin_pm.asp" method="post" id="Form1" name="Form1">
<input type="hidden" name="Method_Type" value="Write_Configuration">
<table border="0" cellspacing="0" cellpadding="0" align=center>
  <tr>
    <td bgcolor="<% =strPopUpBorderColor %>">
      <table border="0" cellspacing="1" cellpadding="4">
	<tr valign="top">
	  <td bgcolor="<% =strHeadCellColor %>" colspan="2"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strHeadFontColor %>"><b>Private Messages Maintenance</b></font></td>
	</tr>
	<tr valign="top">
	  <td bgColor="<% =strPopUpTableColor %>" align="right"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Delete Private Messages Older than:</b>&nbsp;</font></td>
	  <td bgColor="<% =strPopUpTableColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
	  <select name="strMessageDays" size=1>
	  	<option value=0>All</option>
	  	<option value=15>15 days</option>
	  	<option value=30>30 days</option>
	  	<option value=45 selected>45 days</option>
	  	<option value=60>60 days</option>
	  </select></font></td>
	</tr>
	<tr valign="top">
	  <td bgColor="<% =strPopUpTableColor %>" colspan="2"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
          <input name="UnRead" type="checkbox" value="yes">Check here to delete Unread Messages<br></font></td>
	</tr>
	<tr valign="top">
	  <td bgColor="<% =strPopUpTableColor %>" colspan="2" align="center"><input type="submit" value="Submit" id="submit1" name="submit1"> <input type="reset" value="Reset Old Values" id="reset1" name="reset1"></td>
	</tr>
      </table>
    </td>
  </tr>
</table>
</form>
<%	end if %>
<!--#INCLUDE file="inc_footer.asp" -->
<% Else %>
<% Response.Redirect "admin_login.asp" %>
<% End IF %>
