Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Classifieds v1.2
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 7

Ryan
Average Member

USA
858 Posts

Posted - 29 July 2003 :  14:09:07  Show Profile  Visit Ryan's Homepage
As I told D3mon I would release this MOD since this MOD is archived and the link no longer works. I updated the readme.

Download

No demo available.

Hope everyone enjoys! Credit for the script goes to Aznknight who was the original author.

The Poultry Link - "Serving the best of the fancy with the best of the web"
Forum Setup Help

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 29 July 2003 :  14:31:11  Show Profile  Visit D3mon's Homepage
Nice work reducks. This OK for Snitz version 3.4.03?


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

Ryan
Average Member

USA
858 Posts

Posted - 29 July 2003 :  14:52:38  Show Profile  Visit Ryan's Homepage
Yes, I have the latest version (3.4.03) and it works like a dream.

The Poultry Link - "Serving the best of the fancy with the best of the web"
Forum Setup Help
Go to Top of Page

AWD_ENVY
Junior Member

103 Posts

Posted - 29 July 2003 :  17:48:19  Show Profile
Just installed, and ran accross a MySQL incompatibility.....

In "Classifieds.asp" Lines 155 & 156:

strSql = "Select top 15 ID, Topic_ID, ad_title, price, image_url, name, added_By, address, city, zip, state, email, date_posted, content, "
strSql = strSql & "link FROM " & strTablePrefix &  "ADS_CONTENT ORDER BY date_posted desc"

MySQL doesn't support the "Top" command... I changed it to the following for compatibility.
strSql = "Select ID, Topic_ID, ad_title, price, image_url, name, added_By, address, city, zip, state, email, date_posted, content, "
strSql = strSql & "link FROM " & strTablePrefix &  "ADS_CONTENT ORDER BY date_posted desc LIMIT 15"


Otherwise it seems good... if I come across anything else I'll post it.

Edited by - AWD_ENVY on 29 July 2003 17:49:01
Go to Top of Page

Ryan
Average Member

USA
858 Posts

Posted - 29 July 2003 :  17:52:40  Show Profile  Visit Ryan's Homepage
Good. Does anyone know if a change like this would affect Access? Should I update the .zip file? Or just let MySQL users find AWD ENVY's post?

The Poultry Link - "Serving the best of the fancy with the best of the web"
Forum Setup Help
Go to Top of Page

AWD_ENVY
Junior Member

103 Posts

Posted - 29 July 2003 :  17:57:04  Show Profile
I would use this in your code at line 156 this would cover all DB's.



IF strDBType = "mysql" THEN
	strSql = "Select ID, Topic_ID, ad_title, price, image_url, name, added_By, address, city, zip, state, email, date_posted, content, "
	strSql = strSql & "link FROM " & strTablePrefix &  "ADS_CONTENT ORDER BY date_posted desc LIMIT 15"
ELSE 
	strSql = "Select top 15 ID, Topic_ID, ad_title, price, image_url, name, added_By, address, city, zip, state, email, date_posted, content, "
	strSql = strSql & "link FROM " & strTablePrefix &  "ADS_CONTENT ORDER BY date_posted desc"
END IF


Go to Top of Page

AWD_ENVY
Junior Member

103 Posts

Posted - 29 July 2003 :  17:59:59  Show Profile
Also a WARNING to anyone that clicks on a "Delete Categories" icon.... there is no "Are you sure" message....

I Accidentally clicked on one, and it just removed the categorie... this could be bad news if this accident happened with a categorie full of user classifieds.


I personaly would like to see a delete confirmation screen before it removes it to avoid this situation...

Edited by - AWD_ENVY on 29 July 2003 18:01:13
Go to Top of Page

Ryan
Average Member

USA
858 Posts

Posted - 29 July 2003 :  18:11:05  Show Profile  Visit Ryan's Homepage
Sorry AWD ENVY. I am not super keen on ASP. I am just releasing Aznknight's work again because his link does not work. If anyone would like you can change the code and Email Me the download link. I will include your modifications in a new version (if I come out with one) which will be available at this topic and at snitzbitz.

The Poultry Link - "Serving the best of the fancy with the best of the web"
Forum Setup Help
Go to Top of Page

AWD_ENVY
Junior Member

103 Posts

Posted - 29 July 2003 :  18:13:35  Show Profile
Classifieds.asp Editied for MySQL support




