Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it L'avatar di naps
    Registrato dal
    May 2001
    Messaggi
    465

    autenticazione impazzita comportamento random

    Scusate, vi volevo fare una domanda su un problema di memorizzazione password:

    ho fatto un sito con accesso tramite password, una volta che l'utente si è loggato
    viene automaticamente indirizzato alla pagina, premetto che questa pagina ha una serie di if che se l'utente non è registrato non vede...
    però il problema principale è questo:
    perchè se aggiorno la pagina dal tasto di explorer
    mi refresha vedendo la pagina come profilo registrato e se rirefresho la vedo come utente non registrato?? questo me lo fà in maniera random... a volte funziona e a volte non funziona più! perchè è così instabile???

    ho ricontrollato tutto il codice ed è perfetto..mi viene da dire è cambiato qualcosa nel web?
    gli aggiornamenti di explorer che ho fatto? oppure devo cambiare metodo di sintassi?
    o forse un problema dei db di access si sono rovinati...?

    vi è mai capitato?

    ho usato Macromedia Dreamweaver MX 6.0

  2. #2
    ho ricontrollato tutto il codice ed è perfetto.

    beh se il tuo codice non è corretto bensì è PERFETTO.....

    allora dipende dal web come dici tu.....
    comunque a parte gli scherzi non è mai capitato.....
    se comunque posti il codice sarebbe meglio.....
    si potrebbe capire meglio la cosa.......

    Ciao Max
    Ci sono solo 10 tipi di persone al mondo, chi conosce il binario e chi no.

    Disapprovo quello che dici, ma difenderò fino alla morte il tuo diritto a dirlo.

    Tanta bella giovinezza che si fugge tuttavia, chi vuol essere lieto sia, del doman non v'e' certezza.

  3. #3
    Utente di HTML.it L'avatar di naps
    Registrato dal
    May 2001
    Messaggi
    465
    codice:
     <%@LANGUAGE="VBSCRIPT"%> 
    <%
    ' *** Logout the current user.
    MM_Logout = CStr(Request.ServerVariables("URL")) & "?MM_Logoutnow=1"
    If (CStr(Request("MM_Logoutnow")) = "1") Then
      Session.Contents.Remove("MM_Username")
      Session.Contents.Remove("MM_UserAuthorization")
      MM_logoutRedirectPage = "generale.asp"
      ' redirect with URL parameters (remove the "MM_Logoutnow" query param).
      if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariables("URL"))
      If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
        MM_newQS = "?"
        For Each Item In Request.QueryString
          If (Item <> "MM_Logoutnow") Then
            If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
            MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
          End If
        Next
        if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
      End If
      Response.Redirect(MM_logoutRedirectPage)
    End If
    %> 
    
    
    <%
    ' *** 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("password"))
    If MM_valUsername <> "" Then
      MM_fldUserAuthorization="attiva"
      MM_redirectLoginSuccess="generale.asp"
      MM_redirectLoginFailed="../../errorepwd.asp"
      MM_flag="ADODB.Recordset"
      set MM_rsUser = Server.CreateObject(MM_flag)
      MM_rsUser.ActiveConnection = MM_connessione_utenti_STRING
      MM_rsUser.Source = "SELECT password, password"
      If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
      MM_rsUser.Source = MM_rsUser.Source & " FROM login WHERE password='" & 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
    %> <%
    Dim vocimenu
    Dim vocimenu_numRows
    
    Set vocimenu = Server.CreateObject("ADODB.Recordset")
    vocimenu.ActiveConnection = MM_connmenuprincipale_STRING
    vocimenu.Source = "SELECT * FROM menu"
    vocimenu.CursorType = 0
    vocimenu.CursorLocation = 2
    vocimenu.LockType = 1
    vocimenu.Open()
    
    vocimenu_numRows = 0
    %>
    <%
    Dim Recordtotale__MMColParam
    Recordtotale__MMColParam = "ospite"
    If (Request("MM_EmptyValue") <> "") Then 
      Recordtotale__MMColParam = Request("MM_EmptyValue")
    End If
    %>
    <%
    Dim Recordtotale
    Dim Recordtotale_numRows
    
    Set Recordtotale = Server.CreateObject("ADODB.Recordset")
    Recordtotale.ActiveConnection = MM_connarchitettura_STRING
    If Session("MM_UserAuthorization") = "" Then 
    Recordtotale.Source = "SELECT * FROM romana WHERE imgregistrati = '" + Replace(Recordtotale__MMColParam, "'", "''") + "' ORDER BY ordinecaricamento ASC"
    else
    Recordtotale.Source = "SELECT * FROM romana WHERE imgregistrati ORDER BY ordinecaricamento ASC"
    end if
    Recordtotale.CursorType = 0
    Recordtotale.CursorLocation = 2
    Recordtotale.LockType = 1
    Recordtotale.Open()
    
    Recordtotale_numRows = 0
    %> <%
    '  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
    
    Dim Recordtotale_total
    Dim Recordtotale_first
    Dim Recordtotale_last
    
    ' set the record count
    Recordtotale_total = Recordtotale.RecordCount
    
    ' set the number of rows displayed on this page
    If (Recordtotale_numRows < 0) Then
      Recordtotale_numRows = Recordtotale_total
    Elseif (Recordtotale_numRows = 0) Then
      Recordtotale_numRows = 1
    End If
    
    ' set the first and last displayed record
    Recordtotale_first = 1
    Recordtotale_last  = Recordtotale_first + Recordtotale_numRows - 1
    
    ' if we have the correct record count, check the other stats
    If (Recordtotale_total <> -1) Then
      If (Recordtotale_first > Recordtotale_total) Then
        Recordtotale_first = Recordtotale_total
      End If
      If (Recordtotale_last > Recordtotale_total) Then
        Recordtotale_last = Recordtotale_total
      End If
      If (Recordtotale_numRows > Recordtotale_total) Then
        Recordtotale_numRows = Recordtotale_total
      End If
    End If
    %>
    <%
    ' *** Move To Record and Go To Record: declare variables
    
    Dim MM_rs
    Dim MM_rsCount
    Dim MM_size
    Dim MM_uniqueCol
    Dim MM_offset
    Dim MM_atTotal
    Dim MM_paramIsDefined
    
    Dim MM_param
    Dim MM_index
    
    Set MM_rs    = Recordtotale
    MM_rsCount   = Recordtotale_total
    MM_size      = Recordtotale_numRows
    MM_uniqueCol = "b"
    MM_paramName = "valore"
    MM_offset = 0
    MM_atTotal = false
    MM_paramIsDefined = false
    If (MM_paramName <> "") Then
      MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
    End If
    %>
    <%
    ' *** Move To Specific Record: handle detail parameter
    
    If (MM_paramIsDefined And MM_rsCount <> 0) Then
    
      ' get the value of the parameter
      MM_param = Request.QueryString(MM_paramName)
    
      ' find the record with the unique column value equal to the parameter value
      MM_offset = 0
      Do While (Not MM_rs.EOF)
        If (CStr(MM_rs.Fields.Item(MM_uniqueCol).Value) = MM_param) Then
          Exit Do
        End If
        MM_offset = MM_offset + 1
        MM_rs.MoveNext
      Loop
    
      ' if not found, set the number of records and reset the cursor
      If (MM_rs.EOF) Then
        If (MM_rsCount < 0) Then
          MM_rsCount = MM_offset
        End If
        If (MM_size < 0 Or MM_size > MM_offset) Then
          MM_size = MM_offset
        End If
        MM_offset = 0
    
        ' reset the cursor to the beginning
        If (MM_rs.CursorType > 0) Then
          MM_rs.MoveFirst
        Else
          MM_rs.Close
          MM_rs.Open
        End If
      End If
    
    End If
    %>
    <%
    ' *** Move To Record: if we dont know the record count, check the display range
    
    If (MM_rsCount = -1) Then
    
      ' walk to the end of the display range for this page
      MM_index = MM_offset
      While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
        MM_rs.MoveNext
        MM_index = MM_index + 1
      Wend
    
      ' if we walked off the end of the recordset, set MM_rsCount and MM_size
      If (MM_rs.EOF) Then
        MM_rsCount = MM_index
        If (MM_size < 0 Or MM_size > MM_rsCount) Then
          MM_size = MM_rsCount
        End If
      End If
    
      ' if we walked off the end, set the offset based on page size
      If (MM_rs.EOF And Not MM_paramIsDefined) Then
        If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
          If ((MM_rsCount Mod MM_size) > 0) Then
            MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
          Else
            MM_offset = MM_rsCount - MM_size
          End If
        End If
      End If
    
      ' reset the cursor to the beginning
      If (MM_rs.CursorType > 0) Then
        MM_rs.MoveFirst
      Else
        MM_rs.Requery
      End If
    
      ' move the cursor to the selected record
      MM_index = 0
      While (Not MM_rs.EOF And MM_index < MM_offset)
        MM_rs.MoveNext
        MM_index = MM_index + 1
      Wend
    End If
    %>
    <%
    ' *** Move To Record: update recordset stats
    
    ' set the first and last displayed record
    Recordtotale_first = MM_offset + 1
    Recordtotale_last  = MM_offset + MM_size
    
    If (MM_rsCount <> -1) Then
      If (Recordtotale_first > MM_rsCount) Then
        Recordtotale_first = MM_rsCount
      End If
      If (Recordtotale_last > MM_rsCount) Then
        Recordtotale_last = MM_rsCount
      End If
    End If
    
    ' set the boolean used by hide region to check if we are on the last record
    MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
    %>
    <html>
    <head>
    <title>mia pagina</title>
    <link href="../../parametri.css" rel="stylesheet" type="text/css">
    <META HTTP-EQUIV="Refresh" CONTENT="">
    <meta http-equiv="Imagetoolbar" content="no">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="javascript"> 
    function apri(htm,loc) {
    largo=1024; 
    alto=768;
    posh=Math.floor((screen.height-alto)/0); 
    posw=Math.floor((screen.width-largo)/0+0); 
    fin = window.open(htm,loc,'"width="+largo+",height="+alto+",top="+posh+",left="+posw,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no'); 
    fin.focus();
    }
    </script>
    <script language="javascript"> 
    function help(htm,loc) {
    largo=500; 
    alto=555;
    posh=Math.floor((screen.height-alto)/2); 
    posw=Math.floor((screen.width-largo)/2+75); 
    fin = window.open(htm,loc,"width="+largo+",height="+alto+",top="+posh+",left="+posw); 
    fin.focus();
    }
    </script>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    //-->
    </script>
    <script language="javascript" src="../../validazione.js"></script>
    </head>
    <body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" leftmargin="40" topmargin="10" onLoad="MM_preloadImages('../../immagini/enter2.gif')">
    <style type="text/css">
    A:link, A:visited { text-decoration: none } A:hover { color: #00FF00 }
    </style>
    <table width="900" height="472" border="0" cellpadding="0" cellspacing="0">
              <tr> 
              <td colspan="2"><%
    If Session("MM_UserAuthorization") = "" then
    %> 
                <form ACTION="<%=MM_LoginAction%>" target="_self" name="formpwd" onSubmit="return validateForm(this)" method="POST">
                  Password
    
                  <input name="password" onFocus = "window.status='digita la tua password'" onBlur  = "window.status=window.defaultStatus" type="password" class="campocolore" id="password" size="11">
                  
    
                  <input type="image" name="pulsante" src="../../immagini/enter.gif">
                  Help 
                </form>
    			  <%
    End If
    %>
                  <%
    If Session("MM_UserAuthorization") = "si" then
    %>
                <a href="<%= MM_Logout %>" target="_top">Esegui 
                logout</a> 
                <%
    End If
    %>
              </td>
            </tr>
          </table>
        </td>
        <td width="726" align="center" valign="baseline"> 
          <table width="503" height="430" border="0" cellpadding="0" cellspacing="0">
            <tr> 
              <td height="8" align="center" valign="bottom"> ','pagina');">[img]b/<%=(Recordtotale.Fields.Item([/img].jpg" hspace="0" vspace="0" border="0"></td>
            </tr>
          </table>
          <table width="503" height="45" border="0" cellpadding="0" cellspacing="0">
            <tr class="basefoto"> 
              <td height="3" colspan="2">[img]../../immagini/pixelsf.gif[/img]</td>
            </tr>
            <tr class="basefoto"> 
              <td height="12"><a href="javascript:apri('totale.asp?chiamg=<%=(Recordtotale.Fields.Item("c").Value)%>','pagina');" class="enlarge"><font color="#FFFFFF">+</font> 
                Enlarge</a></td>
              <td> <div align="right"> 
                  
    
    <%=(Recordtotale.Fields.Item("descrizione").Value)%></p>
                </div></td>
            </tr>
            </table></td>
      </tr>
    </table>
    </body>
    </html>
    <%
    vocimenu.Close()
    Set vocimenu = Nothing
    %>
    <%
    vociarchitettura.Close()
    Set vociarchitettura = Nothing
    %>
    <%
    Recordtotale.Close()
    Set Recordtotale = Nothing
    %>
    i punti focali secondo me sono nello script: Logout the current user; e Validate request to log in to this site; epoi ho messo in grassetto anche l'estrapolazione di tutti i dati nel db con la if per registrati o non... possa esserti utile.

    grazie anticipatamente...

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.