<% Function readFile(rFile, iArray) Set riFile = objFile.GetFile(rFile) Set recordGet=objFile.OpenTextFile(riFile, 1, False) On Error Resume Next rec = recordGet.Read(riFile.Size) On Error GoTo 0 recordGet.Close rec = ClearCarriageReturn(rec) Select Case iArray Case True: readFile = Split(rec, vbCrLf) Case False: readFile = rec Case "decode" recArray = Split(rec, vbCrLf) For each recItem in recArray recItem = CryptText(recItem, key, True) decodeRec = decodeRec & vbCrLf & recItem Next decodeRec = ClearCarriageReturn(decodeRec) readFile = decodeRec End Select End Function Sub writeFile(iFile, iData) iData = ClearCarriageReturn(iData) Set recordSet = objFile.OpenTextFile(iFile, 2, True) recordSet.WriteLine iData recordSet.Close Set iData = Nothing End Sub Sub appendFile(iFile, iData) Set recordSet = objFile.OpenTextFile(iFile, 8, True) recordSet.WriteLine iData recordSet.Close End Sub Function updateUserPostData(userID, strVary, credit, action) setLocale server_locale Select Case action Case "postnew" session("user_logged_ads" & strSUnique) = CLng(session("user_logged_ads" & strSUnique)) + 1 If isnotfree then creditsUpdate = FormatNumber(CCur(session("user_logged_credit" & strSUnique)) - CCur(credit), 2) session("user_logged_credit" & strSUnique) = creditsUpdate strSQL = "UPDATE " & tablUPfx & "User SET ads = ads + 1, credits = '" & CStr(creditsUpdate) & "' WHERE userID = " & CLng(userID) & ";" Else: strSQL = "UPDATE " & tablUPfx & "User SET ads = ads + 1 WHERE userID = " & CLng(userID) & ";" End If objConn.Execute(strSQL) Case "delete" If isnotfree and not credit = 0 then credits = CCur(FormatNumber(CCur(credit), 2)) strSQL = "UPDATE " & tablUPfx & "User SET ads = " & CLng(strVary) & ", credits = '" & credits & "' WHERE userID = " & CLng(userID) & ";" Else: strSQL = "UPDATE " & tablUPfx & "User SET ads = " & CLng(strVary) & " WHERE userID = " & CLng(userID) & ";" End If objConn.Execute(strSQL) End Select setLocale resetLocale End Function Function RandomNumber() Randomize RandomNumber = Int((899999 * Rnd) + 100000) End Function Function ClearCarriageReturn(recClearRet) Do Until Not Right(recClearRet, 2) = vbCrLf And Not Left(recClearRet, 2) = vbCrLf If Right(recClearRet, 2) = vbCrLf Then recClearRet = Left(recClearRet, Len(recClearRet) - 2) If Left(recClearRet, 2) = vbCrLf Then recClearRet = Right(recClearRet, Len(recClearRet) - 2) Loop ClearCarriageReturn = recClearRet End Function '*** This function enables posting http links within comment area if HTML is disabled. Function encodeURL(text) set re = new RegExp re.global=true re.ignoreCase=true re.Pattern = "(((http)|(ftp)|(https))(://)(\w|-)+(\.)(\w|-|\.|/|\?|&|=|/|:|;|%|\+)+)" temp = re.replace(text, "") re.Pattern = "([A-Za-z0-9_\-\.]+@(\w+|\w+-\w+)\.[A-Za-z0-9_\.]+)" encodeURL = re.replace(temp, " ($1)") End Function Function UpdateList(action, catID, scatID, cat3rdID) Select Case action Case True: strOperator = "+ 1" Case False: strOperator = "- 1" End Select catID = CLng(catID) scatID = CLng(scatID) cat3rdID = CLng(cat3rdID) objConn.Execute("UPDATE " & tablPfx & "Cat SET ads = ads " & strOperator & " WHERE catID = " & catID & ";") objConn.Execute("UPDATE " & tablPfx & "Scat SET ads = ads " & strOperator & " WHERE sCatID = " & scatID & ";") If cat3rdID > 0 then objConn.Execute("UPDATE " & tablPfx & "Scat SET ads = ads " & strOperator & " WHERE catID = " & scatID & " AND sCatID = " & cat3rdID & ";") End Function Sub ExpireAds() setLocale server_locale On Error Resume Next Dim uNick, uEmail Select Case Application("Today_Expire_Flag" & strUnique) Case Empty Application("Today_Expire_Date" & strUnique) = Date Application("Today_Expire_Flag" & strUnique) = "1" ExpireAds Case "1" sdd = dd(objConn) If mysql then strSQL = "SELECT " & tablUPfx & "User.email," & tablPfx & "Ads.nick," & tablPfx & "Ads.catID," & tablPfx & "Ads.sCatID," & tablPfx & "Ads.adID," & tablPfx & "Ads.cat3rdID," & tablPfx & "Ads.subject FROM " & tablUPfx & "User," & tablPfx & "Ads WHERE " strSQL = strSQL & "(" & tablPfx & "Ads.userID = " & tablUPfx & "User.userID AND " & tablPfx & "Ads.status = 1 AND " & tablPfx & "Ads.edate <= CURDATE()) LIMIT 0,1;" Else strSQL = "SELECT TOP 1 " & tablUPfx & "User.email," & tablPfx & "Ads.nick," & tablPfx & "Ads.catID," & tablPfx & "Ads.sCatID," & tablPfx & "Ads.adID," & tablPfx & "Ads.cat3rdID," & tablPfx & "Ads.subject FROM " & tablUPfx & "User," & tablPfx & "Ads WHERE " strSQL = strSQL & "(" & tablPfx & "Ads.userID = " & tablUPfx & "User.userID AND " & tablPfx & "Ads.status = 1 AND " & tablPfx & "Ads.edate <= " & sdd & ConvDateShort(Date) & sdd & ");" End If set rsExp = objConn.Execute(strSQL) If rsExp.EOF then rsExp.close Set rsExp = Nothing If mysql then strSQL = "SELECT ID,userID,keyword,email,unick,alertlist FROM " & tablPfx & "Agent WHERE (alertlist <> '') 0,1;" Else: strSQL = "SELECT TOP 1 ID,userID,keyword,email,unick,alertlist FROM " & tablPfx & "Agent WHERE (alertlist <> '');" End If set rsalert = objConn.Execute(strSQL) If Not rsalert.EOF then ID = CLng(rsalert(0)) userID = rsalert(1) alertKeys = rsalert(2) email = CryptText(rsalert(3), key, True) uNick = rsalert(4) alertlist = Trim(rsalert(5)) rsalert.close alertlistAllay = Split(alertlist) For each adID in alertlistAllay alertLinks = alertLinks & vbcrlf & web_site & "viewad.asp?id=" & adID Next template = getTemplate("Alerts", Empty, Empty, uNick, Empty, Empty) uSubject = Split(template, s)(0) uBody = Split(template, s)(1) uBody = Replace(uBody, ":alertKeys:", alertKeys) uBody = Replace(uBody, ":alertLinks:", alertLinks) Call sendEmail(email, notify_email, uSubject, uBody) strSQL = "UPDATE " & tablPfx & "Agent SET alertlist = '' WHERE ID = " & ID & ";" objConn.Execute(strSQL) Else rsalert.close Application("Today_Expire_Date" & strUnique) = Date + 1 Application("Today_Expire_Flag" & strUnique) = "0" End If Else adID = rsExp(4) objConn.Execute("UPDATE " & tablPfx & "Ads SET status = 2 WHERE adID = '" & adID & "';") uEmail = CryptText(rsExp(0), key, True) uNick = rsExp(1) catID = rsExp(2) subcatID = rsExp(3) cat3rdID = rsExp(5) subject = rsExp(6) If isEvents then Call logEvent("Ad Expire", adID, subject, Empty, Empty, Empty) Set rsExp = Nothing Call UpdateList(False, catID, subcatID, cat3rdID) template = getTemplate("Expired_Notification", Empty, Empty, uNick, Empty, adID) uSubject = Split(template, s)(0) uBody = Split(template, s)(1) Call sendEmail(uEmail, notify_email, uSubject, uBody) Application("cl_marquee" & strUnique) = Empty rsExp.close Set rsExp = Nothing End If Case "0" If Application("Today_Expire_Date" & strUnique) <= Date then Application("Today_Expire_Flag" & strUnique) = "1" ExpireAds End If End Select setLocale resetLocale On Error Goto 0 End Sub Function RotateBanner() If Application("cl_rotator" & strUnique) = Empty then loadRotator If Not Application("cl_rotator" & strUnique) = "0" then RotateBanner = rotate End Function Sub loadRotator() strSQL = "SELECT ID,bname,altText FROM " & tablPfx & "Banner WHERE status = 1;" set rsRot = objConn.Execute(strSQL) If rsRot.EOF then Application("cl_rotator" & strUnique) = 0: rsRot.close: Exit Sub Else Do while not rsRot.EOF If Not rsRot.EOF then strRotator = strRotator & vbCrLf & rsRot(0) & s & rsRot(1) & s & rsRot(2) rsRot.MoveNext End If Loop End If rsRot.close strRotator = ClearCarriageReturn(strRotator) If Len(strRotator) > 5 then Application("cl_rotator" & strUnique) = strRotator: Else: Application("cl_rotator" & strUnique) = 0 End Sub Function rotate() On Error resume Next setLocale server_locale rDataArray = Split(Application("cl_rotator" & strUnique), vbCrLf) r = Ubound(rDataArray) + 1 Randomize rID = Int(r * Rnd) banner = Split(rDataArray(rID), s)(1) outID = Split(rDataArray(rID), s)(0) altText = Split(rDataArray(rID), s)(2) RotateString = ""
	RotateString = RotateString & altText & "" sdd = dd(objConn) aDate = ConvDateShort(Date) Set ret = objConn.Execute("UPDATE " & tablPfx & "Bannerstat SET display=display+1 WHERE (bname='" & banner & "' AND adate= " & sdd & aDate & sdd & ");", numrow, adExecuteNoRecords) If numrow = 0 then objConn.Execute("INSERT INTO " & tablPfx & "Bannerstat(bname,adate,display,click) VALUES('" & sqbl(banner) & "'," & sdd & aDate & sdd & ",1,0);") End If rotate = RotateString setLocale resetLocale On Error goto 0 End Function Function sq(inputstr) inputstr = Replace(inputstr,"\'", "'") sq = Replace(inputstr, "'", "''") End Function Function sqbl(inputstr) sqbl = Replace(inputstr, "'", "") End Function Function dd(ByRef conObj) strDateDelimiter = "'" If mysql then dd = strDateDelimiter: Exit Function strDBMSName = conObj.Properties("DBMS Name").Value If InStr(1, strDBMSName, "access", 1) Then strDateDelimiter = "#" If InStr(1, strDBMSName, "jet", 1) Then strDateDelimiter = "#" dd = strDateDelimiter End Function Function buildPages(nPage, URLlink, pageType) If Len(nPage) = 0 Then rs.AbsolutePage = 1 Else If isNumeric(nPage) then If CLng(nPage) <= rs.PageCount Then rs.AbsolutePage = nPage Else: rs.AbsolutePage = 1 End If Else: rs.AbsolutePage = 1 End If End If currentPage = rs.AbsolutePage totalPage = rs.PageCount totalRecords = rs.RecordCount displayRecords = pp remRecords = totalRecords Mod pp If totalRecords < pp then displayRecords = totalRecords If currentPage = totalPage And Not remRecords = 0 then displayRecords = remRecords limitPage = 10 remain = currentPage Mod limitPage range = currentPage \ limitPage If remain <> 0 Then range = range + 1 lastpage = limitPage * range firstpage = lastpage - limitPage + 1 If lastpage > totalPage then lastpage = totalPage nextRange = lastpage + 1 prevRange = firstpage - 1 If prevRange = 0 Then prevLink = "" & strText_Previous & " 10 " & strText_Pages & "" Else prevLink = "" & strText_Previous & " 10 " & strText_Pages & "" End If If nextRange > totalPage Then nextLink = "" & strText_Next & " 10 " & strText_Pages & "" Else nextLink = "" & strText_Next & " 10 " & strText_Pages & "" End If firstPageLink = "" & strText_FirstPage & "" lastPageLink = "" & strText_LastPage & "" For n = firstpage to lastpage If n = currentPage then links = links & " (" & n & ") " Else links = links & " [" & n & "] " End If Next paging = "
