Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. I dati non esistono nel db

I dati non esistono nel db

Pianificato Fissato Bloccato Spostato Coding
4 Post 2 Autori 675 Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • T
    T
    terra
    scritto su ultima modifica di
    User Newbie 0
    #1
    I dati non esistono nel db

    Salve, ho scritto la pagina login. con alcune delle mie funzioni.
    Ma volevo solo sapere come faccio ad dirgli se non esiste quell'email o password dentro il db far venire fuori un messaggio del tipo "Non esistono" Mi dite come fare?.

    grazie.

    ecco il codice:

    <!-- #include virtual="/inc.asp" -->
    <!-- #include virtual="/header.asp" -->
    <%
    
    
    function TestCaptcha(byval valSession, byval valCaptcha)
        dim tmpSession
        valSession = Trim(valSession)
        valCaptcha = Trim(valCaptcha)
        if (valSession = vbNullString) or (valCaptcha = vbNullString) then
            TestCaptcha = false
        else
            tmpSession = valSession
            valSession = Trim(Session(valSession))
            Session(tmpSession) = vbNullString
            if valSession = vbNullString then
                TestCaptcha = false
            else
                valCaptcha = Replace(valCaptcha,"i","I")
                if StrComp(valSession,valCaptcha,1) = 0 then
                    TestCaptcha = true
                else
                    TestCaptcha = false
                end if
            end if        
        end if
    end function
    %><%
    
    action = Request.Form("act")
    email=Request.Form("email") 
    loginpassword=Request.Form("password") 
    
    %>
    <%
    errore = ""
    if action ="entra" then
    if email = "" then
    errore = errore & "Non hai inserito l'email"
    elseif loginpassword = "" then
    errore = errore & "Non hai inserito la password"
    
        Elseif not IsEmpty(Request.Form("invia")) then
            
            if TestCaptcha("ASPCAPTCHA", Request.Form("captchacode")) then
            
    'errore = errore & "Devi inserire password per modificare i dati"
    SQL = "SELECT * FROM users WHERE email =  '" & email & "' and  passwords =  '" & loginpassword & "' and locks='2';"
    Set oRs = Mysql_Rows(oCn,SQL)
    
    if not oRs.eof then
        
     
     SQL = "SELECT * FROM users WHERE email =  '" & email & "' and  passwords =  '" & loginpassword & "' and locks='2';"
    
     Set RS = MySql_Rows(oCn, SQL)
    
    
        if not RS.eof then
        RS.movefirst
        Do
            loginsuccess = "1"
            UsersId = RS("UsersId")
            UId = RS("UsersId")
            nick = RS("nick")
            role = RS("role")
            level = RS("levels")
            Pass= RS("passwords")
            Email = RS("email")
            RS.movenext
        Loop until RS.eof
        RS.movefirst
        End if
    
    
        if   loginsuccess = "1"   then
    
    
    
    
        Response.Cookies("uId")("uIds") = UsersId
        Response.Cookies("UId")("UId") = UId
        Response.Cookies("username")("Nick") = nick
        Response.Cookies("role")("roles") = role
        Response.Cookies("level")("levels") = level
        Response.Cookies("email")("emails") = Email
        Response.Cookies("Password_current")("Pass")= Pass
    
        SQL = ""
        SQL = SQL & "INSERT INTO users_online(nick)VALUES("
        SQL = SQL & "'"&nick&"')"
        Mysql_Query oCn,SQL
        erorre = errore  & "Redirect in corso"
        Response.Write("<meta http-equiv='refresh' content='4;URL="&strUrl&"'")
        
        End if
        else
        errore = errore & "Spiacente la tua password non coincide con il tuo username"
    
        End if
        else
        errore = errore & "Non hai inserito il codice essato"
        End if
        
        
        else
        End if
        else
    
        %>    
    <form method="POST" action="login.asp" name="login">
    <p><%=errore%></p>
    <input type="hidden" name="act" value="entra">
    
        <div class="right">
                 <p>&nbsp;</p>
                 <table width="100%" border="0" cellspacing="2" cellpadding="2">
                   <tr>
                     <td colspan="2">Benvenuto nell'area riservata se non ti sei ancora registrati vai in questa pagina (<a href="registrati.asp" class="a">registrati</a>) e riempi il modulo</td>
                   </tr>
                   <tr>
                     <td width="25%">&nbsp;</td>
                     <td width="75%">&nbsp;</td>
                   </tr>
                   <tr>
                     <td><label for="name2">Email:</label></td>
                     <td><input type="text" name="email" value="<%=email%>" /></td>
                   </tr>
                   <tr>
                     <td><label for="name3">Password:</label></td>
                     <td><input type="text" name="password" value="<%=loginpassword%>" /></td>
                   </tr>
                   <tr>
                     <td height="35">&nbsp;</td>
                     <td>&nbsp;</td>
                   </tr>
                   <tr>
                     <td>Codice di sicurezza</td>
                     <td><img src="/captcha.asp" alt="" id="imgCaptcha" /><br />
                       <a href="javascript:void(0)" onclick="RefreshImage('imgCaptcha')" style="color:#000000;">Change Image</a></td>
                   </tr>
                   <tr>
                     <td>Inserire codice sicurezza</td>
                     <td><input name="captchacode" type="text" id="captchacode" size="10" /></td>
                   </tr>
                   <tr>
                     <td>&nbsp;</td>
                     <td><input type="submit" name="invia" value="Accedi" /></td>
                   </tr>
              </table>
                 <p>&nbsp;</p>
        </div>
    </form> 
    
    <%     End if %>
    <%=errore%>
    <!-- #include virtual="/footer.asp" -->
    
    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • T
      T
      terra
      scritto su ultima modifica di
      User Newbie 0
      #2

      ho sistemato la parte della pagina (login).
      ecco il codice:

      <!-- #include virtual="/inc.asp" -->
      <!-- #include virtual="/header.asp" -->
      <%
      
      
      function TestCaptcha(byval valSession, byval valCaptcha)
          dim tmpSession
          valSession = Trim(valSession)
          valCaptcha = Trim(valCaptcha)
          if (valSession = vbNullString) or (valCaptcha = vbNullString) then
              TestCaptcha = false
          else
              tmpSession = valSession
              valSession = Trim(Session(valSession))
              Session(tmpSession) = vbNullString
              if valSession = vbNullString then
                  TestCaptcha = false
              else
                  valCaptcha = Replace(valCaptcha,"i","I")
                  if StrComp(valSession,valCaptcha,1) = 0 then
                      TestCaptcha = true
                  else
                      TestCaptcha = false
                  end if
              end if        
          end if
      end function
      
      
      action = Request.Form("act")
      email=Request.Form("email") 
      loginpassword=Request.Form("password") 
      
      
      if action ="entra" then
      if email = "" then
      errore = errore & "<p style='background-color:red;font-size:20px;'>Non hai inserito l'email</p>"
      elseif loginpassword = "" then
      errore = errore & "<p style='background-color:red;font-size:20px;'>Non hai inserito la password</p>"
      
      
          Elseif not IsEmpty(Request.Form("invia")) then
              
              if TestCaptcha("ASPCAPTCHA", Request.Form("captchacode")) then
              
           
          
       
       SQL = "SELECT * FROM users WHERE email =  '" & email & "' and  passwords =  '" & loginpassword & "' and locks='2';"
      
       Set RS = MySql_Rows(oCn, SQL)
      
      
          if not RS.eof then
          RS.movefirst
          Do
              loginsuccess = "1"
              UsersId = RS("UsersId")
              UId = RS("UsersId")
              nick = RS("nick")
              role = RS("role")
              level = RS("levels")
              Pass= RS("passwords")
              Email = RS("email")
              RS.movenext
          Loop until RS.eof
          RS.movefirst
          else
          erorre = errore & "<p style='background-color:green;font-size:20px;'>Nessuna Password o email nel db</p>"
      
          End if
      
      
          if   loginsuccess = "1"   then
      
      
      
      
          Response.Cookies("uId")("uIds") = UsersId
          Response.Cookies("UId")("UId") = UId
          Response.Cookies("username")("Nick") = nick
          Response.Cookies("role")("roles") = role
          Response.Cookies("level")("levels") = level
          Response.Cookies("email")("emails") = Email
          Response.Cookies("Password_current")("Pass")= Pass
      
          SQL = ""
          SQL = SQL & "INSERT INTO users_online(nick)VALUES("
          SQL = SQL & "'"&nick&"')"
          Mysql_Query oCn,SQL
          erorre = errore  & "Redirect in corso"
      '    Response.Write("<meta http-equiv='refresh' content='4;URL="&strUrl&"'")
            
          End if
            
            Response.Redirect("registrato.asp")
      else
                  errore = errore & "<p style='background-color:red;font-size:20px;text-align:center;'>Errore codice non in uso</p>"
              end if
          
          end if
      
      End if
      
      
      
      
      %>
      <div style="margin-left:10px;">
      <form method="POST" action="<%=strUrl%>" >
      <p><%=strUrl%></p>
      
      <p><input type="hidden" name="act" value="entra"></p>
      
      
      <table width="100%" border="0" cellspacing="4" cellpadding="4">
        <tr>
          <td colspan="2" align="center" valign="middle" >Benvenuto nell'area riservata se non ti sei ancora registrati vai in questa pagina (<a href="registrati.asp" class="a">registrati</a>) e riempi il modulo</td>
        </tr>
        <tr>
          <td colspan="2">Errore:
            <% Response.Write(errore) %>
         </td>
          </tr>
        <tr>
          <td width="39%">Insrire l'email per entrare</td>
          <td width="61%"><input type="text" name="email" value="<%=email%>" /></td>
        </tr>
        <tr>
          <td>Inserire la password per entrare</td>
          <td><input type="text" name="password" value="<%=password%>" /></td>
        </tr>
        <tr>
          <td>Codice di sicurezza</td>
          <td><img src="/captcha.asp" alt="" id="imgCaptcha" /><br />
            <a href="javascript:void(0)" onclick="RefreshImage('imgCaptcha')" style="color:#000000;">Change Image</a></td>
        </tr>
        <tr>
          <td>Inserire codice sicurezza</td>
          <td><input name="captchacode" type="text" id="captchacode" size="10" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="invia" value="Accedi!" /></td>
        </tr>
      </table>
      <p>&nbsp;</p>
        </form>
      </div>
      
      <!-- #include virtual="/footer.asp" -->
      
      1 Risposta Ultima Risposta
      Miglior risposta 0
      0
      • A
        A
        ale.1976
        scritto su ultima modifica di
        User 0
        #3

        prima della riga "if not rs.eof"...metti una riga "if rs.eof"...

        Mentre la prima condizione gli dice che se non è alla fine del file (eof=end of file), e quindi vuol dire che ha trovato un record dove corrispondono username e password inseriti, nella condizione if rs.eof gli dici di restituire il messaggio che indica di non aver trovato record corrispondenti....quindi potresti mettere qualcosa tipo:

        if rs.eof then response.write "Attenzione! Non esistono Username e Password inseriti!"

        poi sistemalo tu che vedo che assegni il valore della variabile errore, e poi la stampi in base al caso...

        Ciao

        1 Risposta Ultima Risposta
        Miglior risposta 0
        0
        • T
          T
          terra
          scritto su ultima modifica di
          User Newbie 0
          #4

          Grazie mille, ha funzionato.

          ti ringrazio molto.

          1 Risposta Ultima Risposta
          Miglior risposta 0
          0

          Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

          Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

          Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

          Registrati Accedi
          Rispondi
          • Risposta alla discussione
          Effettua l'accesso per rispondere
          • Da Vecchi a Nuovi
          • Da Nuovi a Vecchi
          • Più Voti


          • Accedi

          • Non hai un account? Registrati

          • Accedi o registrati per effettuare la ricerca.
          • Primo post
            Ultimo post
          Home Accedi Registrati
          Menu
          • CATEGORIES
          • La Community Connect.gt
          • Presentati alla Community
          • News Ufficiali da Connect.gt
          • Internet News
          • A Scuola Di
          • Digital Marketing
          • Intelligenza Artificiale
          • SEO & GEO
          • Web Marketing e Content
          • Google Analytics e Web Analytics
          • Google Ads & Advertising
          • YouTube
          • TikTok, Instagram e altri Social
          • Google Adsense, Affiliazioni e Guadagno
          • E-Commerce
          • Coding e Sistemistica
          • Help Center: consigli per il tuo progetto
          • Hosting e Cloud
          • Coding
          • CMS & Piattaforme Self-Hosted
          • Annunci e Collaborazioni
          • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
          • Collaborazioni WEB e Lavoro: offro e cerco
          • Impresa, Fisco e Leggi
          • Consulenza Legale e Professioni Web
          • Consulenza Fiscale, Imprese, Startup e P.Iva
          • Gli Off Topic
          • PC, Smartphone e altri Hardware
          • Tutti i Software
          • GT Fetish Cafè
          • Discussioni
          • Non letti 0
          • Recenti
          • Hashtag
          • Popolare
          • Utenti
          • Privacy
          • Termini e condizioni
          • © 2026 Search On Media Group S.r.l.