%
'#################################################################################
'## 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.
'##
'## 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
'#################################################################################
'---------------------------------------------------------------------------------------
'Name Of File : classifieds.asp
'Author : Alan Le (alanle2000@hotmail.com)
'Description : Main Classifieds Page
' Classified Ads Mod for Snitz Forum 3.1 sr 4
'Created : 1/12/2001
'Modifications
' mm/dd/yyyy - :
' 1) : 1/24/2001
' 2) :
'---------------------------------------------------------------------------------------
%>
UK Karate - Classifieds
<%
'Declare Variables
Dim rsClassifieds
set rsClassifieds = server.CreateObject("adodb.recordset")
'Set the number of days that ads are to run
AdRunLength = 30
datAddLength = dateAdd("D",-AdRunLength,now)
'Delete the old ads first
Call DeleteOldAds
dim sMode
sMode = Request.QueryString("mode")
catID = Request.QueryString("ID")
if sMode = "delete" and mlev = 4 then
sSQL = ""
sSQL = sSQL & "DELETE FROM ADS_CATEGORY WHERE ID = " & catID
my_Conn.Execute(sSQL)
Response.Write("
Category successfully deleted.
")
end if
'Get the categories
strSelectCats = "Select ID, Category_Name, Description FROM ADS_CATEGORY ORDER BY Category_Name"
set rsClassifieds = my_Conn.Execute(strSelectCats)
%>
|
<%= strForumTitle %> Classifieds
|
<%
'displays the existing categories.
call DisplayCategories
%>
<%
'show add category option if the user has admin status.
if mlev = 4 then
%>
|
Add a New Ad Category
|
<%end if%>
|
<%
dim rsAds
set rsAds = server.CreateObject("adodb.recordset")
'get the ads for this category
strSql = "Select top 5 ID, Topic_ID, ad_title, content, price, image_url, name, added_By, address, city, zip, state, email, date_posted, "
strSql = strSql & "link FROM ADS_CONTENT ORDER BY date_posted desc"
Set rsAds = my_Conn.Execute(strSql)
%>
| Most Recent Ads |
<%
If rsAds.eof then%>
|
There are no Ads yet. Why not be the first to place one?
|
<% Else
iswitch = TRUE
Do While Not rsAds.eof
%>
Location: <%=rsAds("state")%>
Contact: "><%=getMemberName(rsAds("Added_By"))%>
Price: $<%if rsAds("price") <> "" then Response.write chkstring(rsAds("price"), "display")%>
|
"><%= rsAds("ad_title")%>
<%= LEFT(rsAds("content"), 125)%>...
|
<%
rsAds.MoveNext
Loop
End If
rsAds.Close
set rsAds = nothing
%>
|
<%
Function adCount(catID)
caSQL = "SELECT COUNT(*) as Total FROM ADS_CONTENT WHERE Topic_ID = " & catID
dim rsCount
set rsCount = server.CreateObject("adodb.recordset")
Set rsCount = my_Conn.Execute(caSQL)
adCount = rsCount.Fields("Total")
rsCount.Close
Set rsCount = Nothing
End Function
Sub DeleteOldAds
strSql = "DELETE FROM ADS_CONTENT WHERE date_posted < '" & datetostr(datAddLength) & "'"
my_Conn.Execute(strSql)
End Sub
Sub DisplayCategories
Do While Not rsClassifieds.eof
%>
"><%= rsClassifieds("Category_Name")%> (<%= adCount(rsClassifieds("ID"))%>)
<%If mlev = 4 Then%>
">
">
<%End If%>
<%= rsClassifieds("Description")%>
|
<% rsClassifieds.MoveNext
If rsClassifieds.eof Then%>
|
<%Else%>
"><%= rsClassifieds("Category_Name")%> (<%= adCount(rsClassifieds("ID"))%>)
<%If mlev = 4 Then%>
">
">
<%End If%>
<%= rsClassifieds("Description")%>
|
<% rsClassifieds.MoveNext
End If
Loop
End Sub
%>