" & strText_Pages & ": " & links & "
" paging = paging & "
" & firstPageLink & " | " & prevLink & " | " & nextLink & " | " & lastPageLink & "
" buildPages = paging End Function Function strMarquee() If Len(Application("cl_marquee" & strUnique)) = 0 then If mysql then strSQL = "SELECT adID,subject FROM " & tablPfx & "Ads WHERE status = 1 ORDER BY pdate DESC LIMIT 0,5;" Else: strSQL = "SELECT TOP 5 adID,subject FROM " & tablPfx & "Ads WHERE status = 1 ORDER BY pdate DESC;" End If set rsm = objConn.Execute(strSQL) If not rsm.EOF then Do While not rsm.EOF strTemp = strTemp & " " & Replace(rsm(1), chr(34), "") & "   " strRemote = strRemote & "" & Replace(rsm(1), chr(34), "") & """+br+""" rsm.MoveNext Loop strMarquee = strTemp Application("cl_marquee" & strUnique) = strTemp Else strMarquee = "No Submissions" Application("cl_marquee" & strUnique) = strMarquee End If If Len(strRemote) > 0 Then strRemoteTicker = "" writeFile Server.MapPath(upload) & "\feed.js", strRemoteTicker End If Else: strMarquee = Application("cl_marquee" & strUnique) End If End Function Function HTMLEncode(text) newtext = Replace(text, "<", "") newtext = Replace(text, ">", "") HTMLEncode = newtext End Function Function matchAlerts(adID, catID, scatID, cat3rdID, subject, body) On Error Resume Next catID = CLng(catID) scatID = CLng(scatID) If IsNumeric(cat3rdID) AND Len(CStr(cat3rdID)) > 1 then cat3rdID = CLng(cat3rdID): Else: cat3rdID = 0 strSQL = "SELECT " & tablPfx & "Agent.* FROM " & tablPfx & "Agent WHERE " strSQL = strSQL & "(catID = " & catID & " AND scatID = " & scatID & " AND cat3rdID = " & cat3rdID & ")" strSQL = strSQL & " OR (catID = " & catID & " AND scatID = " & 0 & ")" strSQL = strSQL & " OR (catID = " & catID & " AND scatID = " & 0 & ")" strSQL = strSQL & " OR (catID = " & 0 & " AND scatID = " & 0 & ");" set rsa = objConn.Execute(strSQL) If not rsa.EOF then Do While Not rsa.EOF ID = CLng(rsa(0)) stype = CLng(rsa(3)) keywords = rsa(2) Select Case stype Case 1 matchFound = False keyArray = Split(keywords) For each ikey in keyArray If instr(1, subject, ikey, 1) <> 0 Or instr(1, body, ikey, 1) <> 0 Then matchFound = True: Exit For Next Case 2 matchFound = True keyArray = Split(keywords) For each ikey in keyArray If instr(1, subject, ikey, 1) = 0 AND instr(1, body, ikey, 1) = 0 Then matchFound = False: Exit For Next Case 3 matchFound = False If instr(1, subject, keywords, 1) <> 0 Or instr(1, body, keywords, 1) <> 0 Then matchFound = True End Select If matchFound Then If not rsa(12) = Empty then straddAlert = "alertlist = alertlist + ' " & adID & "'" Else: straddAlert = " alertlist = ' " & adID & "'" objConn.Execute("UPDATE " & tablPfx & "Agent SET " & straddAlert & " WHERE ID = " & ID & ";") End If rsa.MoveNext Loop End If rsa.close On Error Goto 0 End Function Function ConvDate(passDate) passDate = DateAdd("h", timeOffset, CDate(passDate)) ConvDate = DatePart("yyyy", passDate) & "-" & DatePart("m", passDate) & "-" & DatePart("d", passDate) & " " & DatePart("h", passDate) & ":" & DatePart("n", passDate) & ":" & DatePart("s", passDate) End Function Function ConvDateShort(passDate) passDate = DateAdd("h", timeOffset, CDate(passDate)) ConvDateShort = DatePart("yyyy", passDate) & "-" & DatePart("m", passDate) & "-" & DatePart("d", passDate) End Function Sub checkIP(uIP) If Len(uIP) > 5 then If Not detectMultipleIP then Exit Sub set rsIP = objConn.Execute("SELECT userID,nick,email FROM " & tablUPfx & "User WHERE IP='" & uIP & "';") If not rsIP.EOF then rsdata = rsIP.getrows rsIP.close numrows = UBound(rsdata,2) + 1 If numrows > 1 then For m = 0 to UBound(rsdata,2) strBodyx = strBodyx & vbcrlf & "User ID: " & rsdata(0, m) & ", User Nick: " & rsdata(1, m) & ", User Email: " & CryptText(rsdata(2, m), key, True) Next strBodyx = "Multiple accounts has possibly been created:" & vbcrlf & vbcrlf & strBodyx & vbcrlf & vbcrlf & "User Logged from: " & uIP & " to all of the above accounts." strSubject = web_name & " - multiple account detected." Call sendEmail(admin_email, admin_email, strSubject, strBodyx) End If Else: rsIP.close End If End If End Sub Sub build_Meta() static_ads_keywords = "buy, sell" On Error Resume Next scr_Path = Request.ServerVariables("SCRIPT_NAME") scr_Path_Array = Split(scr_Path, "/") scr_Name = Lcase(scr_Path_Array(Ubound(scr_Path_Array))) Select Case scr_Name Case "viewscat.asp" If IsNumeric(Request("id")) then mcatID = Request("id") set rscat = objConn.Execute("SELECT catFullDescr,catMetaDescr,catMetaKey,catTitle FROM " & tablPfx & "Cat WHERE catID = " & CLng(mcatID) & ";") If not rscat.EOF then full_description = rscat(0) result_meta_description = rscat(1) result_meta_keywords = rscat(2) result_web_name = rscat(3) End If rscat.close End If Case "viewlist.asp" on error goto 0 If IsNumeric(Request("cid")) and IsNumeric(Request("sid")) then mscatID = Request("sid") mcatID = Request("cid") strSQL = "SELECT " & tablPfx & "Cat.catFullDescr," & tablPfx & "Cat.catMetaDescr," & tablPfx & "Cat.catMetaKey," & tablPfx & "Cat.catTitle," strSQL = strSQL & tablPfx & "Scat.scatFullDescr," & tablPfx & "Scat.scatMetaDescr," & tablPfx & "Scat.scatMetaKey," & tablPfx & "Scat.scatTitle, " strSQL = strSQL & tablPfx & "Scat.scatName," & tablPfx & "Cat.catName " strSQL = strSQL & "FROM " & tablPfx & "Cat, " & tablPfx & "Scat WHERE " & tablPfx & "Cat.catID = " & CLng(mcatID) & " AND " & tablPfx & "Scat.sCatID = " & CLng(mscatID) & ";" set rscat = objConn.Execute(strSQL) If not rscat.EOF then full_description = rscat(4) result_meta_description = rscat(5) result_meta_keywords = rscat(6) result_web_name = rscat(7) catName = rscat(9) subCatName = rscat(8) If ((IsNull(result_web_name) OR Len(result_web_name) = 0) And default_to_cat) or Request("sa") = 1 then full_description = rscat(0) result_meta_description = rscat(1) result_meta_keywords = rscat(2) result_web_name = rscat(3) End If End If rscat.close End If Case "viewsublist.asp" If IsNumeric(Request("id")) then mscat3rdID = Request("3id") mcatID = Request("cid") mscatID = Request("sid") strSQL = "SELECT scatFullDescr,scatMetaDescr,scatMetaKey,scatTitle,scatName FROM " & tablPfx & "Scat WHERE catID = " & CLng(mscatID) & " AND sCatID = " & CLng(mscat3rdID) & ";" set rscat = objConn.Execute(strSQL) If not rscat.EOF then full_description = rscat(0) result_meta_description = rscat(1) result_meta_keywords = rscat(2) result_web_name = rscat(3) cat3rdName = rscat(4) If (IsNull(result_web_name) OR Len(result_web_name) = 0) And default_to_cat then strSQL = "SELECT " & tablPfx & "Cat.catFullDescr," & tablPfx & "Cat.catMetaDescr," & tablPfx & "Cat.catMetaKey," & tablPfx & "Cat.catTitle," strSQL = strSQL & tablPfx & "Scat.scatFullDescr," & tablPfx & "Scat.scatMetaDescr," & tablPfx & "Scat.scatMetaKey," & tablPfx & "Scat.scatTitle " strSQL = strSQL & "FROM " & tablPfx & "Cat, " & tablPfx & "Scat WHERE " & tablPfx & "Cat.catID = " & CLng(mcatID) & " AND " & tablPfx & "Scat.sCatID = " & CLng(mscatID) & ";" set rscat = objConn.Execute(strSQL) If not rscat.EOF then full_description = rscat(4) result_meta_description = rscat(5) result_meta_keywords = rscat(6) result_web_name = rscat(7) If (IsNull(result_web_name) OR Len(result_web_name) = 0) And default_to_cat then full_description = rscat(0) result_meta_description = rscat(1) result_meta_keywords = rscat(2) result_web_name = rscat(3) End If End If End If End If rscat.close End If Case "viewad.asp", "view_print.asp" If IsNumeric(Request("id")) then madID = Request("id") strSQL = "SELECT subject,uopt8 FROM " & tablPfx & "Ads WHERE adID = '" & madID & "';" set rsad = objConn.Execute(strSQL) If not rsad.EOF then msubject = rsad(0) adStyle = rsad(1) msubject = replace(msubject, ".", "") msubject = replace(msubject, ",", "") msubject = replace(msubject, "?", "") msubject = replace(msubject, "!", "") msubject = replace(msubject, ":", "") result_web_name = msubject result_meta_description = msubject subject_array = Split(msubject) For Each metakey in subject_array If Len(metakey) > 2 then loose_key = loose_key & ", " & metakey Next mscatID = Left(madID, 5) strSQL = "SELECT " & tablPfx & "Cat.catName, " & tablPfx & "Scat.scatName FROM " strSQL = strSQL & tablPfx & "Cat, " & tablPfx & "Scat WHERE " & tablPfx & "Cat.catID = " & tablPfx & "Scat.catID AND " & tablPfx & "Scat.sCatID = " & CLng(mscatID) & ";" set rsadc = objConn.Execute(strSQL) If not rsadc.EOF then mcatName = rsadc(0) mscatName = rsadc(1) End If rsadc.close If len(mcatName) > 0 then result_web_name = result_web_name & " - " & mcatName & " : " & mscatName result_meta_keywords = static_ads_keywords & ", " & msubject & loose_key If Len(adStyle) > 0 and uOpt(7) = "1" then dstyle = adStyle End If rsad.close End If Case "adpreview.asp" adPreviewStyle = Request.Form("uO7") If Len(adPreviewStyle) > 0 then dstyle = adPreviewStyle End Select If Len(result_web_name) = 0 or IsNull(result_web_name) then result_web_name = web_name If IsNull(result_meta_description) OR Len(result_meta_description) = 0 then result_meta_description = meta_description If IsNull(result_meta_keywords) OR Len(result_meta_keywords) = 0 then result_meta_keywords = meta_keywords On Error goto 0 End Sub Function BuildContent(contentType, topDisplay, box) contentType = CLng(contentType) topDisplay = CLng(topDisplay) msgNoAds = "
" & strText_NoAdshavebeenpostedyet & "
" & strText_Bethefirsttobelistedhere & "
" msgNoAccounts = "
" & strText_NoAccountshavebeencreatedyet & "
" & strText_Bethefirsttobelistedhere & "
" Select Case contentType '### TOP HOT ADS '---------------------------------------- Case 1 I = 1 If mysql then strSQL = "SELECT subject, adID FROM " & tablPfx & "Ads WHERE (hotlist = 1 AND status = 1) ORDER BY pdate DESC LIMIT 0," & topDisplay & ";" Else: strSQL = "SELECT TOP " & topDisplay & " subject, adID FROM " & tablPfx & "Ads WHERE (hotlist = 1 AND status = 1) ORDER BY pdate DESC;" End If set rs = objConn.Execute(strSQL) If not rs.EOF then strHot = "
" & vbcrlf Do While not rs.EOF If I > topDisplay then Exit Do title = rs(0) If Len(title) > 60 then title = Left(title, 60) & " ..." strHot = strHot & "" & vbcrlf strHot = strHot & "" & vbcrlf rs.MoveNext I = I + 1 Loop strHot = strHot & "
" & title & "

" & strText_AllHotAds & "

" End If If len(strHot) = 0 then strHot = msgNoAds rs.close BuildContent = strHot '### MOST VISITED ADS '------------------------------------------- Case 2 If mysql then strSQL = "SELECT subject, adID, adcounter FROM " & tablPfx & "Ads WHERE (status = 1) ORDER BY adcounter DESC LIMIT 0," & topDisplay & ";" Else: strSQL = "SELECT TOP " & topDisplay & " subject, adID, adcounter FROM " & tablPfx & "Ads WHERE (status = 1) ORDER BY adcounter DESC;" End If set rs = objConn.Execute(strSQL) If not rs.EOF then strPop = "
" & vbcrlf Do While not rs.EOF title = rs(0) If Len(title) > 30 then title = Left(title, 30) & " ..." strPop = strPop & "" & vbcrlf strPop = strPop & "" & vbcrlf rs.MoveNext Loop strPop = strPop & "
" & title & "
(" & rs(2) & ") " & strText_Hits & "
" End If If len(strPop) = 0 then strPop = msgNoAds rs.close BuildContent = strPop '### TOP POSTERS '------------------------------------------- Case 3 I = 1 If mysql then strSQL = "SELECT userID, nick, ads FROM " & tablUPfx & "User WHERE (status = 0) ORDER BY ads DESC LIMIT 0," & topDisplay & ";" Else: strSQL = "SELECT TOP " & topDisplay & " userID, nick, ads FROM " & tablUPfx & "User WHERE (status = 0) ORDER BY ads DESC;" End If set rs = objConn.Execute(strSQL) If not rs.EOF then strPoster = "
" & vbcrlf Do While not rs.EOF If I > topDisplay then Exit Do strPoster = strPoster & "" & vbcrlf strPoster = strPoster & "" & vbcrlf rs.MoveNext I = I + 1 Loop strPoster = strPoster & "
" & rs(1) & " (" & rs(2) & ") " & strText_Ads & "
" End If rs.close If Len(strPoster) = 0 then strPoster = msgNoAccounts BuildContent = strPoster '### TOP NEW ADS (Picked From "Content News" Template) '------------------------------------------- Case 4 I = 1 If mysql then strSQL = "SELECT subject, adID, adcounter FROM " & tablPfx & "Ads WHERE (status = 1) ORDER BY pdate DESC LIMIT 0," & topDisplay & ";" Else: strSQL = "SELECT TOP " & topDisplay & " subject, adID FROM " & tablPfx & "Ads WHERE (status = 1) ORDER BY pdate DESC;" End If set rs = objConn.Execute(strSQL) If not rs.EOF then strPop = "
" & vbcrlf Do While not rs.EOF If I > topDisplay then Exit Do title = rs(0) If Len(title) > 60 then title = Left(title, 60) & " ..." strPop = strPop & "" & vbcrlf strPop = strPop & "" & vbcrlf rs.MoveNext I = I + 1 Loop strPop = strPop & "
" & title & "
" End If If len(strPop) = 0 then strPop = msgNoAds rs.close BuildContent = strPop '### NEWS TEMPLATE '------------------------------------------- Case 5 templateName = "Content_News" set rs = objConn.Execute("SELECT " & tablPfx & "Template.body FROM " & tablPfx & "Template WHERE tname='" & templateName & "';") If not rs.EOF then BuildContent = rs(0) rs.close '### EDITORS PICK '------------------------------------------- Case 6 I = 1 strNoPick = "
" & strText_NoEdList & "
" editor_pick = objConn.Execute("SELECT editor_pick FROM " & tablPfx & "Main;")(0) If Not editor_pick = Empty then editor_pick = Trim(editor_pick) arrayPick = split(editor_pick) For each item in arrayPick If Not item = Empty then strWhere = strWhere & " adID = '" & item & "' OR" Next If Len(strWhere) > 0 then strSQL = "SELECT subject, adID FROM " & tablPfx & "Ads WHERE (status = 1) AND (" & strWhere & " adID = '');" set rs = objConn.Execute(strSQL) If Not rs.EOF then strPick = "
" & vbcrlf Do While not rs.EOF If I > topDisplay then Exit Do title = rs(0) If Len(title) > 60 then title = Left(title, 60) & " ..." strPick = strPick & "" & vbcrlf strPick = strPick & "" & vbcrlf rs.MoveNext I = I + 1 Loop strPick = strPick & "
" & title & "
" End If If len(strPick) = 0 then strPick = strNoPick rs.close BuildContent = strPick End If Else: BuildContent = strNoPick End If '### CUSTOM TEMPLATES '------------------------------------------- Case 11, 12, 13, 14, 15, 16 templID = contentType - 10 templateName = "Custom_" & templID set rs = objConn.Execute("SELECT " & tablPfx & "Template.body FROM " & tablPfx & "Template WHERE tname='" & templateName & "';") If not rs.EOF then BuildContent = rs(0) rs.close Case 17 displCatAll = CStr(Request("id")) displCat = CStr(Request("cid")) displScat = CStr(Request("sid")) displ3rdCat = CStr(Request("3id")) If Len(displCat) = 0 And Len(displCatAll) = 0 then displCat = CStr(Request.Cookies("cat_me" & strSUnique)) If Len(displScat) = 0 And Len(displCatAll) = 0 then displScat = CStr(Request.Cookies("scat_me" & strSUnique)) strTree = "" & vbcrlf catNamet = "" scatNamet = "" If Not msaccess then order3ID = ", tb3ID.scatName" If mysql then strsql = "SELECT tbCat.catID AS ID1st, tbCat.catName AS Name1st, tbCat.ads AS Ads1st, tbscat.sCatID AS ID2nd, tbscat.scatName AS Name2nd, tbscat.ads AS Ads2nd, tb3ID.sCatID AS ID3rd, tb3ID.scatName AS Name3rd, tb3ID.ads AS Ads3rd " strsql = strsql & "FROM " & tablPfx & "Cat AS tbCat " strsql = strsql & "LEFT JOIN " & tablPfx & "Scat AS tbscat ON tbscat.catID = tbCat.catID " strsql = strsql & "LEFT JOIN " & tablPfx & "Scat AS tb3ID ON tb3ID.catID = tbscat.scatID " strsql = strsql & "ORDER BY tbCat.catName, tbscat.scatName, tb3ID.scatName;" Else strsql = "SELECT tbCat.catID AS ID1st, tbCat.catName AS Name1st, tbCat.ads AS Ads1st, tbscat.sCatID AS ID2nd, tbscat.scatName AS Name2nd, tbscat.ads AS Ads2nd, tb3ID.sCatID AS ID3rd, tb3ID.scatName AS Name3rd, tb3ID.ads AS Ads3rd " strsql = strsql & "FROM " & tablPfx & "Cat AS tbCat " strsql = strsql & "LEFT JOIN (" & tablPfx & "sCat AS tbscat LEFT JOIN " & tablPfx & "sCat AS tb3ID ON tb3ID.catID = tbscat.scatID) " strsql = strsql & "ON tbscat.catID = tbCat.catID " strsql = strsql & "ORDER BY tbCat.catName, tbscat.scatName" & order3ID & ";" End If Set rsTree = objConn.Execute(strsql) If not rsTree.EOF then rsdata = rsTree.getrows rsTree.close strTreeArray = "var treeArray = new Array(" allCatsCount = UBound(rsdata,2) strTree = strTree & vbcrlf & "
" & vbcrlf strTree = strTree & "" For C = 0 to allCatsCount currcatName = rsdata(1,C) currscatName = rsdata(4,C) currcat3rdName = rsdata(7,C) If currcatName <> catNamet then If Len(CStr(cat3rdIDt)) > 0 then strTree = strTree & "" If Len(CStr(sCatIDt)) > 0 then strTree = strTree & "" sCatIDt = Empty cat3rdIDt = Empty catNamet = currcatName catIDt = rsdata(0,C) adst = rsdata(2,C) strTreeArray = strTreeArray & catIDt & "," If (Len(displCatAll) > 0 And displCatAll = CStr(catIDt)) Or (Len(displCat) > 0 And displCat = CStr(catIDt)) then catStyle = "style='font-weight: bold;' " Else: catStyle = Empty End If If Len(displCat) > 0 And displCat = CStr(catIDt) then strDisplay = "" catImg = "cm" Else strDisplay = "display:none;" catImg = "c" End If strTree = strTree & "
" & strText_ExpandAll & " | " & strText_CollapseAll & "
" strTree = strTree & "" strTree = strTree & " " & catNamet & " (" & adst & ")
" strTree = strTree & "
" firstCatFound = True End If If currscatName <> scatNamet then If Len(CStr(cat3rdIDt)) > 0 then strTree = strTree & "
" cat3rdIDt = Empty newSubcat = True scatNamet = currscatName sCatIDt = rsdata(3,C) If Len(displsCat) > 0 And displsCat = CStr(sCatIDt) then scatStyle = "style='font-weight: bold;' " Else: scatStyle = Empty End If sadst = rsdata(5,C) strTree = strTree & "" strTree = strTree & " " & scatNamet & " (" & sadst & ")
" End If If Len(currcat3rdName) > 0 then cat3rdIDt = rsdata(6,C) c3adst = rsdata(8,C) If Len(displ3rdCat) > 0 And displ3rdCat = CStr(cat3rdIDt) then cat3Style = "style='font-weight: bold;' " Else: cat3Style = Empty End If If newSubcat then strTreeArray = strTreeArray & sCatIDt & "," If Len(displsCat) > 0 And displsCat = CStr(sCatIDt) then str3Display = "" cat3Img = "sm" Else str3Display = "display:none;" cat3Img = "s" End If strTree = strTree & "
" strTree = strTree & "" End If newSubcat = False strTree = strTree & "" strTree = strTree & " " & currcat3rdName & " (" & c3adst & ")
" End If Next strTree = strTree & "

" Erase rsdata Set rsdata = Nothing strTreeArray = Left(strTreeArray, Len(strTreeArray) - 1) & ");" End If strTree = strTree & "" BuildContent = strTree End Select End Function Sub cacheAds(adID) On Error Resume Next Server.ScriptTimeout = 10000 Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP") xml.Open "GET", Application("Classify_Main_Config" & strUnique)(1) & "view_print.asp?id=" & adID, False xml.send cache_content = xml.responseBody Set xml = Nothing cache_content = Trim(cache_content) cache_content = Unicode(cache_content) If Len(cache_content) > 2000 then writeFile server.mappath(ad_cache) & "\" & adID & ".htm", cache_content On Error Goto 0 End Sub Function Unicode(b) t = String(LenB(b), " ") t = "" For i = 1 To LenB(b) t = t & Chr(AscB(MidB(b, i, 1))) Next Unicode = t End Function Function isCompatible() On Error Resume Next user_browser = CStr(Request.ServerVariables("HTTP_USER_AGENT")) Set re = New RegExp re.Global = True re.IgnoreCase = True re.pattern = "(Firefox)" If re.test(user_browser) Then isCompatible = True isMozilla = True Exit Function End If re.pattern = "(?=opera|Windows CE|Mac)" If Not re.test(user_browser) Then re.pattern = "(MSIE )(\d\.\d*)" If re.test(user_browser) Then Set matches = re.execute(user_browser) For each match in matches bver = match.SubMatches(1) Next If Len(CStr(bver)) > 0 And isNumeric(bver) then setLocale server_locale If bver >= 5.5 then isCompatible = True End If setLocale resetLocale End If Else re.pattern = "(Netscape/)(\d)" If re.test(user_browser) Then If CLng(re.execute(user_browser)(0).SubMatches(1)) > 7 then isCompatible = True isMozilla = True End If End If End If End If End Function Sub logEvent(event_type, eopt0, eopt1, eopt2, eopt3, eopt4) ldate = ConvDate(Now) sdd = dd(objConn) IP = Request.ServerVariables("REMOTE_ADDR") If Len(session("admin_loggedin" & strSUnique)) > 0 then isAdmin ="Yes": Else: isAdmin = "=" If Len(session("user_logged_ID" & strSUnique)) > 0 then userID = session("user_logged_ID" & strSUnique) nick = sq(session("user_logged_nick" & strSUnique)) isUser = "" & nick & "" Else: isUser = "=" End If Select Case event_type Case "New Ad" eID = 1 eicon = "enewad.gif" ldescr = "New Ad Posted: " & eopt1 & "" If eventsArray(1) then isLogEvent = True Case "Update Ad" eID = 2 eicon = "emodad.gif" ldescr = "Ad Modified: " & eopt1 & "" & eopt2 If eventsArray(2) then isLogEvent = True Case "Ad Expire" eID = 3 eicon = "eexpad.gif" ldescr = "Ad Expired: " & eopt1 & "" If eventsArray(3) then isLogEvent = True Case "Ad Deleted" eID = 4 eicon = "edelad.gif" ldescr = "Ad Deleted. Ad ID: " & eopt0 & eopt1 If eventsArray(4) then isLogEvent = True Case "New Account" eID = 5 eicon = "enewuser.gif" ldescr = "New Account Created. User: " & eopt1 & "" & eopt2 If eventsArray(5) then isLogEvent = True Case "Account Updated" eID = 6 eicon = "emoduser.gif" ldescr = "Account Modified. User: " & eopt1 & "" & eopt2 If eventsArray(6) then isLogEvent = True Case "Account Activated" eID = 7 eicon = "eactuser.gif" ldescr = "Account Activated. User: " & eopt1 & "" & eopt2 If eventsArray(7) then isLogEvent = True Case "Account Suspended" eID = 8 eicon = "esususer.gif" ldescr = "Account Suspended. User: " & eopt1 & "" If eventsArray(8) then isLogEvent = True Case "Account Deleted" eID = 9 eicon = "edeluser.gif" ldescr = "Account(s) Deleted. " & eopt0 If eventsArray(9) then isLogEvent = True Case "Contact" eID = 10 eicon = "eadmcont.gif" ldescr = "Admin Contacted by: " & eopt1 & " Message: " & eopt2 & eopt3 If eventsArray(10) then isLogEvent = True Case "Contact Friend" eID = 11 eicon = "efrdcont.gif" ldescr = "Friend Contacted. From: " & eopt0 & " To: " & eopt2 & " Message: " & eopt3 ldescr = ldescr & "
Ad referred" If eventsArray(11) then isLogEvent = True Case "User Logon" eID = 12 eicon = "eloguser.gif" ldescr = "User Successfully Logged on " & eopt0 If eventsArray(12) then isLogEvent = True Case "User Logon Denied" eID = 13 eicon = "edenuser.gif" ldescr = "User Access Denied: " & eopt0 & eopt1 If eventsArray(13) then isLogEvent = True Case "Admin Logon" eID = 14 eicon = "elogadmin.gif" ldescr = "Admin Successfully Logged on" If eventsArray(14) then isLogEvent = True Case "Admin Logon Denied" eID = 15 eicon = "edenadmin.gif" ldescr = "Access to Admin page Denied!" If eventsArray(15) then isLogEvent = True Case "Custom1" eID = 16 eicon = "ecustom1.gif" ldescr = eopt0 If eventsArray(16) then isLogEvent = True Case "Custom2" eID = 17 eicon = "ecustom2.gif" ldescr = eopt0 If eventsArray(17) then isLogEvent = True Case "Custom3" eID = 18 eicon = "ecustom3.gif" ldescr = eopt0 If eventsArray(18) then isLogEvent = True Case "Custom4" eID = 19 eicon = "ecustom4.gif" ldescr = eopt0 If eventsArray(19) then isLogEvent = True Case "Custom5" eID = 20 eicon = "ecustom5.gif" ldescr = eopt0 If eventsArray(20) then isLogEvent = True Case else eID = 0 eicon = "ecustom1.gif" ldescr = "Unknown event" isLogEvent = True End Select If isLogEvent then strSQL = "INSERT INTO " & tablPfx & "Events(ldefine,eID,ldate,ltype,IP,ldescr,luser,ladmin) VALUES('" & event_type & "'," & eID & "," & sdd & ldate & sdd strSQL = strSQL & ",'" & eicon & "','" & IP & "','" & sq(ldescr) & "','" & isUser & "','" & isAdmin & "');" objConn.Execute(strSQL) End If End Sub Function checkDefault(typeVal) If IsNull(typeVal) then checkDefault = True ElseIf Trim(typeVal) = Empty Or Trim(lcase(typeVal)) = "default" then checkDefault = True Else: checkDefault = False End If End Function Sub loadScheme(cid,sid,c3id,isLimitOnly) If c3id = 0 then strSQL = "SELECT ftype FROM " & tablPfx & "Scat WHERE sCatID=" & sid & ";" Else: strSQL = "SELECT ftype FROM " & tablPfx & "Scat WHERE sCatID=" & c3id & ";" End If ftype = objConn.Execute(strSQL)(0) If checkDefault(ftype) then ftype = "default" Set rsls = objConn.Execute("SELECT * FROM " & tablPfx & "Fees WHERE ftype = '" & ftype & "';") If not rsls.EOF then Select Case isnotfree Case True For I = 0 to 11 ppArray(I) = rsls("pa" & I+1) Next ppArray(15) = rsls("pa16") For I = 25 to 29 ppArray(I) = rsls("pa" & I+1) Next Case False ppArray(25) = rsls("pa26") ppArray(26) = rsls("pa27") ppArray(27) = rsls("pa28") ppArray(28) = rsls("pa29") ppArray(29) = rsls("pa30") End Select End If rsls.close End Sub %>