Code :-
<!--#include file="editme.asp"-->
<html>
<head>
<style>
body { font-family : Times New Roman; font-size : 8pt; }
</style>
</head>
<body>
<%
On Error Resume Next
Dim geturl, title, description, keywords, strURL, strDB, con,
results
' URL
strURL = Request.QueryString("look_for")
Set geturl = CreateObject("Stardeveloper.GetURL")
strFileContents = geturl.Get(strURL)
Set geturl = Nothing
' Keywords
key1 = InStr(1, strFileContents, "<meta name=""keywords""
content=""", 1)
key1 = key1 + Len("<meta name=""keywords""
content=""")
key2 = InStr(key1, strFileContents, """>",
1)
keywords = "," & Trim(Mid(strFileContents,
key1, (key2 - key1))) & ","
keywords = Replace (keywords, "'", " ")
' Description
desc1 = InStr(1, strFileContents, "<meta name=""description""
content=""", 1)
desc1 = desc1 + Len("<meta name=""description""
content=""")
desc2 = InStr(desc1, strFileContents, """>",
1)
description = Trim(Mid(strFileContents, desc1, (desc2 -
desc1)))
description = Replace (description, "'", "
")
' Title
tit1 = InStr(1, lcase(strFileContents), "<title>",
1)
tit1 = tit1 + Len("<title>")
tit2 = InStr(tit1, strFileContents, "</title>",
1)
title = Trim(Mid(strFileContents, tit1, (tit2 - tit1)))
title = Replace (title, "'", " ")
' Our Connection Object
Set con = CreateObject("ADODB.Connection")
con.Open strDB
Set results = con.Execute("select title, description,
keywords _
from all_pages where url = '" & strURL & "'")
' If the returning recordset is empty the add the URL with
accompanying
' info to the database
If results.EOF Then
con.Execute("insert into all_pages (title, description,
keywords, url, _
mydate) values ('" & title & "', '"
& description & "', '" & _
keywords & "', '" & strURL & "',
'" & date & "')")
Set rs = con.Execute("select count(url) as total_count
from all_pages")
cnt = rs("total_count")
Set rs = Nothing
Response.Write "<b>New account successfully created
for " & strURL & " _
.</b>" & vbcrlf
Response.Write "<br>"
Response.Write "Total Pages Indexed : " & cnt
& vbcrlf
Else
' But if the returning recordset is not empty i.e. we have
already added _
' title, desc, keywords etc into it then update that information
with the _
' new one.
con.Execute("update all_pages set title = '" &
title & "', description = _
'" & description & "', keywords = '"
& keywords & "', mydate = #" _
& date & "# where url = '" & strURL
& "'")
Response.Write "<b>Account updated successfully.</b>"
End If
' Done. Now release Objects
Set results = Nothing
con.Close
Set con = Nothing
%>
</body></html>
|