I would like to put a simple voting program on my web page, anybody any pointers or ideas how to start and if VB is good code to do it in.?
Many thanks.
Gary
Printable View
I would like to put a simple voting program on my web page, anybody any pointers or ideas how to start and if VB is good code to do it in.?
Many thanks.
Gary
are you talking about using VBScript??
Because compiled Vb cannot be run on webpages.
Maybe someone got them some VB beta ;oP
For voting, you'll need a copy of PHP and mySQL (to replicate fairly well the vBulletin situation). That's what John uses ;). What web hosting do you have? Although if you have ASP then you can use ASP and an Access database.
I have a file in asp but must be run in cgi-bin wich i 'm not happy about, can anyone split this up.?
MANY THANKS
<%
if len(session("wahl"))=0 then
Set d= Server.CreateObject("Scripting.FileSystemObject")
Set t= d.OpenTextFile(Server.MapPath("resultat.txt"), 1, True)
ja=t.Readline
nein=t.Readline
t.Close
If Request.Form("B3")="Online" then
Set d= Server.CreateObject("Scripting.FileSystemObject")
Set t= d.OpenTextFile(Server.MapPath("resultat.txt"), 1, True)
ja=t.Readline
nein=t.Readline
t.Close
ja=ja+1
Set d= Server.CreateObject("Scripting.FileSystemObject")
Set t= d.OpenTextFile(Server.MapPath("resultat.txt"), 2, True)
t.WriteLine ja
t.WriteLine nein
t.Close
session("wahl")="Online"
End If
If Request.Form("B1")="Cheque" then
Set d= Server.CreateObject("Scripting.FileSystemObject")
Set t= d.OpenTextFile(Server.MapPath("resultat.txt"), 1, True)
ja=t.Readline
nein=t.Readline
t.Close
nein=nein+1
Set d= Server.CreateObject("Scripting.FileSystemObject")
Set t= d.OpenTextFile(Server.MapPath("resultat.txt"), 2, True)
t.WriteLine ja
t.WriteLine nein
t.Close
session("wahl")="Online"
End If
ja=int(ja)
nein=int(nein)
if ja>0 then yesa= (100/(ja+nein))*ja : end if
if nein>0 then noa= (100/(ja+nein))*nein :end if
%>
<html>
<head>
<title>Voting</title>
</head>
<div align="center">
<center>
<table border="1" width="400">
<tr>
<td width="50%" bgcolor="#000080">
<p align="center"><font color="#FFFFFF" size="3" face="Arial"><b>
WWW Poll:<br>
Would you prefer to buy on-line or by sending payment (Cheque)?</b></font>
</p>
<div align="center">
<center>
<table border="0" width="150">
<tr>
<td width="50%" align="center">
<form method="POST" action="voting.asp">
<input type="Submit" value="Online" name="B3"></p>
</form>
</td>
<td width="50%" align="center">
<form method="POST" action="voting.asp">
<input type="Submit" value="Cheque" name="B1"></p>
</form>
</td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</center>
</div>
<p align="center"><font size="3" face="Arial"><b>Results</b></font>:
<div align="center">
<center>
<table border="1" width="70">
<tr>
<td width="50%" valign="bottom" align="center" height="100" bordercolor="#FFFFFF"><img src="http://www.galemusic.com/images/ja.gif" width=20 height=<%=yesa%>></td>
<td width="50%" valign="bottom" align="center" height="100" bordercolor="#FFFFFF"><img src="http://www.galemusic.com/images/nein.gif" width=20 height=<%=noa%>></td>
</tr>
<tr>
<td width="50%" valign="top" align="center"><font face="Arial" size="2"><b>Online <br><%=ja%></b></font></td>
<td width="50%" valign="top" align="center"><font face="Arial" size="2"><b>Cheque<br><%=nein%></b></font></td>
</tr>
</table>
</center>
</div>
<p align="center"><font face="Arial" size="2"><b><a href="http://www.galemusic.com/index.htm">Continue</a></b></font></p>
</html>
<% else
response.redirect ("no.asp")
end if %>
--------------------------------------------------------
no.asp
<%
Set d= Server.CreateObject("Scripting.FileSystemObject")
Set t= d.OpenTextFile(Server.MapPath("resultat.txt"), 1, True)
ja=t.Readline
nein=t.Readline
t.Close
ja=int(ja)
nein=int(nein)
if ja>0 then yesa= (100/(ja+nein))*ja : end if
if nein>0 then noa= (100/(ja+nein))*nein :end if
%>
<html>
<head>
<title>myserver! Voting</title>
</head>
<body>
<div align="center">
<center>
<table border="1" width="400">
<tr>
<td width="50%" bgcolor="#000080">
<center><font color="#FFFFFF" size="3" face="Arial"><b>Sorry, you've voted already.<br>
</font>
</center>
</td>
</tr>
</table>
</center>
</div>
<p align="center">
<font size="3" face="Arial"><b>Current results</b></font>:
<div align="center">
<center>
<table border="1" width="70">
<tr>
<td width="50%" valign="bottom" align="center" height="100"><img src="http://www.galemusic.com/images/ja.gif" width=20 height=<%=yesa%>></td>
<td width="50%" valign="bottom" align="center" height="100"><img src="http://www.galemusic.com/images/nein.gif" width=20 height=<%=noa%>></td>
</tr>
<tr>
<td width="50%" valign="top" align="center"><font face="Arial" size="2"><b>Online <br><%=ja%></b></font></td>
<td width="50%" valign="top" align="center"><font face="Arial" size="2"><b>Cheque<br><%=nein%></b></font></td>
</tr>
</table>
</center>
</div>
<p align="center"><font face="Arial" size="2"><b><a href="http://www.galemusic.com/index.htm">continue</a></b></font></p>
</body>
</html>