Forum 

Forum AspNuke.it - Il tuo Portale OpenSource in ASP

Sondaggi per soli iscritti

Autore Messaggio
fastroby

Amatore
Amatore
26 Discussioni



Profilo - fastroby
07 febbraio 2007 alle 02:36:13 Profilo - fastrobyInvia un messaggio privato Rispondi quotando
Qualcuno si è già posto il dilemma?
Nei post precedenti non mi sembra di aver trovato nulla a riguardo. Chiaramente il problema non è tanto proteggere l'accesso dal link del menù quanto la visualizzazione del blocco laterale quando il sondaggio diventa attivo.

Un saluto a tutti
Fastroby :)
djveleno

Amministratore

Esperto
Esperto
1025 Discussioni



Profilo - djveleno
07 febbraio 2007 alle 09:11:06 Profilo - djvelenoInvia un messaggio privato Rispondi quotando
Dalle tue richieste mi sembra che tu voglia costruire un programma blindato, dove solo gli iscritti possano visualizzare qualche cosa, mentre, i visitatori non potranno che vedere una pagina bianca!!!!
Ma quanti iscritti potrà contare il tuo portale se non darai la possibilità di vederne i contenuti?
Secondo me, faresti meglio a riflettere su causa ed effetto e poi prendere delle decisioni.
---------------
A lavare la testa ai somari, ci si rimette l'acqua e il sapone!

http://aspnuke208.somee.com/Default.asp

fastroby

Amatore
Amatore
26 Discussioni



Profilo - fastroby
08 febbraio 2007 alle 14:33:59 Profilo - fastrobyInvia un messaggio privato Rispondi quotando
La tua riflessione non fa una grinza ma il portale che sto pubblicando è indirizzato quasi esclusivamente ai soci della struttura stessa: non sarebbe carino rendere pubblico un sondaggio del genere: "vota i piedi più puzzolenti dell'ultima partita....) mentre magari i soci hanno comunque interesse nel darsi visibilità sul web.
Se mi sai indicare la strada sono tutto orecchi!

Grazie dei tuoi consigli e dei tuoi sempre rapidi interventi

Ciao
Fastroby
djveleno

Amministratore

Esperto
Esperto
1025 Discussioni



Profilo - djveleno
08 febbraio 2007 alle 15:15:03 Profilo - djvelenoInvia un messaggio privato Rispondi quotando
Nella pagina polls-inc.asp trovi 4 Sub, lasciando perdere la prima, puoi proteggere i tuoi sondaggi inserendo nelle 3 sub, appena dopo l'apertura della connessione al DB, una stringa di questo genere:

If sPseudo = "" THEN

e, prima delle chiusure di oCn e oRs:

ELSE
CreateTable "Role", "", GetTranslation "LANG_MUST_HAVE_ROLE"), ""
End If

così che, chiunque tenti di visualizzare i sondaggi riceverebbe un messaggio del tipo Non hai il ruolo richiesto.
---------------
A lavare la testa ai somari, ci si rimette l'acqua e il sapone!

http://aspnuke208.somee.com/Default.asp

fastroby

Amatore
Amatore
26 Discussioni



Profilo - fastroby
09 febbraio 2007 alle 23:40:50 Profilo - fastrobyInvia un messaggio privato Rispondi quotando
;) Grazie DJ ora provo e ti faccio sapere

Ciao
Fastroby 8)
fastroby

Amatore
Amatore
26 Discussioni



Profilo - fastroby
14 febbraio 2007 alle 01:51:55 Profilo - fastrobyInvia un messaggio privato Rispondi quotando
Niente non funge: tutto visibile anche ai non iscritti sia dal link nel menù sia la visualizzazione del blocco laterale. Se può essere di aiuto per capire dove ho commesso un errore posto il codice di "polls-inc.asp"

<%
' !!! Important !!! Don't remove this code
' Used to count any vote if valid
If Request.Form("poll") <> "" and Request.Cookies("poll_" & Request.Form("poll")) <> "OK" and Request.Form("result") <> "" Then
AddPollResult Request.Form("poll"), Request.Form("result")
End If

' Add a vote
' IN : iPollID (int) : poll's id (table polls, field pID)
' : iResultID (int) : choice's id (table pollsresults, field prID)
' OUT : -
Sub AddPollResult(iPollID, iResultID)
Dim oCn, rSQL

Set oCn = DBConnexion(DB_MAIN)

rSQL = "UPDATE pollsresults SET prHits=prHits+1 WHERE prPoll=" & iPollID & " AND prID=" & iResultID
DBExecute oCn, rSQL

Response.Cookies("poll_" & iPollID) = "OK"
Response.Cookies("poll_" & iPollID).Expires = Date+7

oCn.Close
Set oCn = Nothing
End Sub

' Display a poll
' IN : iID (int) : poll's id (table polls, field pID)
' : bIsInColumn (boolean) : change the display if poll is displayed in a column (small caps, displays a title (LANG_POLL))
' OUT : -
Sub DisplayPoll(iID, bIsInColumn)
Dim oCn, oRs, rSQL, nbVotes, MaxHits, iTdWidth, iLine, sPrefix, sPrefixSpan, sSuffixSpan, qString

Set oCn = DBConnexion(DB_MAIN)

if sPseudo = "" THEN

nbVotes = 0
MaxHits = 0
sPrefix = ""
If bIsInColumn Then
sPrefixSpan = "<span class=""small"">"
sSuffixSpan = "</span>"
Else
sPrefixSpan = ""
sSuffixSpan = ""
End If

rSQL = "SELECT Sum(prHits), Max(prHits) FROM pollsresults WHERE prPoll=" & iID
Set oRs = DBRecordSet(oCn, rSQL)

nbVotes = oRs(0)
MaxHits = oRs(1)
If MaxHits <= 0 Then
MaxHits = 1
end if
oRs.Close
Set oRs = Nothing


rSQL = "SELECT prID, pColor, pTitle, prHits, prText FROM polls, pollsresults WHERE pID=prPoll AND pValid=1 AND pID=" & iID

Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then
Response.Write " <a name=""poll_" & iID & """>" & vbCRLF
If bIsInColumn Then
CreateTopTable "poll_" & iID, GetTranslation("LANG_POLL")
sPrefix = "_"
Else
CreateTopTable "poll_" & iID, ""
End If
If Request.Cookies("poll_" & iID) = "OK" or Request.QueryString("results") <> "" Then
'Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
Response.Write "<table width=""100%"" cellspacing=""1"" cellpadding=""2"">"
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
Response.Write " <td colspan=""2"" align=""center"">" & sPrefixSpan & Server.HTMLEncode(oRs("pTitle")) & sSuffixSpan & "</td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
While Not oRs.EOF
iTdWidth = Round(100*(oRs("prHits")/MaxHits))
Response.Write " <tr>" & vbCRLF
Response.Write " <td>" & sPrefixSpan & Server.HTMLEncode(oRs("prText")) & " (" & oRs("prHits") & ")" & sSuffixSpan & "<br>" & vbCRLF
Response.Write " <table width=""100%"" cellspacing=""0"" cellpadding=""0"">" & vbCRLF
Response.Write " <tr><td width=""" & iTdWidth & "%"" bgcolor=""" & oRs("pColor") & """><img src=""" & GLOBAL_SITE_IMAGES_PATH & "space.gif"" height=""10"" border=""0""></td><td width=""" & 100-iTdWidth & "%""></td></tr>" & vbCRLF
Response.Write " </table>" & vbCRLF
Response.Write " </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF

