Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2004
    Messaggi
    35

    Mi scrivereste uno script?

    Ciao a tutti, scusate la sfacciataggine ma è tutto il giorno che cerco info a me comprensibile sulle sessioni e non c'ho capito nulla.
    vorrei che dopo il login di un utente possa andare nella sua pagina e vedere un determinato campo contenuto nel database ad esempio la colonna info ma solo relativa all'utente loggato. Appena apre la pagina info vede subito cosa c'è scritto relativamente a lui.
    Mi è stato detto
    Session("UTENTE") = identificativo.
    ma non ho capito dove lo devo mettere e soprattutto cosa devo mettere al posto di UTENTE e IDENTIFICATIVO.
    Io vi metto la pagina di login e cortesemente se poteste aiutarmi mi leveresti da un grosso casino!
    Il database da cui prelevare si chiama db1.mdb e la colonna che mi serve è Messaggio
    Non so se vi possa servire a qualcosa...
    GRAZIE

  2. #2
    Utente di HTML.it
    Registrato dal
    Nov 2004
    Messaggi
    35
    Ecco il codice

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

    <%
    ' *** Validate request to log in to this site.
    MM_LoginAction = Request.ServerVariables("URL")
    If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
    MM_valUsername=CStr(Request.Form("textfield"))
    If MM_valUsername <> "" Then
    MM_fldUserAuthorization=""
    MM_redirectLoginSuccess="Home.htm"
    MM_redirectLoginFailed="Loginnecess.htm"
    MM_flag="ADODB.Recordset"
    set MM_rsUser = Server.CreateObject(MM_flag)
    MM_rsUser.ActiveConnection = MM_Login_STRING
    MM_rsUser.Source = "SELECT UserID, Password"
    If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
    MM_rsUser.Source = MM_rsUser.Source & " FROM Utenti WHERE UserID='" & Replace(MM_valUsername,"'","''") &"' AND Password='" & Replace(Request.Form("textfield2"),"'","''") & "'"
    MM_rsUser.CursorType = 0
    MM_rsUser.CursorLocation = 2
    MM_rsUser.LockType = 3
    MM_rsUser.Open
    If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
    ' username and password match - this is a valid user
    Session("MM_Username") = MM_valUsername
    If (MM_fldUserAuthorization <> "") Then
    Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization ).Value)
    Else
    Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And false Then
    MM_redirectLoginSuccess = Request.QueryString("accessdenied")
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginSuccess)
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginFailed)
    End If
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Login Utente</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
    background-image: url();
    }
    .Stile3 {font-family: "microsoft Sans Serif"; font-weight: bold; }
    -->
    </style></head>

    <body>
    <form name="form1" method="POST" action="<%=MM_LoginAction%>">


    </p>
    <table width="398" border="2">
    <tr bgcolor="#FBFEFF">
    <td width="148" height="44"><span class="Stile3">Nome Utente:</span></td>
    <td width="144"><input type="text" name="textfield"></td>
    <td width="82" rowspan="2">[img]Immagini/arrow.gif[/img]</td>
    </tr>
    <tr bgcolor="#FBFEFF">
    <td><span class="Stile3">Password:</span></td>
    <td><input type="text" name="textfield2"></td>
    </tr>
    </table>



    <input type="submit" name="Submit" value="Invia">
    </p>
    </form>
    </body>
    </html>

  3. #3
    aeeeee il codice ke ti genera il dreamweaver, e ki ci capisce un cacchio...

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Non è lo spirito del forum.
    Documentati, ci sono molte risorse su http://freeasp.html.it

    Roby

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.