ciao a tutti questo è il problema
sto preparando un sito web qui c'e' il file login.asp che funziona perfettamente il database intefaccia e mi da l'accesso alla pagina interroga. asp e fino a questo punto tutto ok
il mio problema è questo: come faccio a fare vedere a ciascun utente autenticato solo i propri record.
grazie per l'attenzione qui di seguito i file
<%
Dim nome_ut
Dim pass
nome_ut = Replace(Request.Form("matricola"), "'", "''")
pass = Replace(Request.Form("password"), "'", "''")
strdatabaselocation = "e:\inetpub\wwwroot\itcgalunni\db\itcg.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0 ; " & "persist security info=false;data source=" & strdatabaselocation
conn.open
sql = "SELECT * FROM alunni WHERE matricola='" &nome_ut&_
"' AND PASSWORD='" &pass& "'"
set rs=conn.execute(sql)
Dim autenticato
if rs.eof then
autenticato = false
else
autenticato = true
end if
rs.Close
conn.close
Set rs = Nothing
'Set conn. = Nothing
if autenticato = true then
Session("Autenticato") = "OK"
Response.Redirect("interroga.asp")
else
Response.Redirect("errore.htm")
end if
%>
-------------------------------------
pagina interroga
<%
if Session("Autenticato")<>"OK" then
Response.Redirect("index.asp")
end if
%>
<HTML>
<HEAD>
<TITLE>Area riservata</TITLE>
</HEAD>
<BODY BGCOLOR=#BBBBFF>
<DIV ALIGN=CENTER><H1>PAGINA RISERVATA</H1>
<H2>UTENTE AUTENTICATO</H2>
</DIV>
<%
strdatabaselocation = "e:\inetpub\wwwroot\itcgalunni\db\itcg.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0 ; " & "persist security info=false;data source=" & strdatabaselocation
conn.open %>
<html>
<font size="5" color="#000080">Utente:
<%nome_ut=request("nome_ut")%>
<%response.write(nome_ut)%></font><font color="#FF0000" size="4">
</font>
</p>
<table border="0" width="800" id="table2">
<tr>
<td width="100">Matricola</td>
<td width="150">Cognome</td>
<td width="150">Nome</td>
<td width="150">Note</td>
</tr>
</table>
<% sql="select * from voti WhERE matricola like '%"&nome_ut&"%'"
set rs=conn.execute(sql)
do while not rs.eof
cognome=rs("cognome")
nome=rs("nome")
matricola=rs("matricola")
data=rs("data")
note=rs("note")
%></p>
<table border="0" width="800" id="table1" style="border-style: solid; border-width: 1px" bgcolor="#66FFCC">
<tr>
<td width="100"><%=matricola%></td>
<td width="150"><%=cognome%></td>
<td width="150"><%=nome%></td>
<td width="80"><%=data%></td>
<td width="150"><%=note%></td>
</tr>
</table>
<% rs.movenext
loop
rs.close%>
<% conn.close%>
</body>
</html>

Rispondi quotando
