Clan [+35] Forum
Clan [+35] Forum
[+35] Hovedkvarter | Profil | Tilmeld | Aktive emner | Forummedlemmer | S�gning | FAQ
 Alle fora
 Computere
 [+35].Net
 Poll system

Note: Du skal være tilmeldt for at skrive indlæg.
Tilmeld dig her. Tilmelding er gratis!

Skærmstørrelse:
Brugernavn:
Kodeord:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Tekst:

* HTML er slået FRA
* Forum-koder er slået TIL
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

E M N E    VISNING
[+35]Jumpman Posted - 11 Jul 2011 : 14:55:41
En der kan ændre koden i denne så den kan kører via mysql istedet for access database database navn kunne være vote_deathcam

<%
'Two varibles are passed into the db
'u_input is the value if the user entered a response to
'the vote/poll question....IP is the address of the user
u_input=request.form("u_input")
u_ip=request.servervariables("remote_addr")

' if the user did not enter anything in the poll on this visit
' then display the poll question and possible choices
if u_input = "" then
%>
<form method="post" action="<%= request.servervariables("script_name") %>">
<p>Skal man kun kunne se sit hold eller skal man se begge hold med deathcam på FFA ?<br>
<input type="radio" value="1" name="u_input" checked >Man skal kun se sit eget hold<br>
<input type="radio" value="2" name="u_input">Man skal se begge hold<br>
<input type="submit" value="Submit" ></p>
</form>
<%
else
' if the user did input a choice on the vote/ballot
' check to see if their ip address is already in the db
' if the directory your .asp page is in does not have user
' write authority the accessdb variable and access db may
' need to be moved to your /cgi-bin/ directory and add that to the code below
accessdb="deathcam"
cn="driver={Microsoft Access Driver (*.mdb)};"
cn=cn & "dbq=" & server.mappath(accessdb)
set rs = server.createobject("ADODB.Recordset")
sql = "select ip from ballot where ip ='" & u_ip & "'"

rs.Open sql, cn
if rs.eof then
' if the user has not voted previously indicate it
been_here_before="No"
end if
rs.close

if been_here_before = "No" then
' Since the user has not voted previously their input
' their vote will be added to the db
sql = "insert into ballot (ip, selection" & u_input &") "
sql = sql & "values ('" & u_ip & "',1)"
rs.Open sql, cn
end if

'This will summerize and count the records in the db
sql= "select distinctrow "
sql= sql & "sum(selection1) as sum_selection1, "
sql= sql & "sum(selection2) as sum_selection2, "
sql= sql & "count(*) AS total_votes "
sql= sql & "FROM ballot;"
rs.Open sql, cn

total1=rs ("sum_selection1")
total2=rs ("sum_selection2")
count=rs ("total_votes") %>

Skal man kun kunne se sit hold eler skal man se begge hold med deathcam på FFA ?<br>
<img src="red.jpg" height="10" width="<%= formatnumber((total1/count)*100,0) %>">
<%= formatnumber((total1/count)*100,1) %>%<br> Man skal kun se sit eget hold <br>
<img src="blue.jpg" height="10" width="<%= formatnumber((total2/count)*100,0) %>">
<%= formatnumber((total2/count)*100,1) %>%<br> Man skal se begge hold <br>
Total Votes: <%= formatnumber(count,0,0) %><br> <% end if %>

Clan [+35] Forum © 2000-2002 Snitz Communications Go To Top Of Page
Tilpasset ældre læsere - vist på [:)] 0.17 sek. Snitz Forums 2000