/asp/freeapps/topsitementor/inctopsite.asp
<%
'''TODO for you! Configuration:
''''1. Database connection
Function IncTopsite_GetDatabaseConn()
Dim oRet
Dim strDSN
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("topsite2.mdb")
Set oRet = Server.CreateObject ("ADODB.Connection")
oRet.Open strDSN
Set IncTopsite_GetDatabaseConn = oRet
IncTopsite_PerhapsCleanUp oRet
End Function
'''TODO for you! Configuration:
''''2. Config variables
Const g_strTitle = "ASPCode.net Topsite"
Const g_strTitle2 = "TopsiteMentor Demo"
Const g_strPath = "http://www.yourserver.com/topsitementor/"
Const g_strButtonImagePath = "http://www.yourserver.com/topsitementor/topsite.gif"
Const g_nSitesPerPage = 10
Const g_AdminUID = "admin"
Const g_AdminPassword = "test"
Const g_ClickThruPage = True
Const g_MailServer = "mail.yourserver.com"
Const g_OutgoingMailFrom = "webmaster@aspcode.net"
Const g_strSiteBgColor1 = "#ffff99"
Const g_strSiteBgColor2 = "#ffffcc"
Const g_strBodyColor = "#FF9900"
'This variable could be set to
' DAY for hits/day ranking or
' TOTAL for total hits ranking
Const g_strRankOption = "TOTAL"
'If set to true then clicking will take the user to another page and if he/she clicks
' there a hit will be counted. This is to defeat cheating
Const g_fUseGateway = False
'''TODO for you! Configuration:
''''3. Some ads if you'd like
Function FAQ_GetAd(nNumber)
Select Case nNumber
Case 1
FAQ_GetAd = ""
Case 2
FAQ_GetAd = ""
Case 3
FAQ_GetAd = ""
End Select
End Function
Function IncTopsite_PerhapsCleanUp( oConn )
If g_strRankOption = "TOTAL" Then
IncTopsite_PerhapsCleanUp = False
Exit Function
End If
Dim sNow, sStart, fShouldCleanup
sNow = Now()
sStart = Application("ts_start")
If sStart = "" Then
Dim oRSWhenStart
Set oRSWhenStart = oConn.Execute("select startdate from "& IncTopsite_GetTablePrefix() & "sysvar " )
If oRSWhenStart.EOF Then
oRSWhenStart.Close
Set oRSWhenStart = Server.CreateObject("ADODB.Recordset")
Set oRSWhenStart.ActiveConnection = oConn
oRSWhenStart.Open "select * from " & IncTopsite_GetTablePrefix() & "sysvar where id = -1", ,1,3
oRSWhenStart.AddNew()
oRSWhenStart("startdate") = Now()
oRSWhenStart.Update
oRSWhenStart.Close
Set oRSWhenStart = Nothing
sStart = Application("ts_start")
Exit Function
Else
sStart = oRSWhenStart("startdate")
oRSWhenStart.Close
Set oRSWhenStart = Nothing
End If
End If
fShouldCleanup = False
If ShouldCleanUp( g_strRankOption, sStart, sNow ) = True Then
oConn.Execute("update " & IncTopsite_GetTablePrefix() & "site set incount=0,outcount=0")
Set oRSWhenStart = Server.CreateObject("ADODB.Recordset")
Set oRSWhenStart.ActiveConnection = oConn
oRSWhenStart.Open "select * from " & IncTopsite_GetTablePrefix() & "sysvar", ,1,3
oRSWhenStart("startdate") = Now()
oRSWhenStart.Update
oRSWhenStart.Close
Set oRSWhenStart = Nothing
End If
End Function
Function IncTopsite_GetTablePrefix()
'IncTopsite_GetTablePrefix = ""
IncTopsite_GetTablePrefix = ""
End Function
Function ShouldCleanUp( g_strRankOption, sStart, sNo )
If g_strRankOption = "DAY" Then
If DateDiff( "d", sStart, sNo ) > 1 Then
ShouldCleanUp = True
Exit Function
End If
End If
ShouldCleanUp = False
End Function
Sub ListCategories( nSelected, fListAll )
Dim oRSCats
Dim sSelected
Set oRSCats = oConn.Execute("select id, txt from " & IncTopsite_GetTablePrefix() & "cat order by txt ")
If fListAll = True Then
If nSelected = "" Or CInt(nSelected)=0 Then
sSelected = "selected "
Else
sSelected = ""
End If
Response.Write "<option " & sSelected & "value=""" & "0" & """>" & "All" & "</option>"
End If
While Not oRSCats.EOF
If CInt(nSelected) = CInt(oRSCats("id").Value) Then
sSelected = "selected "
Else
sSelected = ""
End If
Response.Write "<option " & sSelected & "value=""" & oRSCats("id") & """>" & oRSCats("txt") & "</option>"
oRSCats.MoveNext
Wend
oRSCats.Close
Set oRSCats = Nothing
End Sub
'Not working yet
Const g_AdminEmail = "webmaster@aspcode.net" 'Set this so you will get email when someone has joined the list and validation is needed
Const g_ValidationNeeded = True
%>