tabella_link
link_id - contatore
link_name - testo (50)
link_url - testo (255)
link_click - numerico
codice:
<%
' elenco link
set conn = server.createObject("ADODB.Connection")
conn.open connString
sql = "SELECT link_id, link_name FROM tabella_link ORDER BY link_name"
set rs = conn.execute(sql)
if not rs.eof then
do until rs.eof
response.write "" & rs("link_name") & "
"
rs.moveNext
loop
end if
rs.close
set rs = nothing
conn.close
set conn = nothing
%>
redirect.asp
codice:
<%
id = request.queryString("id")
if len(id) > 0 and isNumeric(id) then
set conn = server.createObject("ADODB.Connection")
conn.open connString
sql = "SELECT link_url FROM tabella_link WHERE link_id = " & id
set rs = conn.execute(sql)
if not rs.eof then
url = rs("link_url")
conn.execute("UPDATE tabella_link SET link_clik = link_click + 1 WHERE link_id = " & id)
end if
rs.close
set rs = nothing
conn.close
set conn = nothing
end if
if len(url) > 0 then
response.redirect url
else
response.write "Nessun indirizzo disponibile"
end if
%>
connString deve essere la tua stringa di connessione al database.