oRs.MoveNext
WEnd
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
Response.Write " <td colspan=""2"" align=""center"">" & sPrefixSpan
If Request.QueryString("results") <> "" Then
Response.Write "<a href=""Java_Script:history.back()"">" & GetTranslation("LANG_POLL_VOTE") & "</a><br>"
End If
Response.Write GetTranslation("LANG_VOTES") & " : " & nbVotes & sSuffixSpan & "</td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write "</table>" & vbCRLF
Else
Response.Write "<_Script language=""Java_Script"" type=""text/Java_Script"">" & vbCRLF
Response.Write " var bCanVote_" & sPrefix & iID & " = false;" & vbCRLF
Response.Write " function votePoll_" & sPrefix & iID & "()" & vbCRLF
Response.Write " {" & vbCRLF
Response.Write " if (bCanVote_" & sPrefix & iID & ")" & vbCRLF
Response.Write " {" & vbCRLF
Response.Write " document.poll_" & sPrefix & iID & ".submit();" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write " function voteOk_" & sPrefix & iID & "()" & vbCRLF
Response.Write " {" & vbCRLF
Response.Write " bCanVote_" & sPrefix & iID & " = true;" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write "</_Script>" & vbCRLF
'Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
Response.Write "<table width=""100%"" cellspacing=""1"" cellpadding=""2"">"
Response.Write "<_form name=""poll_" & sPrefix & iID & """ method=""post"" action=""" & sUrlPage & """>" & vbCRLF
Response.Write "<input type=""hidden"" name=""poll"" value=""" & iID & """>" & vbCRLF
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
Response.Write " <td colspan=""2"" align=""center"">" & sPrefixSpan & Server.HTMLEncode(oRs("pTitle")) & sSuffixSpan & "</td>" & vbCRLF
Response.Write " </tr>" & vbCRLF

iLine = 1
While Not oRs.EOF
Response.Write " <tr class=""tableline" & iLine & """>" & vbCRLF
Response.Write " <td width=""25""><input type=""radio"" name=""result"" onClick=""Java_Script:voteOk_" & sPrefix & iID & "()"" value=""" & oRs("prID") & """></td>" & vbCRLF
Response.Write " <td>" & sPrefixSpan & Server.HTMLEncode(oRs("prText")) & sSuffixSpan & "</td>" & vbCRLF
Response.Write " </tr>" & vbCRLF

iLine = 1 + ((iLine-1) XOR 1)
oRs.MoveNext
WEnd
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
qString = Request.QueryString
If qString="" Then
qString = "?"
Else
qString = "?" & qString & "&"
End If
Response.Write " <td colspan=""2"" align=""center"">" & sPrefixSpan & "<a href=""Java_Script:votePoll_" & sPrefix & iID & "()"">" & GetTranslation("LANG_POLL_VOTE") & "</a>&nbsp;&nbsp;-&nbsp;&nbsp;<a href=""" & sURLPage & qString & "poll=" & iID & "&results=1"">" & GetTranslation("LANG_POLL_RESULTS") & "</a><br>" & GetTranslation("LANG_VOTES") & " : " & nbVotes & sSuffixSpan & "</td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write "</_form>" & vbCRLF
Response.Write "</table>" & vbCRLF
End If
CreateBottomTable ""
Else
CreateTable "NoPoll", GetTranslation("LANG_POLLS"), GetTranslation("LANG_EMPTY_SECTION"), ""
End If

ELSE
CreateTable "Role", "", GetTranslation ("LANG_MUST_HAVE_ROLE"), ""
End If


oRs.Close
Set oRs = Nothing
oCn.Close
Set oCn = Nothing
End Sub

' Display the top polls (by Date)
' IN : iTop (int) : number of results wanted
' OUT : -
Sub DisplayTopPolls(iTop)
Dim oCn, oRs, rSQL, iLoop

Set oCn = DBConnexion(DB_MAIN)

If sPseudo = "" THEN

If not( iTop <> "" and IsNumeric(iTop)) Then
iTop = 9999
End If
rSQL = "SELECT pID FROM polls, versions WHERE pDateBegin <= '" & DateTimeToString(Now()) & "' AND (pDateEnd >= '" & DateTimeToString(Now()) & "' OR pDateEnd < pDateBegin) AND pValid=1 AND pVersion=vID"
If sXMLVersion <> "" Then
rSQL = rSQL & " AND vCode='" & SQLEncrypt(sXMLVersion) & "'"
end if
rSQL = rSQL & " ORDER BY pDateBegin DESC, pDateEnd DESC"
Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then
iLoop = 0
While Not oRs.EOF and iLoop < iTop
DisplayPoll oRs("pID"), False
oRs.MoveNext
iLoop = iLoop + 1
WEnd
Else
CreateTable "Poll", GetTranslation("LANG_POLL"), GetTranslation("LANG_EMPTY_SECTION"), ""
End If

ELSE
CreateTable "Role", "", GetTranslation ("LANG_MUST_HAVE_ROLE"), ""
End If

oRs.Close
Set oRs = Nothing
oCn.Close
Set oCn = Nothing
End Sub

Sub DisplayLastPoll()
Dim oCn, oRs, rSQL

Set oCn = DBConnexion(DB_MAIN)

If sPseudo = "" THEN

