Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 14
  1. #1
    Utente bannato
    Registrato dal
    Oct 2003
    Messaggi
    217

    Impedire apertura pagina ad utenti non registrati

    Salve a tutti
    eccomi qui con un'altro problemino (ino ino) per il mio e-commerce.
    Allora, vorrei creare una funzioncina che impedisca agli utenti non registrati di consultare il catalogo: una funzione del genere sul forum del sistema di e-commerce esiste, ed è qst:
    codice:
    <%
    If Session("Rivenditore") = True Then
    %>
    <p align="center">
    	<%=TitoloRPrezzo%>:
    
    <%=SimboloValuta%> <font color="red"><%=VisualizzaPrezzo(RS("RPrezzo"))%></font>
    <%=Replace(IvaNonCompresa, "[iva]", RS("IVA"))%><font color="#FF0000">
    
    <% Else %> User non abilitato alla visualizzazione dei 
                        prezzi. Registrati o effettua il 
     Log In
    
    <%
    					End If
    %> </font>
    ma non funzia anche se appare il messaggio di errore, i prezzi si possono consultare lo stesso

    come posso risolvere? :master:

    Grazie a tutti


  2. #2
    quella che hai postato è tutta la pag?
    Purtroppo bisogna imparare che il computer non sbaglia...fa solo quello che gli dici di fare

    www.netpolaris.it

  3. #3
    1) nel codice che hai postato

    <%
    End If
    %> </font>

    il tag /font deve entrare nell'else perchè ne fa parte, se no non è che succede niente però l'html generato è giusto
    per quanto riguarda il malfunzionamento dello script: lo script non permette di visualizzare un prezzo, forse hai dimenticato di mettere nell'if anche gli altri?
    ...Ignorance is bliss...

  4. #4
    Utente bannato
    Registrato dal
    Oct 2003
    Messaggi
    217
    Originariamente inviato da Shagrat
    quella che hai postato è tutta la pag?
    no, è la parte di codice che mi hanno suggerito nel forum del sistema e-commerce per non far visualizzare i prezzi agli utenti non iscritti
    devo postare tutta la pagina?

    Originariamente inviato da seafarer
    1) nel codice che hai postato

    <%
    End If
    %> </font>

    il tag /font deve entrare nell'else perchè ne fa parte, se no non è che succede niente però l'html generato è giusto
    per quanto riguarda il malfunzionamento dello script: lo script non permette di visualizzare un prezzo, forse hai dimenticato di mettere nell'if anche gli altri?
    non l'ho fatto io il codice.

    a me serve che il catalogo non sia visualizzato dagli utenti non iscritti, e (come detto prima) sul forum del sistema di e-commerce mi hanno suggerito quel codice.
    allora, visto che tale codice impedisce la visualizzazzione di un solo prezzo, come posso fare per inibire la visualizzazzione dell'intero catalogo??

    Grazie

  5. #5
    si, posta tutto così vediamo che si può fare, magari evdenzia anch quello che non vuoi che venga visualizzato
    Purtroppo bisogna imparare che il computer non sbaglia...fa solo quello che gli dici di fare

    www.netpolaris.it

  6. #6
    Utente bannato
    Registrato dal
    Oct 2003
    Messaggi
    217
    Originariamente inviato da Shagrat
    si, posta tutto così vediamo che si può fare, magari evdenzia anch quello che non vuoi che venga visualizzato
    allora, il fatto è piuttosto complesso: mi hanno detto di modificare il file inc_catalogo.asp , che è questo
    codice:
    	
    
    
    <%
    '---Dichiarazione variabili
    	Dim SQL, RS, I, Footer, RStip, Index, ArrQuery, cIVA
    
    	If (QSSCategoria <> "") Or (QSQuery <> "") Then
    	' inizio modifiche by Supermax
    ' per visualizzare il percorso in cui ci si trova nel catalogo prodotti
    		 Dim smSQLCat, smRSCat, smscat, smcat, smdovesei
    		 
    		 if QSSCategoria <>"" then
    		 		smSQLCat = " SELECT ID, SCategoria FROM SCategorie where ID="&Cint(QSSCategoria)
    				smscat=""
    				Set smRScat = Conn.Execute(smSQLCat)
    				If Not smRSCat.EOF Then
    					 smscat=smRScat("Scategoria")
    				end if
    				smRSCat.close	
    			end if	
    			
    			if QSCategoria <>"" then
    				 smSQLCat = " SELECT * FROM Categorie  where ID="&Cint(QSCategoria)
    				 smcat=""
    				 Set smRScat = Conn.Execute(smSQLCat)
    				 If Not smRSCat.EOF Then
    				 		smcat=smRScat("Categoria")
    				 end if
    			smRSCat.close	
    			end if
    					
    			smdovesei="Sei in:"
    			
    			if smscat<>"" then
    				 smdovesei=smdovesei&" "&smscat&""
    			end if
    			
    			if smcat<>"" then
    				 smdovesei=smdovesei&"-> "&smcat&""
    			end if
    			
    			response.write(smdovesei)		
    	
    ' fine modifiche by Supermax 
    %>
    
    
    
    	<p align="justify">
    		<%=Head_Catalogo%>
    	</p>
    	
    	
    
    	<table width="100%" border="0" cellspacing="0" cellpadding="3" border="0">
    		<tr>
    			<td colspan="2" bgcolor="<%=Tabella_Colore_Titolo%>" valign="middle">
    		</td>
    		</tr>
    			<td valign="top" bgcolor="<%=Tabella_Colore_Cella%>">
    				
    
    
          <%
    	SQLCat = " SELECT ID, SCategoria FROM SCategorie "
    	Set RScat = Conn.Execute(SQLCat)
    
    	If Not RSCat.EOF Then
    		SCatArr = RScat.GetRows
    
    '---Stampo a video le scategorie ed eventuali categorie
    		If QSSCategoria <> "" Then
    			SQLCat = " SELECT ID, Categoria FROM Categorie WHERE SCategoria = " & QSSCategoria
    			Set RSCat = Conn.Execute(SQLCat)
    
    			If Not RSCat.EOF Then 
    				CatArr = RSCat.GetRows
    				BoolCategorie = True
    			Else
    				BoolCategorie = False
    			End If
    
    			RSCat.Close
    		End If
    
    		For Icat = 0 to UBound(SCatArr, 2)
    %>
         
          <%
    			If CStr(SCatArr(0,ICat)) = QSSCategoria Then
    				If boolCategorie Then
    					For K = 0 To UBound(CatArr,2)
    %>
          [img]<%=Path_Img%>catalogo_frecciadx.gif[/img] 
          <%=CatArr(1,k)%> 
          
     
          <%
    					Next
    				End If
    			End If
    		Next
    	Else
    %>
          <%=NoCategoria%> 
     
          <%
    	End If
    %>
    </table>
    
    
    
    <div align="center"> </div>
    	<table border="1" width="500" cellspacing="0" cellpadding="3" align="center" bordercolor="#FFFFFF">
    		<tr> 
    			<td width="190" bgcolor="<%=Tabella_Colore_Titolo%>">
    				<color=#3A51A8><%=TitoloProdotto%>
    			</td>
    			<td width="126" bgcolor="<%=Tabella_Colore_Titolo%>">
    				<%=TitoloPFoto%>
    			</td>
    			<td width="100" bgcolor="<%=Tabella_Colore_Titolo%>">
    				<%=TitoloCPrezzo%>
    			</td>
    			<td width="50" bgcolor="<%=Tabella_Colore_Titolo%>">
    				<%=TitoloPulsante%>
    			</td>
    		</tr>
    <%
    		If (QSSCategoria = "") AND (QSCategoria = "") AND (QSQuery = "") Then
    			Response.Redirect Request.ServerVariables("HTTP_REFERER")
    		Else
    '---Stampo a video i prodotti delle categorie richieste
    			Set RS = Server.CreateObject("ADODB.RecordSet")
    			RS.PageSize = MaxProdottiPerPagina
    			
    			If QSQuery <> "" Then
    				QSQuery = Replace(QSQuery, "'", "''")
    				ArrQuery = Split(QSQuery, " ")
    				SQL = " SELECT * FROM Prodotti WHERE "
    				For i = 0 to UBound(ArrQuery, 1)
    					SQL = SQL & "(Prodotto LIKE '%" & ArrQuery(i) & "%' OR GDescrizione LIKE '%" & ArrQuery(i) & "%') AND "
    				Next
    				SQL = SQL & "Cancellato = False"
                    RS.Open SQL, Conn, 1
                    Else
    				If (QSCategoria = "") Then
    					SQL = " SELECT * FROM Prodotti WHERE SCategoria = "& [QSSCategoria] &" AND Categoria = 0  AND Cancellato = False " & " ORDER BY Clng(CPrezzo)"
    					RS.Open SQL, Conn, 1
    				End If
    	
    				If (QSCategoria <> "") Then
    					SQL = " SELECT * FROM Prodotti WHERE Categoria = "& [QSCategoria] &" AND Cancellato = False" & " ORDER BY Clng(CPrezzo)"
    					RS.Open SQL, Conn, 1
    				End If
    			End If
    
    			If Not RS.EoF Then 
    				RS.MoveFirst
    				RS.AbsolutePage = QSPg
    
    				If QSPg <> 1 Then
    					Footer = "" & PrimaPagina & " "
    				Else
    					Footer = PrimaPagina & " "
    				End If
    
    				For I = 1 To RS.PageCount
    					If I = QSPg Then
    						Footer = Footer & I & " "
    					Else
    						Footer = Footer & ""& I &" "
    					End If
    				Next
    
    				If QSPg <> RS.PageCount Then
    					Footer = Footer & "" & UltimaPagina & ""
    				Else
    					Footer = Footer & UltimaPagina
    				End If
    
    				For I = 1 To RS.PageSize
    					If RS.EOF Then Exit For
    %>
    		<tr bgcolor="<%=Tabella_Colore_Cella%>">
    			<form method="get" action="prod_aggiungi.asp">
    				<td width="190" valign="top">
    					
    
    					"><%=RS("Prodotto")%>
    <%	    
    					If  RS("Tipologia") = True Then
    %>
    					<p align="center">
    <%
    						Set RStip = Server.CreateObject("ADODB.RecordSet")
    						SQL = " SELECT * FROM Tipologie WHERE IDProdotto = "& RS("ID")
    
    						With RStip
    							.Open SQL, Conn, 1
    							If Not (.BOF And .EOF) Then
    %>
    						<select name="Tipologia">
    <%
    								Index = 1
    								Do While Not .EOF
    									If Index = 1 Then
    %>
    							<option Selected value='<%=.Collect("ID")%>'><%=.Collect("Tipologia")%>
    <%
    									Else
    %>
    							<option value='<%=.Collect("ID")%>'><%=.Collect("Tipologia")%>
    <%
    									End If
    
    									Index = Index + 1
    									.MoveNext
    								Loop
    							End If
    
    							.Close
    						End With
    
        						Set RStip = Nothing
    %>           
    						</select>
    					</p>
    <%
    					End If
    %>
    				</td>
    				<td align="center">
    					<img src="
    <%
    					If RS("PFoto") <> "" Then
    						Response.Write RS("PFoto")
    					Else
    						Response.Write Path_IMG & Img_NonDisponibile_P
    					End If
    %>
    					" width="<%=PFoto_Larghezza%>" height="<%=PFoto_Altezza%>">
    				</td>
     <%
    			  cIVA = RS("CPrezzo") / 100 * 20
    %>
    			  <td width="100" valign="top">
    				  
    <%=SimboloValuta%> <font color="red"><%=VisualizzaPrezzo(RS("CPrezzo") + cIVA)%></font>
    <%=Replace(IvaNonCompresa, "[iva]", RS("IVA"))%>
    <%
    					If Session("Rivenditore") = True Then
    %>
    				  
    
    				  
    
    				  <%=TitoloRPrezzo%>:
    				  
    <%=SimboloValuta%> <font color="red"><%=VisualizzaPrezzo(RS("RPrezzo"))%></font>
    <%=Replace(IvaNonCompresa, "[iva]", RS("IVA"))%>
    <%
    					End If
    %>
    					
    			  </td>
    				<td width="50" align="center">
    					<input type="text" name="quantita" size="2" maxlength="5" value="1">
    					<input type="hidden" name="ID" value="<%=RS("ID")%>">
    <%
    					If (RS("Giacenza") > 0) OR RS("GiacenzaInfinita") Then
    %>
    					<input type="image" src="<%=Path_Img%>catalogo_aggiungi.gif" name="Go" value="<%=AltPulsante%>" alt="<%=AltPulsante%>" border="0">
    <%
    					Else
    %>
    					[img]<%=Path_Img%>catalogo_stop.gif[/img]" border="0">
    <%
    					End If
    %>
    				</td>
    			</form>
    		</tr>
    <%
    					RS.MoveNext
    				Next
    			End If
    		End If
    		RS.Close
    %>
    	</table>
    <%
    	End If
    %>
    	<div align="center">
    		
    
            	<%=Footer%>
            </div>
    	
    
    
    		
    	</p>
    quello che non vorrei far visualizzare è l'intero catalogo (se non si è registrati o loggati), questo file basta o devo agire su qualche altro? :master:

  7. #7
    allora se ho capito bene questa pagna ti stampa il catalogo, prova a fare così:

    codice:
    	
    
    
    <%
    If Session("Rivenditore") = True Then
    '---Dichiarazione variabili
    	Dim SQL, RS, I, Footer, RStip, Index, ArrQuery, cIVA
    
    	If (QSSCategoria <> "") Or (QSQuery <> "") Then
    	' inizio modifiche by Supermax
    ' per visualizzare il percorso in cui ci si trova nel catalogo prodotti
    		 Dim smSQLCat, smRSCat, smscat, smcat, smdovesei
    		 
    		 if QSSCategoria <>"" then
    		 		smSQLCat = " SELECT ID, SCategoria FROM SCategorie where ID="&Cint(QSSCategoria)
    				smscat=""
    				Set smRScat = Conn.Execute(smSQLCat)
    				If Not smRSCat.EOF Then
    					 smscat=smRScat("Scategoria")
    				end if
    				smRSCat.close	
    			end if	
    			
    			if QSCategoria <>"" then
    				 smSQLCat = " SELECT * FROM Categorie  where ID="&Cint(QSCategoria)
    				 smcat=""
    				 Set smRScat = Conn.Execute(smSQLCat)
    				 If Not smRSCat.EOF Then
    				 		smcat=smRScat("Categoria")
    				 end if
    			smRSCat.close	
    			end if
    					
    			smdovesei="Sei in:"
    			
    			if smscat<>"" then
    				 smdovesei=smdovesei&" "&smscat&""
    			end if
    			
    			if smcat<>"" then
    				 smdovesei=smdovesei&"-> "&smcat&""
    			end if
    			
    			response.write(smdovesei)		
    	
    ' fine modifiche by Supermax 
    %>
    
    
    
    	<p align="justify">
    		<%=Head_Catalogo%>
    	</p>
    	
    	
    
    	<table width="100%" border="0" cellspacing="0" cellpadding="3" border="0">
    		<tr>
    			<td colspan="2" bgcolor="<%=Tabella_Colore_Titolo%>" valign="middle">
    		</td>
    		</tr>
    			<td valign="top" bgcolor="<%=Tabella_Colore_Cella%>">
    				
    
    
          <%
    	SQLCat = " SELECT ID, SCategoria FROM SCategorie "
    	Set RScat = Conn.Execute(SQLCat)
    
    	If Not RSCat.EOF Then
    		SCatArr = RScat.GetRows
    
    '---Stampo a video le scategorie ed eventuali categorie
    		If QSSCategoria <> "" Then
    			SQLCat = " SELECT ID, Categoria FROM Categorie WHERE SCategoria = " & QSSCategoria
    			Set RSCat = Conn.Execute(SQLCat)
    
    			If Not RSCat.EOF Then 
    				CatArr = RSCat.GetRows
    				BoolCategorie = True
    			Else
    				BoolCategorie = False
    			End If
    
    			RSCat.Close
    		End If
    
    		For Icat = 0 to UBound(SCatArr, 2)
    %>
         
          <%
    			If CStr(SCatArr(0,ICat)) = QSSCategoria Then
    				If boolCategorie Then
    					For K = 0 To UBound(CatArr,2)
    %>
           [img]<%=Path_Img%>catalogo_frecciadx.gif[/img] 
          <%=CatArr(1,k)%> 
          
     
          <%
    					Next
    				End If
    			End If
    		Next
    	Else
    %>
          <%=NoCategoria%> 
     
          <%
    	End If
    %>
    </table>
    
    
    
    <div align="center"> </div>
    	<table border="1" width="500" cellspacing="0" cellpadding="3" align="center" bordercolor="#FFFFFF">
    		<tr> 
    			<td width="190" bgcolor="<%=Tabella_Colore_Titolo%>">
    				<color=#3A51A8><%=TitoloProdotto%>
    			</td>
    			<td width="126" bgcolor="<%=Tabella_Colore_Titolo%>">
    				<%=TitoloPFoto%>
    			</td>
    			<td width="100" bgcolor="<%=Tabella_Colore_Titolo%>">
    				<%=TitoloCPrezzo%>
    			</td>
    			<td width="50" bgcolor="<%=Tabella_Colore_Titolo%>">
    				<%=TitoloPulsante%>
    			</td>
    		</tr>
    <%
    		If (QSSCategoria = "") AND (QSCategoria = "") AND (QSQuery = "") Then
    			Response.Redirect Request.ServerVariables("HTTP_REFERER")
    		Else
    '---Stampo a video i prodotti delle categorie richieste
    			Set RS = Server.CreateObject("ADODB.RecordSet")
    			RS.PageSize = MaxProdottiPerPagina
    			
    			If QSQuery <> "" Then
    				QSQuery = Replace(QSQuery, "'", "''")
    				ArrQuery = Split(QSQuery, " ")
    				SQL = " SELECT * FROM Prodotti WHERE "
    				For i = 0 to UBound(ArrQuery, 1)
    					SQL = SQL & "(Prodotto LIKE '%" & ArrQuery(i) & "%' OR GDescrizione LIKE '%" & ArrQuery(i) & "%') AND "
    				Next
    				SQL = SQL & "Cancellato = False"
                    RS.Open SQL, Conn, 1
                    Else
    				If (QSCategoria = "") Then
    					SQL = " SELECT * FROM Prodotti WHERE SCategoria = "& [QSSCategoria] &" AND Categoria = 0  AND Cancellato = False " & " ORDER BY Clng(CPrezzo)"
    					RS.Open SQL, Conn, 1
    				End If
    	
    				If (QSCategoria <> "") Then
    					SQL = " SELECT * FROM Prodotti WHERE Categoria = "& [QSCategoria] &" AND Cancellato = False" & " ORDER BY Clng(CPrezzo)"
    					RS.Open SQL, Conn, 1
    				End If
    			End If
    
    			If Not RS.EoF Then 
    				RS.MoveFirst
    				RS.AbsolutePage = QSPg
    
    				If QSPg <> 1 Then
    					Footer = "" & PrimaPagina & " "
    				Else
    					Footer = PrimaPagina & " "
    				End If
    
    				For I = 1 To RS.PageCount
    					If I = QSPg Then
    						Footer = Footer & I & " "
    					Else
    						Footer = Footer & ""& I &" "
    					End If
    				Next
    
    				If QSPg <> RS.PageCount Then
    					Footer = Footer & "" & UltimaPagina & ""
    				Else
    					Footer = Footer & UltimaPagina
    				End If
    
    				For I = 1 To RS.PageSize
    					If RS.EOF Then Exit For
    %>
    		<tr bgcolor="<%=Tabella_Colore_Cella%>">
    			<form method="get" action="prod_aggiungi.asp">
    				<td width="190" valign="top">
    					
    
    					"><%=RS("Prodotto")%>
    <%	    
    					If  RS("Tipologia") = True Then
    %>
    					<p align="center">
    <%
    						Set RStip = Server.CreateObject("ADODB.RecordSet")
    						SQL = " SELECT * FROM Tipologie WHERE IDProdotto = "& RS("ID")
    
    						With RStip
    							.Open SQL, Conn, 1
    							If Not (.BOF And .EOF) Then
    %>
    						<select name="Tipologia">
    <%
    								Index = 1
    								Do While Not .EOF
    									If Index = 1 Then
    %>
    							<option Selected value='<%=.Collect("ID")%>'><%=.Collect("Tipologia")%>
    <%
    									Else
    %>
    							<option value='<%=.Collect("ID")%>'><%=.Collect("Tipologia")%>
    <%
    									End If
    
    									Index = Index + 1
    									.MoveNext
    								Loop
    							End If
    
    							.Close
    						End With
    
        						Set RStip = Nothing
    %>           
    						</select>
    					</p>
    <%
    					End If
    %>
    				</td>
    				<td align="center">
    					<img src="
    <%
    					If RS("PFoto") <> "" Then
    						Response.Write RS("PFoto")
    					Else
    						Response.Write Path_IMG & Img_NonDisponibile_P
    					End If
    %>
    					" width="<%=PFoto_Larghezza%>" height="<%=PFoto_Altezza%>">
    				</td>
     <%
    			  cIVA = RS("CPrezzo") / 100 * 20
    %>
    			  <td width="100" valign="top">
    				  
    <%=SimboloValuta%> <font color="red"><%=VisualizzaPrezzo(RS("CPrezzo") + cIVA)%></font>
    <%=Replace(IvaNonCompresa, "[iva]", RS("IVA"))%>
    <%
    					If Session("Rivenditore") = True Then
    %>
    				  
    
    				  
    
    				  <%=TitoloRPrezzo%>:
    				  
    <%=SimboloValuta%> <font color="red"><%=VisualizzaPrezzo(RS("RPrezzo"))%></font>
    <%=Replace(IvaNonCompresa, "[iva]", RS("IVA"))%>
    <%
    					End If
    %>
    					
    			  </td>
    				<td width="50" align="center">
    					<input type="text" name="quantita" size="2" maxlength="5" value="1">
    					<input type="hidden" name="ID" value="<%=RS("ID")%>">
    <%
    					If (RS("Giacenza") > 0) OR RS("GiacenzaInfinita") Then
    %>
    					<input type="image" src="<%=Path_Img%>catalogo_aggiungi.gif" name="Go" value="<%=AltPulsante%>" alt="<%=AltPulsante%>" border="0">
    <%
    					Else
    %>
    					[img]<%=Path_Img%>catalogo_stop.gif[/img]" border="0">
    <%
    					End If
    %>
    				</td>
    			</form>
    		</tr>
    <%
    					RS.MoveNext
    				Next
    			End If
    		End If
    		RS.Close
    %>
    	</table>
    <%
    	End If
    %>
    	<div align="center">
    		
    
            	<%=Footer%>
            </div>
    	
    
     
    		
    	</p>
    <% Else %>
    User non abilitato alla visualizzazione dei prezzi.
    Registrati o effettua il 
     Log In
    
    <%
    end if
    %>
    così se c'è quella session attiva ti visualizza tutto ciò che ti serve altrimenti solo la frase alla fine...
    Purtroppo bisogna imparare che il computer non sbaglia...fa solo quello che gli dici di fare

    www.netpolaris.it

  8. #8
    Utente bannato
    Registrato dal
    Oct 2003
    Messaggi
    217
    provo subito, grazie

  9. #9
    Utente bannato
    Registrato dal
    Oct 2003
    Messaggi
    217
    perfetto, grazie

  10. #10
    di niente

    Purtroppo bisogna imparare che il computer non sbaglia...fa solo quello che gli dici di fare

    www.netpolaris.it

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.