Ho scaricato da mr.webmaster un conta click in asp per
vedere come si comportano gli utenti, ma non funge... :hammer:
forse x chè non ho capito il meccanismo dello script che
è composto di 3 file: click.mdb, redirect.asp e
clickview.asp.
dopo aver scaricato tutto sul server, ho cliccato a destra e
a manca...poi ho aperto clickview.asp, inserito user e password
e....niente!Non mi viene mostrato alcun dato!
posto i codici:
redirect.asp:
<%
SiteURL = Request.QueryString("URL")
If Len(SiteURL) > 0 Then
Set objConn = CreateObject("ADODB.Connection")
objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("mdb-database/clicks.mdb"))
' If the URL is already in the database an error will be thrown and we perform an UPDATE
' Instead of a INSERT.
on error resume next
objConn.Execute "INSERT INTO SiteClicks(URL,ClickCount) VALUES('" & SiteURL & "',1)"
If Err.Number <> 0 Then
objConn.Execute "UPDATE SiteClicks SET ClickCount = ClickCount + 1 WHERE URL='" & SiteURL & "'"
End If
objConn.Close
Set objConn= Nothing
Response.redirect SiteURL
End If
%>
e clickview.asp:
<HTML>
<HEAD><TITLE>Clicks</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 Align="Center">
<%
If Request.Form("Username") = "alex" And _
Request.Form("Password") = "1546" Then
Set objConn = CreateObject("ADODB.Connection")
objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("mdb-database/clicks.mdb"))
Set rsURLs = objConn.Execute("SiteClicks")
Response.write "<TR><TD>URL</TD><TD>Click Count</TD></TR>"
Do While Not rsUrls.EOF
Response.write "<TR><TD>" & rsURLs("URL") & "</TD>"
Response.write "<TD align=right>" & rsURLs("ClickCount") & "</TD></TR>"
rsURLS.MoveNext
Loop
rsURLs.Close
Set rsURLs = Nothing
objConn.Close
Set objConn= Nothing
Else %>
<TR><TD>
<H1>Click Counts</H1>
<FORM action="clickview.asp" method="Post">
Username: <INPUT type=text name="Username"><BR>
Password: <INPUT type=password name="Password"><BR>
<INPUT type=Submit value="Log In">
</FORM>
</TD></TR>
<% End If %>
</TABLE>
</BODY>
</HTML>
Dovevo forse personalizzare qualche parametro??
Grazie
vedere come si comportano gli utenti, ma non funge... :hammer:
forse x chè non ho capito il meccanismo dello script che
è composto di 3 file: click.mdb, redirect.asp e
clickview.asp.
dopo aver scaricato tutto sul server, ho cliccato a destra e
a manca...poi ho aperto clickview.asp, inserito user e password
e....niente!Non mi viene mostrato alcun dato!
posto i codici:
redirect.asp:
<%
SiteURL = Request.QueryString("URL")
If Len(SiteURL) > 0 Then
Set objConn = CreateObject("ADODB.Connection")
objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("mdb-database/clicks.mdb"))
' If the URL is already in the database an error will be thrown and we perform an UPDATE
' Instead of a INSERT.
on error resume next
objConn.Execute "INSERT INTO SiteClicks(URL,ClickCount) VALUES('" & SiteURL & "',1)"
If Err.Number <> 0 Then
objConn.Execute "UPDATE SiteClicks SET ClickCount = ClickCount + 1 WHERE URL='" & SiteURL & "'"
End If
objConn.Close
Set objConn= Nothing
Response.redirect SiteURL
End If
%>
e clickview.asp:
<HTML>
<HEAD><TITLE>Clicks</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 Align="Center">
<%
If Request.Form("Username") = "alex" And _
Request.Form("Password") = "1546" Then
Set objConn = CreateObject("ADODB.Connection")
objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("mdb-database/clicks.mdb"))
Set rsURLs = objConn.Execute("SiteClicks")
Response.write "<TR><TD>URL</TD><TD>Click Count</TD></TR>"
Do While Not rsUrls.EOF
Response.write "<TR><TD>" & rsURLs("URL") & "</TD>"
Response.write "<TD align=right>" & rsURLs("ClickCount") & "</TD></TR>"
rsURLS.MoveNext
Loop
rsURLs.Close
Set rsURLs = Nothing
objConn.Close
Set objConn= Nothing
Else %>
<TR><TD>
<H1>Click Counts</H1>
<FORM action="clickview.asp" method="Post">
Username: <INPUT type=text name="Username"><BR>
Password: <INPUT type=password name="Password"><BR>
<INPUT type=Submit value="Log In">
</FORM>
</TD></TR>
<% End If %>
</TABLE>
</BODY>
</HTML>
Dovevo forse personalizzare qualche parametro??

Grazie