<%
url = Request.QueryString("url")
Set objRS = objConn.Execute("SELECT b.link_text, b.url_link FROM user a, resellers b WHERE b.uid = a.reseller_uid AND a.url = '" & url & "'")
if not objRS.eof then
link_text = objRS.Fields("link_text")
url_link = objRS.Fields("url_link")
else
link_text = "Free one way links"
url_link = "http://www.free1waylinks.com/"
end if
%>
<% response.write(link_text) %>
<%
else
'GETS the users database
url = Request.QueryString("url")
'url = "www.ion-sss.com"
if url = "/resource_directory.asp" then
url = Request.ServerVariables("server_name")
end if
'response.write url
Set objRS = objConn.Execute("SELECT db, uid FROM user WHERE url = '" & url & "'")
db = objRS.Fields("db")
uid = objRS.Fields("uid")
'Selects the database
if db = 1 then
db = "lucy"
db_link = "rachel"
elseif db = 2 then
db = "rachel"
db_link = "jenny"
else
db = "jenny"
db_link = "lucy"
end if
'Selects the users ID
Set objRS_week = objConn.Execute("SELECT id, week FROM " & db & " WHERE uid = " & uid & "")
Set objRS_settings = objConn.Execute("SELECT week, links_per_week, keywordweek FROM settings")
'Works out what week the user begins in
WTB_temp = (objRS_week.Fields("id") / objRS_settings.Fields("links_per_week"))
if WTB_temp < 0.5 then
WTB = Round(WTB_temp+0.5)
else
WTB = round(WTB_temp)
end if
'response.write WTB
'echo $WTB." ";
'echo $rs_week['id']." ";
'echo $rs_settings['links_per_week']." ";
'Works out the number of weeks
NOFW = (objRS_settings.Fields("week") - WTB) + 1
'echo $rs_settings['week']." ";
'echo $NOFW." ";
'Selects the links
if NOFW <= 0 then
LOW = 0
elseif NOFW = 1 then
LOW = 1
else
for i=0 to NOFW step 1
LOW = LOW & i & ","
next
LOW = (LEFT(LOW,LEN(LOW) -1))
end if
'Workout what keyword we are on
keywordweek = objRS_settings.Fields("keywordweek")
'response.write "SELECT count(*) AS totallinks FROM user a, " & db_link & " b WHERE a.uid = b.uid AND a.category = " & category & " AND a.status = 'Live' AND b.week in (" & LOW & ")"
'Pagination
Set objRS_cont = objConn.Execute("SELECT count(*) AS totallinks FROM user a, " & db_link & " b WHERE a.uid = b.uid AND a.category = " & category & " AND a.status = 'Live' AND b.week in (" & LOW & ")")
totallinks = objRS_cont.Fields("totallinks")
page = Request.Querystring("page")
if page = "" then
page = 1
end if
limit = 75
'limitvalue = 0
limitvalue = page * limit - (limit)
Set objRS = objConn.Execute("SELECT a.url, a.kw" & keywordweek & " AS kw, a.description FROM user a, " & db_link & " b WHERE a.uid = b.uid AND a.category = " & category &" AND a.status = 'Live' AND b.week in (" & LOW & ") LIMIT " & limitvalue & "," & limit & "")
Set objRS_cat = objConn.Execute("SELECT id, category FROM categories WHERE id = '" & category & "'")
%>
Resource Directory
<% Response.Write objRS_cat.Fields("category") %>
Categories Index > <% Response.Write objRS_cat.Fields("category") %>
<%
url = Request.QueryString("url")
Set objRS = objConn.Execute("SELECT b.link_text, b.url_link FROM user a, resellers b WHERE b.uid = a.reseller_uid AND a.url = '" & url & "'")
if not objRS.eof then
link_text = objRS.Fields("link_text")
url_link = objRS.Fields("url_link")
else
link_text = "Free one way links"
url_link = "http://www.free1waylinks.com/"
end if
%>
<% response.write(link_text) %>