Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di serpiko
    Registrato dal
    Feb 2005
    Messaggi
    346

    login con riconoscimento

    salve a tutti vorrei realizzare un login uguale a quello di questo sito, nel senso cioè che appena dopo l'insermiento del nick e della password il sistema riconosca l'utente e dica cio pinco ad esempio, in maniera tale che nella colonna di sinistra scompaia il form e compaia il messaggio di saluto, il tutto in un unico codice (cioè pagina).
    il login che io utilizzo è questo:


    <%
    ' *** Validate request to log in to this site.
    MM_LoginAction = Request.ServerVariables("URL")
    If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
    MM_valUsername=CStr(Request.Form("username"))
    If MM_valUsername <> "" Then
    MM_fldUserAuthorization=""
    MM_redirectLoginSuccess="login_ok.asp"
    MM_redirectLoginFailed="no_login.asp"
    MM_flag="ADODB.Recordset"
    set MM_rsUser = Server.CreateObject(MM_flag)
    MM_rsUser.ActiveConnection = MM_connRegistrazione_STRING
    MM_rsUser.Source = "SELECT username, password"
    If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
    MM_rsUser.Source = MM_rsUser.Source & " FROM utenti WHERE username='" & Replace(MM_valUsername,"'","''") &"' AND password='" & Replace(Request.Form("password"),"'","''") & "'"
    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
    %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Aree private nel sito >> LOGIN</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>

    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <div align="center">
    <table width="600" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td> </td>
    </tr>
    <tr>
    <td><div align="center"><font color="#000099" size="2" face="Tahoma">AREE
    PRIVATE NEL SITO >> LOGIN
    </font></div></td>
    </tr>
    <tr>
    <td> </td>
    </tr>
    <tr>
    <td height="84" valign="top"><form name="form1" id="form1" method="POST" action="<%=MM_LoginAction%>">
    <table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td width="110" height="28"><font size="2" face="Tahoma">Username:</font></td>
    <td width="240" height="28"><input name="username" type="text" id="username" size="32" />
    </td>
    </tr>
    <tr>
    <td width="110" height="28"><font size="2" face="Tahoma">Password:</font></td>
    <td width="240" height="28"><input name="password" type="password" id="password" size="32" />
    </td>
    </tr>
    <tr>
    <td width="110" height="28"> </td>
    <td width="240" height="28"><input type="submit" name="Submit" value="Log In!" />
    </td>
    </tr>
    </table>
    </form>
    </td>
    </tr>
    <tr>
    <td height="33" align="center" valign="middle"><font size="1" face="Tahoma"><a href="home.asp">Torna
    alla Home</a></font></td>
    </tr>

    </table>


    </p>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    </tr>
    </table>
    </div>
    </body>
    </html>


    questo invece il codice una volta loggato:

    <%
    ' *** Restrict Access To Page: Grant or deny access to this page
    MM_authorizedUsers=""
    MM_authFailedURL="login.asp"
    MM_grantAccess=false
    If Session("MM_Username") <> "" Then
    If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
    (InStr(1,MM_authorizedUsers,Session("MM_UserAuthor ization"))>=1) Then
    MM_grantAccess = true
    End If
    End If
    If Not MM_grantAccess Then
    MM_qsChar = "?"
    If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
    MM_referrer = Request.ServerVariables("URL")
    if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
    MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
    Response.Redirect(MM_authFailedURL)
    End If
    %>


    come faccio a legarli?!! ad ottenere quello che ho spiegato sopra!?!
    AIUTATEMI RAGA'''''''!!!!!!!!!!!!!!
    attenta allo sportello quando scendi!!!!

  2. #2
    Utente di HTML.it L'avatar di serpiko
    Registrato dal
    Feb 2005
    Messaggi
    346
    problema risolto!
    attenta allo sportello quando scendi!!!!

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 © 2026 vBulletin Solutions, Inc. All rights reserved.