rSQL = "SELECT pID FROM polls, versions WHERE pDateBegin <= '" & DateTimeToString(Now()) & "' AND (pDateEnd >= '" & DateTimeToString(Now()) & "' OR pDateEnd < pDateBegin) AND pValid=1 AND pVersion=vID"
If sXMLVersion <> "" Then
rSQL = rSQL & " AND vCode='" & SQLEncrypt(sXMLVersion) & "'"
end if
rSQL = rSQL & " ORDER BY pDateBegin DESC, pDateEnd DESC"
Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then
DisplayPoll oRs("pID"), True
end if

ELSE
CreateTable "Role", "", GetTranslation ("LANG_MUST_HAVE_ROLE"), ""
End If

oRs.Close
Set oRs = Nothing
oCn.Close
Set oCn = Nothing
End Sub
%>


Un saluto a tutti
Fastroby
piosky_to2003

Esperto
Esperto
2291 Discussioni



Profilo - piosky_to2003
14 febbraio 2007 alle 07:57:55 Profilo - piosky_to2003Invia un messaggio privato chat_silvio@hotmail.com Rispondi quotando
Modificato il 14 febbraio 2007 alle 08:10:28

Ma non fai prima a bloccare la visualizzazione della tabella sondaggi nella colonna laterale che a fare modifiche nelle varie procedure dei polls?

file :display-inc.asp
Procedura: Sub DisplayColumn(tColumnContent)
Linea: 804 Circa

il case 8 da

Case 8
DisplayLastPoll()

DIVENTA
Case 8
'SILVIO TABELLA POOL VISIBILE AI SOLI UTENTI
if sPseudo <>"" then
DisplayLastPoll()
else
CreateTopTable "poll", GetTranslation("LANG_POLL")
Response.write "Devi essere loggato per vedere i sondaggi"
CreateBottomTable ""
end if
p.s. rimetti il file originali che hai toccato nei post precedenti
---------------
Silvio Andrighetti Formaggini (Piosky) [lo]

http://www.roadrunners.to.it
Sito Prove
http://www.piosky.somee.com
msn : chat_silvio@hotmail.com
fastroby

Amatore
Amatore
26 Discussioni



Profilo - fastroby
14 febbraio 2007 alle 21:41:57 Profilo - fastrobyInvia un messaggio privato Rispondi quotando
Alla stregua di DJ Veleno sei proprio in gamba!!

Funziona e pure alla grande!!

Spero possa essere utile anche al resto della Community 8)

Un saluto e grazie per l'ennesimo aiuto
Fastroby [lo] [lo]
piosky_to2003

Esperto
Esperto
2291 Discussioni



Profilo - piosky_to2003
14 febbraio 2007 alle 23:30:22 Profilo - piosky_to2003Invia un messaggio privato chat_silvio@hotmail.com Rispondi quotando
Modificato il 15 febbraio 2007 alle 06:28:20

tankiuu Alla prossima :D
---------------
Silvio Andrighetti Formaggini (Piosky) [lo]

http://www.roadrunners.to.it
Sito Prove
http://www.piosky.somee.com
msn : chat_silvio@hotmail.com
blackeagle

Amatore
Amatore
43 Discussioni



Profilo - blackeagle
15 febbraio 2007 alle 00:12:11 Profilo - blackeagleInvia un messaggio privato Rispondi quotando
Ciao ho fatto le stesse modifiche suggerite da piosky per far vedere i sondaggi solo agli iscritti, ma a me succede una strana cosa, e cioè, quando un utente non è loggato vede la scritta, devi essere loggato etc etc" ma se mi loggo la schermatia dei sondaggi mi sparisce! come mai?
Ciao
---------------
Si Vis Pacem Para Bellum [lo]
 1  2  >>

Log in

Login
Password
Memorizza i tuoi dati:

Cerca

 

Sostieni AspNuke

Un piccolo gesto per aiutarci a mantenere AspNuke.it online

Promo

MusicWebItalia.it
Video Testi Traduzioni Spot Colonne sonore Accordi e Spartiti gratis.

Visitatori

Visitatori Correnti : 222
Membri : 0 offline Anna

Iscritti

 Utenti: 18940
Ultimo iscritto : glauco
Lista iscritti
Messaggi privati: 3373 Commenti: 2210 Immagini: 39 Downloads: 144 Articoli: 49 Pagine: 101 Siti web: 558 Notizie: 180 Sondaggi: 11 Preferiti: 5685321 Post sui forum: 51195 Libro degli ospiti: 4 Eventi: 7

Versioni

Temi