% Option Explicit %>
<%
'Declare variables
Dim adoCon 'Database Connection Variable
Dim rsCommon 'Holds the common recordset
Dim strCon 'Holds the Database driver and the path and name of the database
Dim strSQL 'Holds the SQL query for the database
Dim strDbPathAndName 'Holds the database path and name
Dim intRecordsPerPage 'Holds the number of files shown on each page
Dim strBgColour 'Holds the background colour of the guestbook
Dim strTextColour 'Holds the text colour of the guestbook
Dim strLinkColour 'Holds the link colour of the guestbook
Dim strTextType 'Holds the font type of the guestbook
Dim intTextSize 'Holds the font size of the guestbook
Dim strTableColour 'Holds the table colour
Dim strTableBorderColour 'Holds the table border colour
Dim strTableTitleColour 'Holds the table title colour
Dim strVisitedLinkColour 'Holds the visited link colour of the guestbook
Dim strActiveLinkColour 'Holds the active link colour of the guestbook
Dim strHoverLinkColour 'Holds the active link colour of the guestbook
Dim blnLCode 'set to true
Dim blnEmail 'Boolean set to true if e-mail is on
Dim strCode 'Holds the page code
Dim strCode2 'Holds the page code
Dim strWebSiteEmailAddress 'Holds the e-mail address for the web site the Guestbook is on
Dim strMailComponent 'Email coponent the guestbook useses
Dim strSMTPServer 'SMTP server for sending the e-mails through
Dim strLoggedInUserCode 'Holds the user code of the user
Dim strTitleImage 'Holds the path and name for the title image for the guestbook
Dim intMsgCharNo 'Holds the number of characters allowed for the messages
Dim blnCookieSet 'Set to true if cookies are to be set to stop multiple posts
Dim blnIPBlocking 'Set to true if IP blooking is to be used to stop multiple posts
Dim strDatabaseType 'Holds the database type
Dim blnSessionCheck 'Set to true if the session ID is checked
Dim blnURL 'Set to true if user can post a URL
Dim blnAuthorise 'Set to true if posts are to be authorised first
Dim blnSecurityImages 'Set to true if security images are enabled
Dim blnEmailAddress 'Set to true if an email address can be added to the comments
'Initiliase varibales
Const strVersion = "7.0"
Const strSalt = "5CB237B1D85"
Const strCodeField = "Code"
'Set up the database table name prefix and stored procedure prefix
'(This is useful if you are running multiple Guestbooks from one database)
' - make sure you also change this in the msSQL_server_setup.asp file if setting up an ms SQL server database)
Const strDbTable = "tblGB"
'Database Type
'strDatabaseType = "Access"
strDatabaseType = "SQLServer"
'Create database connection
'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'--------------------- Set the path and name of the database --------------------------------------------------------------------------------
'Virtual path to database
strDbPathAndName = Server.MapPath("database/WWGguestbook.mdb") 'This is the path of the database from this files location on the server
'Physical path to database
'strDbPathAndName = "" 'Use this if you use the physical server path, eg:- C:\Inetpub\private\WWGguestbook.mdb
'BRINKSTER USERS
'Brinkster users remove the ' single quote mark from infront of the line below and replace USERNAME with your Brinkster uersname
'strDbPathAndName = Server.MapPath("/USERNAME/db/WWGguestbook.mdb")
'PLEASE NOTE: - For extra security it is highly recommended you change the name of the database, WWGguestbook.mdb, to another name and then
'replace the WWGguestbook.mdb found above with the name you changed the forum database to.
'---------------------------------------------------------------------------------------------------------------------------------------------
'------------- If you are having problems with the script then try using a diffrent driver or DSN by editing the lines below --------------
'Generic MS Access Database connection info and driver (if this driver does not work then comment it out and use one of the alternative faster JET OLE DB drivers)
'strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strDbPathAndName
'Alternative drivers faster than the generic one above
'strCon = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & strDbPathAndName 'This one is if you convert the database to Access 97
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strDbPathAndName 'This one is for Access 2000/2002
'If you wish to use DSN then comment out the driver above and uncomment the line below (DSN is slower than the above drivers)
'strCon = "DSN=DSN_NAME" 'Place the DSN where you see DSN_NAME
'---------------------------------------------------------------------------------------------------------------------------------------------
'Set the diffrent variables for diffrent database types
If strDatabaseType = "SQLServer" Then
%><%
'****************************************************************************************
'** Copyright Notice
'**
'** Web Wiz Guide - Web Wiz Guestbook
'**
'** Copyright 2001-2004 Bruce Corkhill All Rights Reserved.
'**
'** This program is free software; you can modify (at your own risk) any part of it
'** under the terms of the License that accompanies this software and use it both
'** privately and commercially.
'**
'** All copyright notices must remain in tacked in the scripts and the
'** outputted HTML.
'**
'** You may use parts of this program in your own private work, but you may NOT
'** redistribute, repackage, or sell the whole or any part of this program even
'** if it is modified or reverse engineered in whole or in part without express
'** permission from the author.
'**
'** You may not pass the whole or any part of this application off as your own work.
'**
'** All links to Web Wiz Guide and powered by logo's must remain unchanged and in place
'** and must remain visible when the pages are viewed unless permission is first granted
'** by the copyright holder.
'**
'** This program is distributed in the hope that it will be useful,
'** but WITHOUT ANY WARRANTY; without even the implied warranty of
'** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER
'** WARRANTIES WHETHER EXPRESSED OR IMPLIED.
'**
'** You should have received a copy of the License along with this program;
'** if not, write to:- Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom.
'**
'**
'** No official support is available for this program but you may post support questions at: -
'** http://www.webwizguide.info/forum
'**
'** Support questions are NOT answered by e-mail ever!
'**
'** For correspondence or non support questions contact: -
'** info@webwizguide.info
'**
'** or at: -
'**
'** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom
'**
'****************************************************************************************
Dim strSQLServerName 'Holds the name of the SQL Server
Dim strSQLDBUserName 'Holds the user name (for SQL Server Authentication)
Dim strSQLDBPassword 'Holds the password (for SQL Server Authentication)
Dim strSQLDBName 'Holds name of a database on the server
'------------- The Driver Below is if you are using SQL Server (Do Not Use Unless you know and have an SQL Server) ---------------------------
'Enter the details of your SQL server below
strSQLServerName = "WEB" 'Holds the name of the SQL Server
strSQLDBUserName = "sa" 'Holds the user name (for SQL Server Authentication)
strSQLDBPassword = "LSD634a" 'Holds the password (for SQL Server Authentication)
strSQLDBName = "ingush" 'Holds name of a database on the server
'Please note the forum has been optimised for the SQL OLE DB Driver using another driver
'or system DSN to connect to the SQL Server database will course errors in the forum and
'drastically reduce the performance of the forum!
'The SQLOLEDB driver offers the highest performance at this time for connecting to SQL Server databases from within ASP.
'MS SQL Server OLE Driver (If you change this string make sure you also change it in the msSQL_server_setup.asp file when creating the database)
strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
'---------------------------------------------------------------------------------------------------------------------------------------------
%><%
End If
'Set the connection string to the database
adoCon.connectionstring = strCon
'Set an active connection to the Connection object
adoCon.Open
'Read in the Guestbook configuration
'Intialise the ADO recordset object
Set rsCommon = Server.CreateObject("ADODB.Recordset")
'Initialise the SQL variable with an SQL statement to get the configuration details from the database
strSQL = "SELECT " & strDbTable & "Configuration.* From " & strDbTable & "Configuration;"
'Query the database
rsCommon.Open strSQL, strCon
'If there is config deatils in the recordset then read them in
If NOT rsCommon.EOF Then
'Read in the configuration details from the recordset
strMailComponent = rsCommon("mail_component")
strSMTPServer = rsCommon("mail_server")
strBgColour = rsCommon("bg_colour")
strTextColour = rsCommon("text_colour")
strTextType = rsCommon("text_type")
intTextSize = CInt(rsCommon("text_size"))
strLinkColour = rsCommon("links_colour")
strTableColour = rsCommon("table_colour")
strTableBorderColour = rsCommon("table_border_colour")
strTableTitleColour = rsCommon("table_title_colour")
strVisitedLinkColour = rsCommon("visited_links_colour")
strHoverLinkColour = rsCommon("active_links_colour")
strWebSiteEmailAddress = rsCommon("email_address")
blnLCode = CBool(rsCommon("Code"))
blnEmail = CBool(rsCommon("email_notify"))
intRecordsPerPage = CInt(rsCommon("Comments_per_page"))
strTitleImage = rsCommon("Title_image")
intMsgCharNo = rsCommon("Message_char_no")
blnCookieSet = CBool(rsCommon("Cookie"))
blnIPBlocking = CBool(rsCommon("IP_blocking"))
blnSessionCheck = CBool(rsCommon("Session"))
blnURL = CBool(rsCommon("URL"))
blnAuthorise = CBool(rsCommon("Authorisation"))
blnSecurityImages = CBool(rsCommon("Security_images"))
blnEmailAddress = CBool(rsCommon("Email"))
End If
'Close the recordset
rsCommon.Close
%>
<%
Dim perp
Dim mon
Dim yea
Dim str
Dim str1
Dim pagea
Dim recordcount
Dim b
Dim a
Dim i
perp=Request.QueryString("perp")
If perp<1 then perp=7
%>
"
End Sub
Dim rsComments 'Database recordset holding the comments for this news item
Dim lngNewsID 'Holds the News item ID number
Dim blnComments 'Set to true if comments are allowed for this item
Dim strMonth
Dim strYear
If isNull(Request.QueryString("NewsID")) = True Or isNumeric(Request.QueryString("NewsID")) = False Then
Response.Write "index.asp"
Else
lngNewsID = CLng(Request.QueryString("NewsID"))
End If
'************************************************************************************
If CInt(Request.Querystring("Month")) < 1 then
Mon=month(date)
Yea=year(date)
str = "1/" + CStr(Mon) + "/" + CStr(Yea) + " 0:00:00 AM"
If Mon<12 then str1 = "1/" + CStr(CInt(Mon)+1) + "/" + CStr(Yea) + " 00:00:00 AM" End If
If Mon=12 then str1 = "31/" + CStr(CInt(Mon)) + "/" + CStr(Yea) + " 11:59:59 AM" End If
End If
If CInt(Request.Querystring("Month")) = 12 then
Mon=Request.QueryString("month")
Yea=Request.QueryString("year")
str = Request.QueryString("month") + "/1/" + Request.QueryString("year") + " 0:00:00 AM"
str1 = CStr(CInt(Request.QueryString("month"))) + "/31/" + CStr(Request.QueryString("year")) + " 11:59:59 PM"
End If
If CInt(Request.Querystring("Month")) > 0 and CInt(Request.Querystring("Month")) < 12 then
Mon=Request.QueryString("month")
Yea=Request.QueryString("year")
str = "1/" + Request.QueryString("month") + "/" + Request.QueryString("year") + " 0:00:00 AM"
str1 = "1/" + CStr(CInt(Request.QueryString("month"))+1) + "/" + CStr(Request.QueryString("year")) + " 0:00:00 AM"
End If
pagea=CInt(Request.QueryString("pagea"))
If pagea<1 then pagea=1 End If
recordcount=0
strSQL = "SELECT * FROM tblNews where ((News_Date > '"&str&"') and (News_Date < '"&str1&"')) ORDER BY News_Date DESC;"
rsCommon.Open strSQL, adoCon
recordcount=0
If not rsCommon.Eof then
rsCommon.movefirst
while not rsCommon.eof
recordcount=recordcount+1
rsCommon.movenext
wend
rsCommon.close
strSQL = "SELECT * FROM tblNews where ((News_Date > '"&str&"') and (News_Date < '"&str1&"')) ORDER BY News_Date DESC;"
rsCommon.Open strSQL, adoCon
rsCommon.MoveFirst
for b = 1 to perp*(pagea-1)
rsCommon.Movenext
Next
for a = 1 to perp
if a=1 then %> <%
End If
ShowNews()
rsCommon.Movenext
If rsCommon.Eof then a=perp
Next
%>
Cтраницы:
<%
For i = 1 To recordcount\perp+1
if i=pagea then response.write"[ "
response.write " " & i & "" & "  "
if i=pagea then response.write"] "
Next
Else
Response.Write "Нет новостей за данный период"
End IF
rsCommon.Close
%>
<%
'****************************************************************************************
'Set the response buffer to true as we maybe redirecting
Response.Buffer = True
'******Line 30
'Dimension variables
Dim intPreviewNewsItems 'Number of files shown on each page
%>
<%
Dim intNewsItems
Dim ForumID
Dim strMySQL
Dim sMySQLConnection
Dim mySQLresult
Dim dbMySQLConn
DIm strResult
intNewsItems = 10
intPreviewNewsItems = 10
strSQL = "SELECT TOP " & intPreviewNewsItems & " * FROM tblNews ORDER BY News_Date DESC;"
rsCommon.Open strSQL, adoCon
'****************Line 70
If rsCommon.EOF Then Response.Write("Sorry, There is no Site News Items to display")
For intNewsItems = 1 to intPreviewNewsItems
If rsCommon.EOF Then Exit For
Response.Write "
"
Response.Write "
"
theday = day(date)
If DatePart("d",rsCommon("News_Date")) = theday Then Response.Write ""
If DatePart("d",rsCommon("News_Date")) <> theday Then Response.Write ""
Response.Write "
<% Response.Buffer = True %>
<%
Dim PollID
PollID = "33"'Request.QueryString("PollID")
If Len(PollID) <> 0 Then ' Check to see if a PollID was given
' Lookup poll id in database
Set objConn = CreateObject("ADODB.Connection")
Dim objConn
dim rspoll
dim optionid
dim total
dim rspolloptions
dim result
objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("db\polls.mdb"))
' Load the poll that matches PollID
Set rsPoll = objConn.Execute("SELECT * FROM Polls WHERE PollID=" & PollID)
If rsPoll.EOF Then
Response.write "
No Such Poll
"
Else ' Poll exists
If Request.Cookies("devdomainpoll")(PollID) = "voted" Then ' Has Voted
OptionID = false ' Don't display the vote links
Else
OptionID = Request.QueryString("OptionID")
If Len(OptionID) > 0 Then ' User is trying to vote
' Update the count for the PollOption
objConn.Execute "UPDATE PollOptions SET OptionSelectedCount = " & _
"OptionSelectedCount + 1 WHERE PollOptionID=" & OptionID
' Set a cookie to stop the user from voting again
Response.Cookies("devdomainpoll")(PollID) = "voted"
Response.Cookies("devdomainpoll").Expires = Now() + 365
OptionID = false ' Don't display the vote links
Else
OptionID = true
End If
End If
Response.write ""
Response.write rsPoll("PollQuestion")
Response.write ""
%>
<%
' Load the options
Set rsPollOptions = objConn.Execute("SELECT * FROM PollOptions WHERE PollID=" _
& PollID)
Total = 0
Do While Not rsPollOptions.EOF
Total = Total + rsPollOptions("OptionSelectedCount")
rsPollOptions.MoveNext
Loop
%>
<%
rsPollOptions.MoveFirst
Do While Not rsPollOptions.EOF
If Total > 0 Then ' Calculate the percentage
Result = CStr(Int((rsPollOptions("OptionSelectedCount") / Total) * 100))+"%"
Else
Result = 0
End If
Response.write "
"
rsPollOptions.MoveNext
Loop
rsPollOptions.close
set rsPollOptions = Nothing
End If
rsPoll.close
Set rsPoll = Nothing
objConn.close
set objConn = Nothing
%>