<%
'#################################################################################
'## 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)	:	 Updated for Snitz Ver 3.4.03	
'---------------------------------------------------------------------------------------
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_func_common.asp" -->
<!--#INCLUDE FILE="inc_header.asp" -->
<!--#INCLUDE FILE="inc_func_class.asp" -->
<style type="text/css">
<!--
A.PlaceAdLink:link
{
    COLOR: white;
    CURSOR: nw-resize;
    FONT-FAMILY: Tahoma, Verdana, Arial;
    FONT-WEIGHT: bold;
    TEXT-DECORATION: none
}
A.PlaceAdLink:visited
{
    COLOR: white;
    CURSOR: nw-resize;
    FONT-FAMILY: Tahoma, Verdana, Arial;
    FONT-WEIGHT: bold;
    TEXT-DECORATION: none
}
A.PlaceAdLink:hover
{
    COLOR: red;
    CURSOR: nw-resize;
    FONT-FAMILY: Tahoma, Verdana, Arial;
    FONT-WEIGHT: bold;
    TEXT-DECORATION: underline
}
-->
</style>
<%
'Declare Variables
Dim rsClassifieds
set rsClassifieds = server.CreateObject("adodb.recordset")

'Set the number of days that ads are to run
AdRunLength = 60
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 > 0 then
	sSQL = ""
	sSQL = sSQL & "DELETE FROM " & strTablePrefix & "ADS_CATEGORY WHERE ID = " & catID
	my_Conn.Execute(sSQL)
	Response.Write("<CENTER><BR>Category successfully deleted.<BR><BR>")
end if

'Get the categories
strSelectCats = "Select ID, Category_Name, Description FROM " & strTablePrefix & "ADS_CATEGORY ORDER BY Category_Name"
set rsClassifieds = my_Conn.Execute(strSelectCats)
%>
<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"> <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"> <a href="classifieds.asp">Classifieds Categories</a>
    </font></td>
  </tr>
</table>
<p align="center"><b><font face="Verdana" size="1">Please note: all ads expire after 60 days<br>
To place an ad, first select the category.</font></b></p>

<table bgcolor="<% =strTableBorderColor %>" border="0" cellpadding="0" cellspacing="1" width="95%" ALIGN=CENTER>
	<tr>
		<td bgcolor="<% =strForumCellColor %>" align="center" valign="top">
			<table border="0" cellpadding="4" cellspacing="0" width="100%" height="100%">
				<tr>
					<td align="center" colspan=2 bgcolor="<% =strHeadCellColor %>">
						<b><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strHeadFontColor %>"><%= strForumTitle %> Classifieds</font></b>
					</td>
				</tr>
				<% 
				'displays the existing categories.
				call DisplayCategories 
				%>
				<%
				'show add category option if the user has admin status.
				if mlev = 4 then
				%>
				<tr>
					<td colspan=2 bgcolor="<% =strForumCellColor %>" align="center">
						<b><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strHeadFontColor %>"><a href=classadmin.asp >Add a New Ad Category</a></font></b>
					</td>
				</tr>
				<%end if%>
			</table>
		</td>
	</tr>
</table>
<br>
<%
dim rsAds
set rsAds = server.CreateObject("adodb.recordset")

'get the ads for this category
IF strDBType = "mysql" THEN
	strSql = "Select ID, Topic_ID, ad_title, price, image_url, name, added_By, address, city, zip, state, email, date_posted, content, "
	strSql = strSql & "link FROM " & strTablePrefix &  "ADS_CONTENT ORDER BY date_posted desc LIMIT 15"
ELSE 
	strSql = "Select top 15 ID, Topic_ID, ad_title, price, image_url, name, added_By, address, city, zip, state, email, date_posted, content, "
	strSql = strSql & "link FROM " & strTablePrefix &  "ADS_CONTENT ORDER BY date_posted desc"
END IF

Set rsAds = my_Conn.Execute(strSql)

%>
<table bgcolor="<% =strTableBorderColor %>" border="0" cellpadding="0" cellspacing="0" width="95%" ALIGN=CENTER>
	<tr>
		<td bgcolor="black" align="center" valign="top">
			<table bgcolor="<% =strTableBorderColor %>" border="0" cellpadding="4" cellspacing="1" width="100%" height="100%">
				<tr>
					<td align="center" bgcolor="<% =strCategoryCellColor %>" width="50%" colspan="2"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" valign="top"><b>15 Most Recent Ads</b></font></td>
				</tr>
