Hej allesammen.
Jeg har en søgemaskine i ASP, som lige pludselig er holdt op med at virke, hvorfor ved jeg ikke
common.inc
<%
'****************************************************************************************
'** Copyright Notice
'**
'** Web Wiz Guide Internet Search Engine
'**
'** Copyright 2001-2002 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.com
'**
'** or at: -
'**
'** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom
'**
'****************************************************************************************
Dim adoCon 'Database Connection Variable
Dim rsConfiguration 'Holds the configuartion 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 intRecordsPerPage 'Holds the number of files shown on each page
Dim strBgColour 'Holds the background colour
Dim strTextColour 'Holds the text colour
Dim strTextType 'Holds the font type
Dim intTextSize 'Holds the font size
Dim strLinkColour 'Holds the link colour
Dim strTableColour 'Holds the table colour
Dim strTableBorderColour 'Holds the table border colour
Dim strVisitedLinkColour 'Holds the visited link colour
Dim strHoverLinkColour 'Holds the mouse over link colour
'Declare constants
' ----------------- Change the following line to the number of entries you wish to have on each page and miniumum word length ------------------------
Const intMinuiumSearchWordLength = 2 'Change this to the minimum word length to be searched on
'-------------------------------------------------------------------------------------------------------------------------------------
'Create database connection
'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'------------- If you are having problems with the script then try using a diffrent driver or DSN by editing the lines below --------------
'Database connection info and driver (if this driver does not work then comment it out and use one of the alternative drivers)
'strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("search_engine.mdb")
'Database driver for Brinkster
'strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/USERNAME/db/search_engine.mdb") 'This one is for Brinkster users place your Brinster username where you see USERNAME
'Alternative drivers faster than the basic one above
strCon = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & Server.MapPath("search_engine.mdb") 'This one is if you convert the database to Access 97
'strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("search_engine.mdb") '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 an active connection to the Connection object
adoCon.Open strCon
'Read in the configuration for the script
'Intialise the ADO recordset object
Set rsConfiguration = Server.CreateObject("ADODB.Recordset")
'Initialise the SQL variable with an SQL statement to get the configuration details from the database
strSQL = "SELECT tblConfiguration.* From tblConfiguration;"
'Query the database
rsConfiguration.Open strSQL, strCon
'If there is config deatils in the recordset then read them in
If NOT rsConfiguration.EOF Then
'Read in the configuration details from the recordset
intRecordsPerPage = CInt(rsConfiguration("No_records_per_page"))
strBgColour = rsConfiguration("bg_colour")
strTextColour = rsConfiguration("text_colour")
strTextType = rsConfiguration("text_type")
intTextSize = CInt(rsConfiguration("text_size"))
strLinkColour = rsConfiguration("links_colour")
strTableColour = rsConfiguration("table_colour")
strTableBorderColour = rsConfiguration("table_border_colour")
strVisitedLinkColour = rsConfiguration("visited_links_colour")
strHoverLinkColour = rsConfiguration("active_links_colour")
End If
'Reset server object
Set rsConfiguration = Nothing
%>
default.asp
<% Option Explicit %>
<!--#include file="common.inc" -->
<!--#include file="include_top.asp" -->
<%
Response.Buffer = True
'Dimension variables
Dim rsSearchResults 'database Recordset Variable
Dim intRecordPositionPageNum 'Holds the record position
Dim intRecordLoopCounter 'Loop counter for displaying the database records
Dim lngTotalRecordsFound 'Holds the total number of records in the database
Dim lngTotalNumPages 'holds the total number of pages in the database
Dim intLinkPageNum 'Holds the page number to be linked to
Dim intLoopCounter 'Holds the loop counter number
Dim sarySearchWord 'Holds the keywords for the URL
Dim strSearchKeywords 'Holds the keywords to be searched
Dim intSQLLoopCounter 'Loop counter for the loop for the sql query
Dim intSearchWordLength 'Holds the length of the word to be searched
Dim blnSearchWordLenthOK 'Boolean set to false if the search word length is not OK
Dim intRecordDisplayFrom 'Holds the number of the search result that the page is displayed from
Dim intRecordDisplayedTo 'Holds the number of the search result that the page is displayed to
'If this is the first time the page is displayed then the page position is set to page 1
If Request.QueryString("PagePosition") = "" Then
intRecordPositionPageNum = 1
'Else the page has been displayed before so the page postion is set to the Record Position number
Else
intRecordPositionPageNum = CInt(Request.QueryString("PagePosition"))
End If
'Read in all the search words into one variable
strSearchKeywords = Trim(Request.QueryString("search"))
'If the use has not entered a value then let the search words variable contain a space (chr10)
If strSearchKeywords = "" Then strSearchKeywords = chr(10)
'Replace any less than or greater than signs with the HTML equivalent (stops people entering HTML tags)
strSearchKeywords = Replace(strSearchKeywords, "<", "<")
strSearchKeywords = Replace(strSearchKeywords, ">", ">")
strSearchKeywords = Replace(strSearchKeywords, "'", "''")
'Read in the search words to be searched
sarySearchWord = Split(Trim(strSearchKeywords), " ")
'Return the tow '' back to one' for displaying on the screen
strSearchKeywords = Replace(strSearchKeywords, "''", "'")
'Initalise the word search length variable
blnSearchWordLenthOK = True
'Loop round to check that each word to be searched has more than the minimum word length to be searched
For intLoopCounter = 0 To UBound(sarySearchWord)
'Initialise the intSearchWordLength variable with the length of the word to be searched
intSearchWordLength = Len(sarySearchWord(intLoopCounter))
'If the word length to be searched is less than or equal to min word length then set the blnWordLegthOK to false
If intSearchWordLength <= intMinuiumSearchWordLength Then
blnSearchWordLenthOK = False
End If
Next
'Create a recordset object
Set rsSearchResults = Server.CreateObject("ADODB.Recordset")
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblWebsites.* FROM tblWebsites "
'Get the mode to decide how we are going to buid the SQL Query
Select Case Request.QueryString("mode")
'If the user has selected to search any words then intalise the strSQL statement to search for any words in the database
Case "anywords"
'Search for the first search word in the URL titles
strSQL = strSQL & "WHERE Title LIKE '%" & sarySearchWord(0) & "%'"
'Loop to search for each search word entered by the user
For intSQLLoopCounter = 0 To UBound(sarySearchWord)
strSQL = strSQL & " OR Title LIKE '%" & sarySearchWord(intSQLLoopCounter) & "%'"
strSQL = strSQL & " OR Keywords LIKE '%" & sarySearchWord(intSQLLoopCounter) & "%'"
strSQL = strSQL & " OR Description LIKE '%" & sarySearchWord(intSQLLoopCounter) & "%'"
Next
'Order the search results by the number of click through hits decending (most popular sites first)
strSQL = strSQL & " ORDER By Rating DESC, No_of_ratings DESC, Hits DESC;"
'If the user has selected to search for all words then intalise the strSQL statement to search for entries containing all the search words
Case "allwords"
'Search for the first word in the URL titles
strSQL = strSQL & "WHERE (Title LIKE '%" & sarySearchWord(0) & "%'"
'Loop to search the URL titles for each word to be searched
For intSQLLoopCounter = 1 To UBound(sarySearchWord)
strSQL = strSQL & " AND Title LIKE '%" & sarySearchWord(intSQLLoopCounter) & "%'"
Next
'OR if the search words are in the keywords
strSQL = strSQL & ") OR (Keywords LIKE '%" & sarySearchWord(0) & "%'"
'Loop to search the URL keywords for each word to be searched
For intSQLLoopCounter = 1 To UBound(sarySearchWord)
strSQL = strSQL & " AND Keywords LIKE '%" & sarySearchWord(intSQLLoopCounter) & "%'"
Next
'Or if the search words are in the title
strSQL = strSQL & ") OR (Description LIKE '%" & sarySearchWord(0) & "%'"
'Loop to search the URL description for each word to be searched
For intSQLLoopCounter = 1 To UBound(sarySearchWord)
strSQL = strSQL & " AND Description LIKE '%" & sarySearchWord(intSQLLoopCounter) & "%'"
Next
'Order the search results by the number of click through hits decending (most popular sites first)
strSQL = strSQL & ") ORDER By Rating DESC, No_of_ratings DESC, Hits DESC;"
'If the user has selected to see newly enetred URL's then order the search results by date decending
Case "new"
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT TOP " & intRecordsPerPage & " tblWebsites.* FROM tblWebsites"
strSQL = strSQL & " ORDER By SiteIDNo DESC;"
End Select
'Query the database with the strSQL statement
rsSearchResults.Open strSQL, strCon, 3
'Count the number of records found
lngTotalRecordsFound = CLng(rsSearchResults.RecordCount)
'If this is a random URL then strip all the other URL's and only leave one remaining URL
If Request.QueryString("submit") = "Random Search" and NOT rsSearchResults.EOF Then
'Randomise system timer
Randomize Timer
'Move to a random record in the recordset
rsSearchResults.Move CLng(RND * lngTotalRecordsFound) - 0.5
'Filter out all the other records
rsSearchResults.Filter = "SiteIDNo =" & rsSearchResults("SiteIDNO")
Else
'Set the number of records to display on each page by the constant set at the top of the script
rsSearchResults.PageSize = intRecordsPerPage
'Get the page number record poistion to display from
IF NOT rsSearchResults.EOF Then rsSearchResults.AbsolutePage = intRecordPositionPageNum
'Count the number of pages the search results will be displayed on calculated by the PageSize attribute set above
lngTotalNumPages = CLng(rsSearchResults.PageCount)
'Calculate the the record number displayed from and to on the page showing
intRecordDisplayFrom = (intRecordPositionPageNum - 1) * intRecordsPerPage + 1
intRecordDisplayedTo = (intRecordPositionPageNum - 1) * intRecordsPerPage + intRecordsPerPage
If intRecordDisplayedTo > lngTotalRecordsFound Then intRecordDisplayedTo = lngTotalRecordsFound
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="Title" CONTENT="Ren dansk søgemaskine, ikke andet - pure danish searchengine, nothing all">
<META NAME="Subject" CONTENT="søgemaskine, searchengine">
<META NAME="Description" CONTENT="Søgemaskine, Searchengine">
<META NAME="Keywords" CONTENT="søgemaskine, søge, amskine, keywords, websites, searchengine, search, engine, keywords, websites">
<META NAME="Language" CONTENT="DA">
<META NAME="Copyright" CONTENT="© Michael Guldhammer">
<META NAME="Designer" CONTENT="Michael Guldhammer">
<META NAME="Publisher" CONTENT="Novoseek">
<META NAME="Revisit-After" CONTENT="7 Days">
<META NAME="Distribution" CONTENT="Global">
<META NAME="Robots" CONTENT="All">
<TITLE><!-- #include file="include_titel.asp" --></TITLE>
<!-- Check the from is filled in correctly before submitting -->
<SCRIPT language="JavaScript">
<!-- Hide from older browsers...
//Check the enquiry form is filled in correctly
function CheckForm () {
//If there is aproblem with the form then display an error
if (document.frmInterSearch.search.value == "") {
msg = "_________________________________________________________________\\n\\n";
msg += "din søgninger ikke blevet foretaget fordi der ikke er blevet udfyldt korrekt\\n";
msg += "vær venlig at skrive et nyt søgeord.\\n";
msg += "_________________________________________________________________\\n\\n";
msg += "\\n\\vær venlig at indtast et søgeord."
alert(msg + "\\n\\n");
return false;
}
return true;
}
//Function to open pop up window
function openWin(theURL,winName,features) {
window.open(theURL,winName,'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=350,height=310');
}
// -->
</script>
<meta name="generator" content="Novoseek.dk - Admin">
</HEAD>
<BODY bgColor=#ffffff text=#000000 link=#000099 vLink=#000099>
<CENTER>
<form method="get" name="frmInterSearch" action="default.asp" onSubmit="return CheckForm();">
<table cellpadding="0" cellspacing="0" width="514" align="center" height="54">
<tr>
<td width="4" align="right" rowspan="2" height="54"></td>
<td width="95" align="right" rowspan="2" height="54"></td>
<td class="normal" height="25" width="409"> <font face="verdana" size="1"><b> Søg:</b></font> <input name="search" maxlength="50" size="35" value="<% =Request.QueryString("search") %>"><input type="submit" value="Søg" name="submit">
</td>
</tr>
<tr>
<td class="text" height="29" width="409" valign="top"><font face="verdana" size="1">
Søg på :</font>
<input type="radio" name="mode" value="allwords" CHECKED><font face="verdana" size="1">Alle ord</font>
<input type="radio" name="mode" value="anywords"><font face="verdana" size="1">flere ord</font>
</td>
</tr>
</table>
<BR>
<TABLE cellSpacing=0 cellPadding=4 width=700 bgColor=#dddddd border=0>
<TR>
<TD><FONT face=Verdana,Arial,Geneva size=1><B>Velkommen til Novoseek.dk</B></FONT></TD>
</TR></TABLE><BR>
<table cellSpacing=0 cellPadding=0 width=700 border=0>
<TR>
<TD valign=top width=100%> <table border=0 width=100% cellpadding=1 cellspacing=1>
<font face=Verdana,Arial,Geneva size=1>
</font>
</TR></TABLE><BR>
<table cellSpacing=0 cellPadding=4 width=700 border=0>
<TR>
<!-- #include file="include_bund.asp" -->
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
Jeg ville blive glad hvis nogen kunne hjælpe mig
Mvh
Mivs