3 - Arama motoru

Arama motoru




//search.asp dosyası------------------------------------------------------------------------------


<%

'Optimize eden varlık=Toygar Dundaralp
'fatihdursun65.tr.gg

%>
<% option explicit %>
<body bgcolor=336699>
<style type=text/css>
a{color:white;font-family:tahoma;font-size:12;font-weight:bold}
a:hover{color:#990000}
</style>
<font color=orange face=tahoma size=2><b>
<%
dim sol,sag,sayi,connobj,rsobj,sql,ara,sayiand,soland,sagand
set connobj=server.createobject("adodb.connection")
connobj.open("Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("denek.mdb"))
set rsobj=server.createobject("adodb.recordset")

ara=request.form("ara")
if instr(ara,"'") then
ara=replace(ara,"'","")
end if
if instr(ara," and ") then
ara=replace(ara," and ","|")
sayiand=instr(ara,"|")
soland=left(ara,sayiand-1)
sagand=mid(ara,sayiand+1)
sql="select site,bilgi from denek where kelime1 like '"&soland&"' or kelime2 like '"&soland&"' or " &_
"kelime3 like '"&soland&"' or kelime4 like '"&soland&"' or kelime1 like '"&sagand&"' or " &_
"kelime2 like '"&sagand&"' or kelime3 like '"&sagand&"' or kelime4 like '"&sagand&"'"
elseif instr(ara,"*") then
sol=left(ara,1)
sag=right(ara,1)
sayi=len(ara)-1
if left(ara,1)="*" then
ara=mid(ara,2)
sql="select site,bilgi from denek where kelime1 like '%"&ara&"' or kelime2 like '%"&ara&"' or " &_
"kelime3 like '%"&ara&"' or kelime4 like '%"&ara&"'"
elseif right(ara,1)="*" then
ara=left(ara,sayi)
sql="select site,bilgi from denek where kelime1 like '"&ara&"%' or kelime2 like '"&ara&"%'or " &_
"kelime3 like '"&ara&"%' or kelime4 like '"&ara&"%'"
end if
else
sql="select site,bilgi from denek where kelime1 like '"&ara&"' or kelime2 like '"&ara&"' or " &_
"kelime3 like '"&ara &"' or kelime4 like '"& ara &"'"
end if
rsobj.open sql,connobj,2,3
do while not rsobj.eof
response.write  "<a href=http://"& rsobj(0)&">" & rsobj(0) &"</a>" &"<br>" & rsobj(1) &"<br><br>"
rsobj.movenext
loop

%>


<%
rsobj.close
set rsobj = nothing
connobj.close
set connobj = nothing
%>

//search.asp dosyası--------------------------------buraya kadar--------------------------------


//html dosyası--------------------------------------
<html>
<body bgcolor=336699>
<center><br><br>
<form action=search.asp method=post>
<input type=text name=ara> &nbsp
<input type=submit value="  Ara  ">
</form>
</center>
</body>
</html>
--------------------------------------------------------------

 

 
Reklam
 
 

=> Sen de ücretsiz bir internet sitesi kurmak ister misin? O zaman burayı tıkla! <=