<%
	If rsAds.eof then%>
				<TR >
					<TD COLSPAN="2" height="150" align=center bgcolor="<% =strForumCellColor %>">
						<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">There are no Ads yet.  Why not be the first to place one?</font>
					</TD>
				</TR>
<%	Else
		iswitch = TRUE
		Do While Not rsAds.eof
		%>
				<TR>
					<TD valign=top bgcolor="<% =strForumCellColor %>" width="20%">
						<font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">
						<B>Location:</B> <%=rsAds("state")%><BR>
						<B>Contact:</B> <a href="pop_profile.asp?mode=display&id=<%=rsAds("Added_By")%>"><%=getMemberName(rsAds("Added_By"))%></a><br>
						<B>Price:</B> $<%if rsAds("price") <> "" then Response.write chkstring(rsAds("price"), "display")%>
						</font>
					</TD>
					<TD valign=top bgcolor="<% =strForumCellColor %>" width="80%">
						<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
						<A HREF="classdetail.asp?id=<%= rsAds("ID")%>"><B><%= rsAds("ad_title")%></B></A>
					<% If mLev = 4 or rsAds("added_by") = getNewMemberNumber() then %>
					<a href="classViewAds.asp?classID=<%= rsAds("ID") %>&mode=delete&catID=<%= rsAds("topic_ID") %>"><img src="<%= strImageURL %>icon_delete_reply.gif" width="15" height="15" border="0" alt=""></a>
					<% End If 
					if mlev = 4 or rsAds("added_by") = getNewMemberNumber() then%>
					<a href="classEditAd.asp?classID=<%= rsAds("ID") %>&mode=delete&catID=<%= rsAds("topic_ID") %>"><img src="<%= strImageURL %>icon_pencil.gif" width="12" height="12" border="0" alt=""></a>
					<% End If %>
						<br>
						<%= LEFT(rsAds("content"), 125)%>... 
						</font>
					</TD>
				</TR>
		<%
			rsAds.MoveNext
		Loop

	End If
				
rsAds.Close
set rsAds = nothing
%>
				</tr>
			</table>
		</td>
	</tr>
</table>
 




<%
	WriteFooter
Function adCount(catID)
	caSQL = "SELECT COUNT(*) as Total FROM " & strTablePrefix & "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 " & strTablePrefix & "ADS_CONTENT WHERE date_posted < '" & datetostr(datAddLength) & "'"
   my_Conn.Execute(strSql)   
End Sub

Sub DisplayCategories
	Do While Not rsClassifieds.eof
	%>
				<TR>
					<td width="50%">
						 <p align="left">
						<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
						<b><A HREF="classViewAds.asp?catID=<%= rsClassifieds("ID")%>"><%= rsClassifieds("Category_Name")%></A></b> <i>(<%= adCount(rsClassifieds("ID"))%>)</i>
						<%If mlev = 4 Then%>
							<a HREF="classadmin.asp?mode=edit&ID=<%= rsClassifieds("ID")%>"><img SRC="<%= strImageURL %>icon_pencil.gif" BORDER="0" WIDTH="12" HEIGHT="12"></a>
							<a HREF="classifieds.asp?mode=delete&ID=<%= rsClassifieds("ID")%>"><img SRC="<%= strImageURL %>icon_trashcan.gif" BORDER="0" WIDTH="12" HEIGHT="12"></a>
						<%End If%>
						<br><%= rsClassifieds("Description")%>
						</p>
						</font>
					</td>
		<%	rsClassifieds.MoveNext
		If rsClassifieds.eof Then%>
					<TD> </TD>
				</TR>
		<%Else%>
					<TD width="50%">
						<p align="left">
						<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
						<b><A HREF="classViewAds.asp?catID=<%= rsClassifieds("ID")%>"><%= rsClassifieds("Category_Name")%></A></b> <i>(<%= adCount(rsClassifieds("ID"))%>)</i>
						<%If mlev = 4 Then%>
							<a HREF="classadmin.asp?mode=edit&ID=<%= rsClassifieds("ID")%>"><img SRC="<%= strImageURL %>icon_pencil.gif" BORDER="0" WIDTH="12" HEIGHT="12"></a>
							<a HREF="classifieds.asp?mode=delete&ID=<%= rsClassifieds("ID")%>"><img SRC="<%= strImageURL %>icon_trashcan.gif" BORDER="0" WIDTH="12" HEIGHT="12"></a>
						<%End If%>
						<br><%= rsClassifieds("Description")%>
						</p>
						</font>
					</TD>
				</TR>
	<%		rsClassifieds.MoveNext
		End If
	Loop
