Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13
  1. #1

    If Then Else..... cosa sbaglio?

    <%
    A = Request.Cookies("venere")

    If A<>stadioradio
    Then
    Dim str_code
    str_code = Request.cookies("Login")("userCode")

    'Creo una nuova SQL string
    strSQL = "SELECT code " & _
    "FROM tbl_Authors WHERE name='" & str_users_name & "' AND code='" & str_code & "' AND pass='" & str_users_password & "'"

    'Credo un nuovo recordsheet
    Set rs_check = Server.CreateObject ("ADODB.RecordSet")

    'Apro il record sheet e eseguo il codice SQL
    rs_check.open strSQL,adoCon

    If rs_check.EOF OR rs_check.BOF Then
    Response.Redirect "/public/pagine/registrazione_e_gestione_utenti/noentry.asp"
    End If
    Else
    End If
    %>

  2. #2
    A parte che il coda al codice c'è una sintassi del tipo:

    codice:
    Else 
    End If 
    %>
    che non ha senso, basta togliere semplicemente l'ELSE, visto che non lo usi....

    Ma la domanda di fondo è: qual è il problema di questo codice?
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

  3. #3
    allora sto cercando di modificare due script che fanno un controllo per un'area del sito protetta pensavo di inserire la possibilità di controllare l'esistenza o meno di un cookie ed in base a cio' fargli considerare o meno i due script...in ogni caso faccio ancora una modifica e vediamo che succede



  4. #4
    uno è questo:

    codice:
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <%
    A = Request.Cookies("venere")
    
    If A <> "stadioradio"
          Then
         If isCommonCreated <> True Then
    	'Determino il timeout dello script
    	Server.ScriptTimeout = 90
    
    	'Determino le dimensioni delle variabili
    	Dim strDataBasePath						'Variabile
    	Dim cString								'Variabile
    	Dim adoCon								'Variabile
    	Dim strSQL								'Variabile
    
    	'Setto la variabile per una connessione ADO
    	Set adoCon = Server.CreateObject("ADODB.Connection")
    
    	'------------------------------------------------------------------------------------
    	'Cambiare il path del database
    	strDataBasePath = "/mdb-database/utenti.mdb"
    	'------------------------------------------------------------------------------------
    
    	'Stringa per la connessione
    	'Se la seguente linea non funziona, commentare con ' e  scegliere un altra stringa
    	cString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(strDataBasePath)
    
    	'Usa questa stringa se usi Access Database 2000 o 2002
    	'cString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(strDataBasePath) 
    
    	'Usa questa stringa se usi DSN
    	'cString = "DSN=NAME_OF_DSN"
    	'Sostituisci il NAME_OF_DSN con il DSN
    
    	adoCon.Open cString
    
    	'Richiesta dei valori utente
    
    	'Setta the variable to the value in the users cookie
    	str_userscode = Request.Cookies("Login")("userCode")
    
    	'Se l'user code non è vuota allora
    	IF str_userscode <> "" THEN
    		'Creo un nuovo record set
    		Set rsUserLog = Server.CreateObject("ADODB.RecordSet")
    
    		'Setta una nuova stringa sql
    		StrSql="SELECT * FROM tbl_authors WHERE code='" & str_userscode & "';"
    
    		'Apro il recordset e eseguo il codice sql
    		rsUserLog.open StrSql,cString
    		
    		'Se non ci sono record che accertano l'identita dei dati dai cookies dell'utente 
    		'setta la variabile vuota
    		
    		If rsUserLog.EOF Then
    			Response.cookies("Login")("userCode") = ""
    		'Se non c'è nessun record allora
    		Else
    
    			' Setta i valori del database con le variabili	
    			str_users_name				= rsUserLog("name")
    			str_users_password			= rsUserLog("pass")
    			str_users_nome	    		= rsUserLog("nome")
    			str_users_cognome    		= rsUserLog("cognome")
    			str_users_email				= rsUserLog("email")
    			str_users_citta				= rsUserLog("citta")
    			str_users_provincia			= rsUserLog("provincia")
    			str_users_cap				= rsUserLog("cap")
    			str_users_authority			= rsUserLog("authority")
    			str_users_date				= rsUserLog("dataregistrazione")
    			str_users_code				= rsUserLog("code")
    			str_users_stato 			= rsUserLog("stato")
    			str_users_pagina_web		= rsUserLog("pagina_web")
    			str_users_utentesospeso	= rsUserLog("utentesospeso")
    		End If
    
    		'Chiudo
    		rsUserLog.Close
    		set rsUserLog = Nothing
    
    	'Se l'user code è vuoto allora l'utente è guest
    	Else
    		Response.cookies("Login")("userCode") = ""
    	End If
    
    '--------------------------------------------------------------------------------------------
    
    	'Creo un nuovo record set
    	set rsPageAttributes = Server.CreateObject("ADODB.RecordSet")
    
    	'Query sql
    	pageSql = "SELECT * FROM tbl_admin"
    
    	'Apro il recordset e eseguo sql
    	rsPageAttributes.open pageSql,cString
    
    	adminEmail			= rsPageAttributes("adminEmail")
    	pageTitle			= rsPageAttributes("TitoloSito")
    	homePage			= rsPageAttributes("homePage")
    	mailServer			= rsPageAttributes("mailHost")
    	tipoMail			= rsPageAttributes("tipoMail")
    	conf_email	    	= rsPageAttributes("conf_email")
    
    	'Chiusura
    	rsPageAttributes.Close
    	set rsPageAttributes = Nothing
    
    '--------------------------------------------------------------------------------------------
    Else
    	Dim isCommonCreated
    	isCommonCreated = True
    End If
    
    '--------------------------------------------------------------------------------------------
    Function GetState(intState)
    	Select Case intState 
    		Case 0
    			GetState = "adStateClosed" 
    		Case 1
    			GetState = "adStateOpen" 
    	End Select
    	'Sintassi: GetState(adoCon.state)
    End Function
    End If
    '--------------------------------------------------------------------------------------------
    %>

    l'altro e' quello di prima
    codice:
    <% 
    A = Request.Cookies("venere") 
    
    If A<>stadioradio 
    Then 
    Dim str_code 
    str_code = Request.cookies("Login")("userCode") 
    
    'Creo una nuova SQL string 
    strSQL = "SELECT code " & _ 
    "FROM tbl_Authors WHERE name='" & str_users_name & "' AND code='" & str_code & "' AND pass='" & str_users_password & "'" 
    
    'Credo un nuovo recordsheet 
    Set rs_check = Server.CreateObject ("ADODB.RecordSet") 
    
    'Apro il record sheet e eseguo il codice SQL 
    rs_check.open strSQL,adoCon 
    
    If rs_check.EOF OR rs_check.BOF Then 
    Response.Redirect "/public/pagine/registrazione_e_gestione_utenti/noentry.asp" 
    End If 
    End If 
    %>
    insomma appena vado a leggere la pagina mi da errore del interno del server

    :master:

  5. #5
    HTTP 500?

    Hai provato da IE a fare Strumenti --> Opzioni Internet --> Avanzate e qui a deselezionare la casella di spunta con accanto la scritta "Mostra messaggi HTTP brevi"?
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

  6. #6
    ALLORA MI è VENUTA UN'ALTRA IDEA

    SENZA INTACCARE I DUE SCRIPT POTREI UTILIZZARE LA VERIFICA FUORI DAGLI STESSI...NEL SENSO CHE SICCOME I DUE FILE VENGONO UTILIZZATI COME INCLUDE POTREI DECIDERE O MENO DI INCLUDERLI IN VIRTU' DELL'ESISTENZA O MENO DI UN DETERMINATO COOKIE!!


    I FILE SONO COSI INSERITI





    POTREI DI SE IL COOKIE NON C'E' ALLORA

    INCLUDI I DUE FILE

    ALTRIMENTI PROSEGUI


    MA QUAL'E' LA CORRETTA SINTASSI

  7. #7
    UNA COSA DEL GENERE POTREBBE FUNZIONARE PERCHè IO HO QUALCHE DUBBIO

    codice:
    <%
    A = Request.Cookies("venere")
    if A <> stadioradio then scelta=1
    
    Select case scelta
      case 1
    
       
       
    End Select
    %>

  8. #8
    Sintatticamente è corretto, ma non è detto che funzioni, nel senso che ti risolva il problema dell'errore interno del server.
    Da provare.
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

  9. #9
    allora non va in errore ma di fatto non funziona....

    mi spiego meglio il cookie sul mio pc non c'è in quanto non l'ho scritto e perchè ho cancellato tutti i cookies quindi A è diverso da "stadioradio" quindi case =1
    ma di fatto i due file inclusi non mi rimandano nella sezione login,

  10. #10
    UP!

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.