Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Link Logging
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 02 November 2000 :  20:33:40  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
What the subject says, logging the number of hits to a link... I havnt tested this out at all, but I am *hoping* and *ASSUMING* it will work...

The following would go in a file of its own... like linklog.asp or something

<font color=red>CODE UPDATED - see below some ways..., and it does work, I'm not hoping anymore</font id=red>

Edited by - da_stimulator on 03 November 2000 12:28:42

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 02 November 2000 :  22:50:01  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
tomorrow I will look at inc_functions.asp and see if I can make a working example for ya's.

<font color=red>Da_Stimulator</font id=red>
<font color=red>http://aokingdom.com</font id=red>
<font color=blue>response.write("I know what you coded last summer!")</font id=blue>
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 03 November 2000 :  00:34:24  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
http://forums.aokingdom.com/toe/topic.asp?TOPIC_ID=52&FORUM_ID=2&CAT_ID=2&Topic_Title=This+is+now+a+testing+forum&Forum_Title=ToE+Clan+Public+Forum

Ok, I fixed the code and it DOES work, just 1 minor problem, how the heck do I get it to show how many hits? The only thing I can gather is in inc_functions.asp around line 1785, '<font color=red>Function ReplaceUrls(fString)</font id=red>' That function, is where I would make it happen. I screwed around with the code a little bit, and sorta kinda got the link code working.

I replaced (<font color=red>Note: I replaced the brackets ([]) with Curly thingys ({}) cuz this thing is retarded</font id=red>)

<pre id=code><font face=courier size=2 id=code>
' oTag = "{url="""
' oTag2 = "{url}"
' roTag = "<a href="""
' c1Tag = """}"
' c1Tag2 = "{/url}"
' rc1Tag = """ target=""_New"">"
' c2Tag = "{/url}"
' rc2Tag = "</a>"
' oTagPos = InStr(1, fString, oTag, 1)
' c1TagPos = InStr(1, fString, c1Tag, 1)
</font id=code></pre id=code>

With

<pre id=code><font face=courier size=2 id=code>
oTag = "{url="""
oTag2 = "{url}"
roTag = "<a href=linklog.asp?action=loglink&goto="
c1Tag = """}"
c1Tag2 = "{/url}"
rc1Tag = " target=""_new"">"
c2Tag = "{/url}"
rc2Tag = "</a>"
oTagPos = InStr(1, fSring, oTag, 1)
c1TagPos= InStr(1, fSring, c1Tag, 1)
</font id=code></pre id=code>

and anything between {url}http://whatever{/url} gets changed, but if you do 'url=whatever' whatever '/url' then it dosnt work.

<font color=red>Da_Stimulator</font id=red>
<font color=red>http://aokingdom.com</font id=red>
<font color=blue>response.write("I know what you coded last summer!")</font id=blue>

Edited by - da_stimulator on 03 November 2000 00:35:52

Edited by - da_stimulator on 03 November 2000 00:38:55

Edited by - da_stimulator on 03 November 2000 00:39:42
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 03 November 2000 :  01:02:47  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
<font color=red>Fixed</font id=red>
Just to see if it worked, I made a file ( http://forums.aokingdom.com/toe/show_linking_test.asp ) to show what it would look like. The file contains:
<%
url = "http://aokingdom.com"
showvisits = readvisits(url)
response.write("<a href=linklog.asp?action=loglink&goto=http://aokingdom.com>AoKingdom</a>" & showvisits)
%>

And I get the error: <font color=green>

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/toe/inc_functions.asp, line 47
</font id=green>

here is the function with line 47 highlighted. The problem is in the strsql variable though.

function readvisits(fString)
thelink = fString
Set snitzlinkrs=Server.CreateObject("ADODB.RecordSet")
<font color=blue>strsql = "SELECT * from snitz_linking WHERE link='"
strsql = strsql & thelink & "'"</font id=blue>
<font color=red>snitzlinkrs.Open(strsql), my_conn</font id=red>
visits = snitzlinkrs("visits")
response.write("("&visits&" visits)")
snitzlinkrs.Close
Set snitzlinkrs = nothing
end function


<font color=red>Da_Stimulator</font id=red>
<font color=red>http://aokingdom.com</font id=red>
<font color=blue>response.write("I know what you coded last summer!")</font id=blue>

Edited by - da_stimulator on 03 November 2000 01:05:08

Edited by - da_stimulator on 03 November 2000 12:32:25
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20592 Posts

Posted - 03 November 2000 :  03:31:15  Show Profile  Visit HuwR's Homepage
I think your Open command should be

snitzlinkrs.Open strsql, my_conn


<font color=blue>'Resistance is futile'</font id=blue>
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 03 November 2000 :  12:26:47  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
WOOHOO IT WORKS! ok maybe I'm over excited, but hey, first time I wrote a function. All the code is below:

<font color=green>The function in inc_functions.asp (at the top)</font id=green>
<font color=blue>
function readvisits(fString)
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
thelink = fString
strsql = "SELECT * from snitz_linking WHERE link='"
strsql = strsql & thelink & "'"
Set snitzlinkrs=Server.CreateObject("ADODB.RecordSet")
snitzlinkrs.Open strsql, my_Conn
visits = snitzlinkrs("visits")
response.write("("&visits&" visits)")
snitzlinkrs.Close
Set snitzlinkrs = nothing
my_Conn.close
set my_Conn = nothing
end function
</font id=blue>

<font color=green>LinkLog.asp</font id=green>
<font color=blue>
<!--#include file="config.asp" -->
<%
'usage
' ?action=loglink&goto=http://link.url to log visits to the url
' ?action=setup to add table to snitz database
'variables
redirto = request.querystring("goto")
action = request.querystring("action")
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString

'setup (add table)
'''''''''''''''''''
if action="setup" then
'''''''''''''''''
strsql = "CREATE TABLE snitz_linking (link CHAR, visits CHAR)"
my_conn.execute(strsql)
response.write("table created, ready for use")
'check and see if link is already in database, if not, add it.
''''''''''''''''
elseif action="loglink" then
''''''''''''''''
Set snitzlinkrs=Server.CreateObject("ADODB.RecordSet")
snitzlinkrs.Open "SELECT * FROM snitz_linking WHERE link='"&redirto&"'", my_conn
'link isnt there, add it and record 1 visit
''''''''''''''''''''''
if snitzlinkrs.EOF then
''''''''''''''''''''''
strsql = "INSERT INTO snitz_linking(link, visits) Values('"&redirto&"', '1')"
my_conn.execute(strsql)
snitzlinkrs.Close

response.redirect(redirto)
'''''''''''''''''''''''
else
'''''''''''''''
'link is there, record 1 more visit
visits = snitzlinkrs("visits")
visits = visits + 1
strsql = "Update snitz_linking Set visits='"&visits&"' WHERE link='"&redirto&"'"
my_conn.execute(strsql)
snitzlinkrs.Close
response.redirect(redirto)
end if
end if
set snitzlinkrs = nothing

my_conn.Close
set my_conn = nothing
%>
</font id=blue>

<font color=green>show_linking_test.asp (how a link would be shown)</font id=green>
<font color=blue>
<!--#INCLUDE FILE="inc_functions.asp" -->
<%
str = "<a href=linklog.asp?action=loglink&goto=http://aokingdom.com>AoKingdom</a>"
str = str & readvisits("http://aokingdom.com")
response.write(str)
%>
</font id=blue>

Now all I need to figure out is how to change the function <font color=red>ReplaceUrls(fString)</font id=red> so that it will display this with new links, and I'll have a mod for you :)

<font color=red>Da_Stimulator</font id=red>
<font color=red>http://aokingdom.com</font id=red>
<font color=blue>response.write("I know what you coded last summer!")</font id=blue>
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07