End Sub
%>
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 29 July 2003 :  18:14:44  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
quote:
Originally posted by AWD_ENVY

Just installed, and ran accross a MySQL incompatibility.....

In "Classifieds.asp" Lines 155 & 156:

strSql = "Select top 15 ID, Topic_ID, ad_title, price, image_url, name, added_By, address, city, zip, state, email, date_posted, content, "
strSql = strSql & "link FROM " & strTablePrefix &  "ADS_CONTENT ORDER BY date_posted desc"

MySQL doesn't support the "Top" command... I changed it to the following for compatibility.
strSql = "Select ID, Topic_ID, ad_title, price, image_url, name, added_By, address, city, zip, state, email, date_posted, content, "
strSql = strSql & "link FROM " & strTablePrefix &  "ADS_CONTENT ORDER BY date_posted desc LIMIT 15"


Otherwise it seems good... if I come across anything else I'll post it.



Snitz has a function called TopSQL that changes the sql string depending on the used database.
So you can simply avoid errors with MySQL (or MS SQL) by changing the code from

strSql = "Select top 15 ID, Topic_ID, ad_title, price, image_url, name, added_By, address, city, zip, state, email, date_posted, content, "
strSql = strSql & "link FROM " & strTablePrefix &  "ADS_CONTENT ORDER BY date_posted desc"

to

strSql = "Select ID, Topic_ID, ad_title, price, image_url, name, added_By, address, city, zip, state, email, date_posted, content, "
strSql = strSql & "link FROM " & strTablePrefix &  "ADS_CONTENT ORDER BY date_posted desc"
strSql = TopSQL(strSql,15)


My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

AWD_ENVY
Junior Member

103 Posts

Posted - 29 July 2003 :  18:33:40  Show Profile

Next issue up for assement


When Creating categories... If you put a -> ' <- in the description field (example: DVD's) you'll get an error.


The way I fixed it.

Line 176 of "classadmin.asp":

ORIGINAL:
strSQL = "UPDATE " & strTablePrefix & "ADS_CATEGORY set Category_Name = '" & chkString(Category, "SQLString") & "', Description = '" & request.form("CategoryDescription") & "'"

EDITED:
strSQL = "UPDATE " & strTablePrefix & "ADS_CATEGORY set Category_Name = '" & chkString(Category, "SQLString") & "', Description = '" & chkString(request.form("CategoryDescription"), "SQLString") & "'"
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 29 July 2003 :  18:59:55  Show Profile  Visit Webbo's Homepage
Nice one reducks but why didn't you do it earlier as it would have saved me some time lol

Here's a link to mine: http://www.maggotdrowning.com/forum/classifieds.asp

It's been running now for 5months on a MySql with no issues other than the 'Top 15 ID' incompatability. I've changed a few things to include the date of the advert in the 'Most Recent Ads' and some changes in the 'placeads.asp'

When Deleting a category or an advert you do not get a prompt; this would be a nice addition.
If you want a copy of the files to compare reducks, email me and I'll send them over

Go to Top of Page

Kent
Junior Member

United States
193 Posts

Posted - 29 July 2003 :  23:56:13  Show Profile
Anyone have an image upload working seamlessly in their classifieds?
Go to Top of Page

AWD_ENVY
Junior Member

103 Posts

Posted - 30 July 2003 :  02:14:58  Show Profile
quote:
Originally posted by Kent

Anyone have an image upload working seamlessly in their classifieds?



I do, as well as a "Similar ad's that might be of interest" query that shows when a user views an Ad.

I'll post the code tomorrow if you want it.
Go to Top of Page

Kent
Junior Member

United States
193 Posts

Posted - 30 July 2003 :  17:28:36  Show Profile
Please do...

I've tried integrating it in HuwR's code (based on Azaniah's v3.3 code originally) and can't get it to work cleanly, so I scrapped it.
Go to Top of Page

Ryan
Average Member

USA
858 Posts

Posted - 30 July 2003 :  23:15:37  Show Profile  Visit Ryan's Homepage
Webbo,
Just wondering where you got that auction script?

The Poultry Link - "Serving the best of the fancy with the best of the web"
Forum Setup Help
Go to Top of Page
Page: of 7 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07