Programalama > ASP

Etiketler: arama, motoru

Ort. 0
Puan ver:
//search.asp dosyası------------------------------------------------------------------------------


<%

'Optimize eden varlık=Toygar Dundaralp
'e-Mail=tdundaralp@msn.com

%>
<% 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>
--------------------------------------------------------------


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.