?? vote.htm
字號:
<HTML>
<HEAD>
<TITLE>
Voting Page
</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<SERVER>
//get the voter uid
var user = client.user;
var voteConn = null; // voting db connection
// get the connection
// name connection for debugging purposes
// set server timeout to 10 seconds
voteConn = project.appPool.connection("checkVoters",10);
if (voteConn == null)
{
write('<font color="#ff0000">Error: Unable to connect to database</FONT>');
}
// all registered voters should be pre-populated into the database
// build the cursor to handle results
sql = "SELECT voter.uid, voter.hasvoted FROM voter WHERE (voter.uid = '"+ user + "')";
var voterCursor = voteConn.cursor(sql);
if (!voterCursor.next())
{
write('<h2> No voter found matching: ' + user + '</h2>');
client.user = "";
//here we allow the user to try again
// in a real application, something should at least logged
write('<A HREF="login.htm">Try again</A>');
}
// we got a "real" voter
else
{
// check to see if they have voted yet
// we don't want any ballot stuffing ;)
if ( voterCursor.hasvoted == 1)
{
write('<h2> voter: '+ user + ' has voted</h2>');
//again we should do better error handling
write('<A HREF="login.htm">Try again</A>');
}
else
{
//okay you can vote!
//first close the cursor
voterCursor.close();
//next release current connection
voteConn.release();
// now the user can go to the voting booth
redirect("ballot.htm");
}
}
</SERVER>
</BODY>
</HTML>>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -