diff --git a/Online Quiz System/WebContent/META-INF/MANIFEST.MF b/Online Quiz System/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/Online Quiz System/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/Online Quiz System/WebContent/WEB-INF/lib/mysql.jar b/Online Quiz System/WebContent/WEB-INF/lib/mysql.jar new file mode 100644 index 0000000..e9d2529 Binary files /dev/null and b/Online Quiz System/WebContent/WEB-INF/lib/mysql.jar differ diff --git a/Online Quiz System/WebContent/WEB-INF/lib/tools.jar b/Online Quiz System/WebContent/WEB-INF/lib/tools.jar new file mode 100644 index 0000000..b33179b Binary files /dev/null and b/Online Quiz System/WebContent/WEB-INF/lib/tools.jar differ diff --git a/Online Quiz System/WebContent/WEB-INF/web.xml b/Online Quiz System/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000..2143a9e --- /dev/null +++ b/Online Quiz System/WebContent/WEB-INF/web.xml @@ -0,0 +1,13 @@ + + + + bluebook + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + diff --git a/Online Quiz System/WebContent/adminduties.jsp b/Online Quiz System/WebContent/adminduties.jsp new file mode 100644 index 0000000..a41c6cd --- /dev/null +++ b/Online Quiz System/WebContent/adminduties.jsp @@ -0,0 +1,35 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + +welcome admin + + + +
+ +
+

WELCOME ADMINISTRATOR

+


+

+

+

+
+ + \ No newline at end of file diff --git a/Online Quiz System/WebContent/adminlogin.jsp b/Online Quiz System/WebContent/adminlogin.jsp new file mode 100644 index 0000000..1d594a1 --- /dev/null +++ b/Online Quiz System/WebContent/adminlogin.jsp @@ -0,0 +1,63 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + +welcome admin + + + +
+ +
+

ADMINISTRATOR LOGIN

+
+
+
+ + + + + + + + + + + + + +
User Name:
Password:
     +
+
+ + \ No newline at end of file diff --git a/Online Quiz System/WebContent/checkanswer.jsp b/Online Quiz System/WebContent/checkanswer.jsp new file mode 100644 index 0000000..efcf71d --- /dev/null +++ b/Online Quiz System/WebContent/checkanswer.jsp @@ -0,0 +1,117 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1" import="java.sql.*,vdb.*"%> + +<%! +Connection con = null; +ResultSet rs=null,rs2=null; +int marks=0; +%> +<% +System.out.println("entered checkanswer.jsp"); +String quesno=request.getParameter("ques"); +System.out.println("prev ques no:"+quesno); +String ans=request.getParameter("q"); +System.out.println("prev answer="+ans); +int teamno=Integer.parseInt(request.getParameter("teamno")); +System.out.println("Previous teamno="+teamno); +int marksperq=Integer.parseInt(session.getAttribute("marksperq").toString()); +int negscore=Integer.parseInt(session.getAttribute("negscore").toString()); +session.setAttribute("prevteam",String.valueOf(teamno)); +%> + + + + + + + +
+ +
+ + +
+ + +<% +try +{ + con=Db.connect(); + System.out.println("set team status=no"); + String q1="update teams set status='no' where teamname="+teamno; + Db.update(con,q1); + //get prev marks of team + System.out.println("get prev marks of team"); + String q2="select marks from teams where teamname="+teamno; + rs=Db.getSelected(con,q2); + if(rs.next())//if team exists + { + //get marks + marks=rs.getInt(1); + System.out.println("prev marks="+marks); + //get correct answer from db + System.out.println("get correct ans from db"); + String q3="select answer from questions where qno="+quesno; + rs2=Db.getSelected(con,q3); + if(rs2.next())//if question exists + { + //get answer + String correctans=rs2.getString(1); + System.out.println("correctanswer is="+correctans); + //compare answers + if(correctans.equals(ans)) + { + //if answer is correct + System.out.println("correct answer"); + //adding score + marks=marks+marksperq; + System.out.println("New marks="+marks); + } + else + { + //wrong answer + System.out.println("wrong answer"); + if((marks>0)&&((marks-negscore)>=0)) + { + //reducing score + System.out.println("reducing score"); + marks=marks-negscore; + } + else + { + //do nothing bcoz marks are already 0 + System.out.println("do nothing"); + } + System.out.println("New marks="+marks); + } + //now update database with new score + System.out.println("update db with new score"); + String q4="update teams set marks="+marks+",status='no' where teamname="+teamno; + Db.update(con,q4); + System.out.println("end of updation"); + %> + + <% + } + else + { + System.out.println("question not found"); + } + } + else + { + System.out.println("team not exists"); + } + +} +catch(Exception e){ + System.out.println(e); +} +System.out.println("end of checkanswer.jsp"); + %> diff --git a/Online Quiz System/WebContent/default.css b/Online Quiz System/WebContent/default.css new file mode 100644 index 0000000..1ace36e --- /dev/null +++ b/Online Quiz System/WebContent/default.css @@ -0,0 +1,404 @@ +/* +Design by Free CSS Templates +http://www.freecsstemplates.org +Released for free under a Creative Commons Attribution 2.5 License +*/ + +* { + margin: 0; + padding: 0; +} + +body { + margin: 0px; + background: #C0C0C0 url(images/img01.jpg) repeat-x left top; + text-align: justify; + font-family: Georgia, "Times New Roman", Times, serif; + font-size: 13px; + font-style: italic; + color: #7D807A; +} + +h1, h2, h3 { + color: #AA2808; +} + +h1 { +} + +h2 { +} + +h3 { +} + +p, blockquote, ul, ol { + margin-bottom: 20px; + line-height: 2em; +} + +p { +} + +blockquote { +} + +ul, ol, li { + margin: 0px; + padding: 0px; + list-style: none; +} + +a { + text-decoration: underline; + color: #E14949; +} + +a:hover { + text-decoration: none; + color: #C11414; +} + +/* Wrapper */ + +#wrapper { +} + +/* Header */ + +#header { + width: 1000px; + height: 130px; + margin: 0 auto; + background: url(images/img02.jpg) no-repeat left top; +} + +/* Logo */ + +#logo { + float: left; + width: 310px; + height: 70px; + margin: 0px; + padding-left: 30px; + text-align: center; +} + +#logo h1 { + margin: 0; + padding: 10px 0px 0px 0px; + text-transform: lowercase; + font: normal 46px Georgia, "Times New Roman", Times, serif; +} + +#logo h2 { + margin: -2px 0 0 0; + padding: 0; + text-transform: lowercase; + letter-spacing: 2px; + font-size: 12px; + font-weight: normal; + font-style: italic; + color: #FFFFFF; +} + +#logo a { + text-decoration: none; + color: #FFFFFF; +} + +/* Menu */ + +#menu { + width: 1000px; + height: 60px; + margin: 0 auto; + padding: 0px 0px 0px 0px; + background: url(images/img03.jpg) no-repeat left top; +} + +#menu ul { + margin: 0px; + padding-left: 30px; + padding-top: 6px; + list-style: none; + line-height: normal; +} + +#menu li { + display: inline; + text-align: center; +} + +#menu a { + height: 23px; + display: block; + float: left; + margin: 0px 2px 0px 0px; + padding: 3px 20px 0px 20px; + text-decoration: none; + text-align: center; + text-transform: lowercase; + font-family: Georgia, "Times New Roman", Times, serif; + font-size: 14px; + font-weight: normal; + font-style: italic; + color: #FFFFFF; +} + +#menu a:hover, #menu .active a { + background: url(images/img08.jpg) repeat-x left top; + color: #FFFFFF; +} + +/* Search */ + +#header-search { + width: 940px; + height: 51px; + margin: 0 auto; + padding: 0px 0px 0px 0px; +} + +#header-search form { + float: right; + width: 300px; + margin: 0; + padding: 12px 0px 0px 0px; +} + +#header-search fieldset { + margin: 0; + padding: 0; + border: none; +} + +#header-search-text { + width: 200px; + padding: 2px 3px; + background: #1E1E1E; + border: none; + color: #4D4D4D; +} + +#header-search-submit { + background: none; + border: none; + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + color: #E4E4E4; +} + +#search { + height: 51px; + margin: 0 auto; + padding: 0px 0px 60px 0px; +} + +#search form { + margin: 0; + padding: 12px 0px 0 0; +} + +#search fieldset { + margin: 0; + padding: 0; + border: none; +} + +#search input { + float: left; + font: 12px Arial, Helvetica, sans-serif; +} + +#search-text { + width: 160px; + height: 18px; + margin-left: 50px; + padding: 3px 0 3px 5px; + border: 1px solid #999999; + color: #000000; +} + +#search-submit { + margin-left: 10px; + padding: 4px 4px; + border: none; + background: #C11212; + font-size: 10px; + color: #FFFFFF; +} + +/* Page */ + +#page { + width: 1000px; + margin: 0 auto; + padding: 0px 0px; + background: url(images/img04.jpg) repeat-y left top; +} + +#page-bgtop { + margin: 0px; + padding: 0px 60px; + background: url(images/img06.jpg) no-repeat left top; +} + +/* Content */ + +#content { + float: left; + width: 540px; + padding-top: 30px; + padding-right: 40px; +} + +.post { + background: url(images/img04.gif) repeat-x left bottom; + margin: 0px 0px 30px 0px; + border-bottom: 1px solid #CFCAB8; +} + +.post .title { + margin: 0px; + color: #BF0B0B; +} + +.post .title a { + padding: 0px 0px 0px 0px; + letter-spacing: -1px; + text-decoration: none; + font-family: Georgia, "Times New Roman", Times, serif; + font-size: 28px; + font-weight: normal; + font-style: italic; + color: #BF0B0B; +} + +.post .entry { + padding: 20px 0px; +} + +.post img { + float: left; + padding: 15px 0px; +} + +.post .meta { + text-align: right; + padding: 0px 0 20px 0; + font-weight: bold; + color: #202020; +} + +.post .byline { + font-size: 12px; + font-style: italic; + text-transform: lowercase; + color: #7D807A; +} + +/* Sidebar */ + +#sidebar { + float: right; + width: 300px; + padding: 100px 0px 0px 0px; +} + +#sidebar ul { + margin: 0; + padding: 0; + list-style: none; + line-height: normal; +} + +#sidebar li { + margin-bottom: 1px; +} + +#sidebar li ul { + margin: 0px 0px 0px 0px; + padding: 0px 0px 40px 50px; +} + +#sidebar li li { + margin: 0; + padding: 7px 0px; + border-bottom: 1px solid #998D62; + background: none; +} + +#sidebar h2 { + height: 35px; + margin: 0px; + padding: 10px 0px 10px 50px; + background: url(images/img07.jpg) no-repeat left top; + font-family: Georgia, "Times New Roman", Times, serif; + font-size: 18px; + font-weight: normal; + font-style: italic; + color: #524B36; +} + +#sidebar h3 { + font-size: 77%; + color: #110404; +} + +#sidebar p { + margin: 0; + line-height: normal; + color: #D4C792; +} + +#sidebar a { + border: none; + text-decoration: none; + color: #4E4628; +} + +#sidebar a:hover { + text-decoration: underline; +} + +/* Submenu */ + +#submenu { +} + +/* News */ + +#news { +} + +#news a { + font-size: 85%; +} + +/* Footer */ + +#footer { + width: 1000px; + height: 100px; + margin: 0 auto; + padding: 0px; + background: url(images/img05.jpg) no-repeat left top; + color: #9C9C9C; +} + +#footer p { + margin: 0; + padding: 60px 40px; + text-align: left; + font-size: 11px; +} + +#footer a { + text-decoration: underline; + color: #808080; +} + +#footer a:hover { + text-decoration: none; +} \ No newline at end of file diff --git a/Online Quiz System/WebContent/endquiz.jsp b/Online Quiz System/WebContent/endquiz.jsp new file mode 100644 index 0000000..093381b --- /dev/null +++ b/Online Quiz System/WebContent/endquiz.jsp @@ -0,0 +1,27 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1" import="java.sql.*,vdb.*"%> + + + + + + + + + +
+ +<% +Connection con=Db.connect(); +Db.deleteTable(con,"admin"); +Db.deleteTable(con,"teams"); +%> + + + \ No newline at end of file diff --git a/Online Quiz System/WebContent/images/Thumbs.db b/Online Quiz System/WebContent/images/Thumbs.db new file mode 100644 index 0000000..12824cc Binary files /dev/null and b/Online Quiz System/WebContent/images/Thumbs.db differ diff --git a/Online Quiz System/WebContent/images/img01.jpg b/Online Quiz System/WebContent/images/img01.jpg new file mode 100644 index 0000000..6e8b419 Binary files /dev/null and b/Online Quiz System/WebContent/images/img01.jpg differ diff --git a/Online Quiz System/WebContent/images/img02.jpg b/Online Quiz System/WebContent/images/img02.jpg new file mode 100644 index 0000000..a97cca8 Binary files /dev/null and b/Online Quiz System/WebContent/images/img02.jpg differ diff --git a/Online Quiz System/WebContent/images/img03.jpg b/Online Quiz System/WebContent/images/img03.jpg new file mode 100644 index 0000000..9daa53b Binary files /dev/null and b/Online Quiz System/WebContent/images/img03.jpg differ diff --git a/Online Quiz System/WebContent/images/img04.jpg b/Online Quiz System/WebContent/images/img04.jpg new file mode 100644 index 0000000..a86ed2f Binary files /dev/null and b/Online Quiz System/WebContent/images/img04.jpg differ diff --git a/Online Quiz System/WebContent/images/img05.jpg b/Online Quiz System/WebContent/images/img05.jpg new file mode 100644 index 0000000..021a8b7 Binary files /dev/null and b/Online Quiz System/WebContent/images/img05.jpg differ diff --git a/Online Quiz System/WebContent/images/img06.jpg b/Online Quiz System/WebContent/images/img06.jpg new file mode 100644 index 0000000..08ed2f4 Binary files /dev/null and b/Online Quiz System/WebContent/images/img06.jpg differ diff --git a/Online Quiz System/WebContent/images/img07.jpg b/Online Quiz System/WebContent/images/img07.jpg new file mode 100644 index 0000000..c7f34e5 Binary files /dev/null and b/Online Quiz System/WebContent/images/img07.jpg differ diff --git a/Online Quiz System/WebContent/images/img08.jpg b/Online Quiz System/WebContent/images/img08.jpg new file mode 100644 index 0000000..cd55a53 Binary files /dev/null and b/Online Quiz System/WebContent/images/img08.jpg differ diff --git a/Online Quiz System/WebContent/index.html b/Online Quiz System/WebContent/index.html new file mode 100644 index 0000000..32c9cf5 --- /dev/null +++ b/Online Quiz System/WebContent/index.html @@ -0,0 +1,23 @@ + + + + +WELCOME + + + +
+

WELCOME TO COMPUTERIZATION OF BLUE BOOK

+


+



+ +
+ + \ No newline at end of file diff --git a/Online Quiz System/WebContent/index1.html b/Online Quiz System/WebContent/index1.html new file mode 100644 index 0000000..4ce012a --- /dev/null +++ b/Online Quiz System/WebContent/index1.html @@ -0,0 +1,130 @@ + + + + + +Woodenly by Free Css Templates + + + + + +
+ + + + +
+
+
+
+

Description

+ +
+

This isOnline Quiz Enjoy :)

+
+ +
+ + +
+

RULES

+ +
+

Curabitur tellus. Phasellus tellus turpis, iaculis in, faucibus lobortis, posuere in, lorem. Donec a ante. Donec neque purus, adipiscing id, eleifend a, cursus vel, odio. Vivamus varius justo sit amet leo. Morbi sed libero. Vestibulum blandit augue at mi. Praesent fermentum lectus eget diam. Nam cursus, orci sit amet porttitor iaculis, ipsum massa aliquet nulla, non elementum mi elit a mauris.

+
+ +
+
+ + + + + + +
+
+
+ + + +
+ + + diff --git a/Online Quiz System/WebContent/next.jsp b/Online Quiz System/WebContent/next.jsp new file mode 100644 index 0000000..af8e91d --- /dev/null +++ b/Online Quiz System/WebContent/next.jsp @@ -0,0 +1,128 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1" import="java.sql.*,vdb.*"%> + + + + + + + + + + +
+ +<%! + Connection con = null; + ResultSet rs=null; +%> +<% +System.out.println("Entered next.jsp"); +int ques=Integer.parseInt(request.getParameter("ques")); +System.out.println("prev ques no.="+ques); +ques++; +System.out.println("new q="+ques); +int team=Integer.parseInt(session.getAttribute("prevteam").toString()); +//team=Integer.parseInt(request.getParameter("team")); +System.out.println("prev team no.="+team); +team++; +System.out.println("new team="+team); +int noques=Integer.parseInt(session.getAttribute("noques").toString()); +System.out.println("noques="+noques); +int noteams=Integer.parseInt(session.getAttribute("noteams").toString()); +System.out.println("noteams"+noteams); +if(ques<=noques) +{ + System.out.println("ques<=noques.. continue quiz with q="+ques); + if(team<=noteams) + { + System.out.println("teams<=noteams.. continue with team="+team); + } + else + { + team=1; + System.out.println("teams over. New team="+team); + } +%> +
+
+

QUESTION <%=ques %>


+

TEAM <%=team %>


+ + + + +
Time Elapsed

+
+

+ + + <% + try{ + System.out.println("connecting db"); + con=Db.connect(); + String q1="update teams set status='yes' where teamname="+team; + Db.update(con,q1); + rs=Db.getSelected(con,"select * from questions where qno="+ques); + if(rs.next()) + { + %> + + + + + + + + + + + + + + + <% + } + } + catch(Exception e) + { + System.out.println(e); + } + %> + +
<%=rs.getInt(1) %>.<%=rs.getString(2) %>
<%=rs.getString(4) %>
<%=rs.getString(5) %>
<%=rs.getString(6) %>
<%=rs.getString(7) %>

+ +
+
+ +<% +} +else +{ + System.out.println("quiz over."); +%> + +<% +} +%> + + diff --git a/Online Quiz System/WebContent/nextquiz.jsp b/Online Quiz System/WebContent/nextquiz.jsp new file mode 100644 index 0000000..1f2581d --- /dev/null +++ b/Online Quiz System/WebContent/nextquiz.jsp @@ -0,0 +1,122 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1" import="java.sql.*,vdb.Db"%> + + + + + + + + + + + +
+ +<% +System.out.println("inside nextquiz.jsp"); +System.out.println("updating session"); +int newstartq=Integer.parseInt(session.getAttribute("noques").toString()); +session.setAttribute("prevnoques",String.valueOf(newstartq)); +newstartq++; +System.out.println("new start ques="+newstartq); +session.setAttribute("startques",String.valueOf(newstartq)); +int newquizno=Integer.parseInt(session.getAttribute("quiznum").toString()); +Connection con=Db.connect(); +Db.deleteTable(con,"teams"); +int oldmaxscore=Integer.parseInt(session.getAttribute("maxscore").toString()); +Db.update(con,"update admin set status='no',maxscore="+oldmaxscore+" where quizno="+newquizno); +newquizno++; +System.out.println("new quiznum="+newquizno); +session.setAttribute("quiznum",String.valueOf(newquizno)); + +%> +



+
+Enter Quiz Details +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Enter No. of teams in the quiz : " readonly>
Enter No. of questions in the quiz :
Enter marks for correct answer :
Enter marks for wrong answer :
Enter pass marks :
+    +    +    + +
+
+
+ + \ No newline at end of file diff --git a/Online Quiz System/WebContent/nonpasson.jsp b/Online Quiz System/WebContent/nonpasson.jsp new file mode 100644 index 0000000..b76a919 --- /dev/null +++ b/Online Quiz System/WebContent/nonpasson.jsp @@ -0,0 +1,87 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1" import="java.sql.*,vdb.*, javax.servlet.*"%> + + + + + + + + + + +
+ +
+ +

QUESTION 1


+

TEAM 1


+ +
Time Elapsed

+
+

+ + +<%! +Connection con = null; +ResultSet rs=null; +%> +<% +try{ + System.out.println("entered nonpasson.jsp"); + //int curq=Integer.parseInt(session.getAttribute("startques").toString()); + con=Db.connect(); + int startques=Integer.parseInt(session.getAttribute("startques").toString()); + String q1="update teams set status='yes' where teamname=1"; + Db.update(con,q1); + rs=Db.getSelected(con,"select * from questions where qno="+startques); + if(rs.next()) + { +%> + + + + + + + + + + + + + + +<% +} +} +catch(Exception e){ + System.out.println(e); +} + %> + +
<%=rs.getInt(1) %>.<%=rs.getString(2) %>
<%=rs.getString(4) %>
<%=rs.getString(5) %>
<%=rs.getString(6) %>
<%=rs.getString(7) %>

+ + +
+ + \ No newline at end of file diff --git a/Online Quiz System/WebContent/over.jsp b/Online Quiz System/WebContent/over.jsp new file mode 100644 index 0000000..b1c1ab8 --- /dev/null +++ b/Online Quiz System/WebContent/over.jsp @@ -0,0 +1,31 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + + + +
+ +
+
+

QUIZ OVER

+
+
+
+ +
+
+ + \ No newline at end of file diff --git a/Online Quiz System/WebContent/save.jsp b/Online Quiz System/WebContent/save.jsp new file mode 100644 index 0000000..9a7ea05 --- /dev/null +++ b/Online Quiz System/WebContent/save.jsp @@ -0,0 +1,90 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1" import="java.sql.*,vdb.*"%> + + + + + + + + + + +
+ +<% +System.out.println("Saving the quiz info."); +int quiznum=Integer.parseInt(session.getAttribute("quiznum").toString()); +System.out.println("quiznum from session="+quiznum); +int noteams=Integer.parseInt(request.getParameter("noteams")); +System.out.println("noteams="+noteams); +int noques=Integer.parseInt(request.getParameter("noques")); +System.out.println("noques="+noques); +int prevnoques=Integer.parseInt(session.getAttribute("prevnoques").toString()); +System.out.println("prevnoques="+prevnoques); +noques=noques+prevnoques; +System.out.println("newnoques="+noques); + int marksperq=Integer.parseInt(request.getParameter("marksperq")); +int negscore=Integer.parseInt(request.getParameter("negscore")); +int total=Integer.parseInt(request.getParameter("total")); +int passmarks=Integer.parseInt(request.getParameter("passmarks")); +int startques=Integer.parseInt(session.getAttribute("startques").toString()); +System.out.println("Saving the quiz info. in session.."); +session.setAttribute("total",String.valueOf(total)); +session.setAttribute("noques",String.valueOf(noques)); +session.setAttribute("noteams",String.valueOf(noteams)); +session.setAttribute("startques",String.valueOf(startques)); +session.setAttribute("marksperq",String.valueOf(marksperq)); +session.setAttribute("negscore",String.valueOf(negscore)); +session.setAttribute("passmarks",String.valueOf(passmarks)); +System.out.println("session set successfully.."); + +Connection con = null; +String q1="",q2=""; +%> +<% +try{ + System.out.println("Entering quiz info. in database"); + con=Db.connect(); + q1="insert into admin values("+quiznum+","+noteams+","+marksperq+","+negscore+","+noques+","+passmarks+",0,'yes')"; + Db.insert(con,q1); + System.out.println("Generating teams and their scores"); + for(int n=1;n<=noteams;n++) + { + q2="insert into teams values("+n+",0,'no')"; + Db.insert(con,q2); + } + System.out.println("end of code"); +} +catch(Exception e) +{ + System.out.println(e); +} +%> +
+
+

RULES OF QUIZ

+
+
+
+ + + + + + + + + +
1.THE TIME IS 30 SECONDS FOR EACH QUESTION.
2.UNATTEMPTED QUESTIONS ALSO CARRIES NEGATIVE MARKS.



+ +
+
+ + \ No newline at end of file diff --git a/Online Quiz System/WebContent/score.jsp b/Online Quiz System/WebContent/score.jsp new file mode 100644 index 0000000..0ed43d0 --- /dev/null +++ b/Online Quiz System/WebContent/score.jsp @@ -0,0 +1,115 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1" import="java.sql.*,vdb.*"%> + + + + + + + + + + +
+ +
+
+

SCORE BOARD

+
+
+ + + + + +<%! int maxscore=0; +Connection con=null; +%> +<% +System.out.println("Entered score.jsp"); +con=Db.connect(); +ResultSet rs=Db.getTable(con,"teams"); +while(rs.next()) +{ + %> + + + + + <% +} +%> +
TEAM NAMESCORE
<%=rs.getString(1) %><%=rs.getString(2) %>
+
+
+
+ +<% +ResultSet rs2=Db.getSelected(con,"select max(marks) from teams"); +if(rs2.next()) +{ + maxscore=rs2.getInt(1); +} +%> +

Max. score : <%=maxscore %>

+
+<% +session.setAttribute("maxscore",String.valueOf(maxscore)); +int passmarks=Integer.parseInt(session.getAttribute("passmarks").toString()); +if(maxscore>=passmarks) +{ + %> +

WINNERS FOR THIS ROUND

+
+ + + + + <% + ResultSet rs3=Db.getSelected(con,"select teamname from teams where marks>="+passmarks+" order by marks desc"); + int newteams=0; + while(rs3.next()) + { + newteams++; + %> + + <% + } + session.setAttribute("newteams",String.valueOf(newteams)); + if(newteams!=1) + { + %> +

TEAM NUMBER

<%=rs3.getInt(1) %>
+
+
+ +
+ <% + } + else + { + + } +} +else +{ + %> +

OOPS!! NO WINNERS FOR THIS ROUND

+
+
+ +
+ <% +} +%> +
+ +
+ + \ No newline at end of file diff --git a/Online Quiz System/WebContent/startquiz.jsp b/Online Quiz System/WebContent/startquiz.jsp new file mode 100644 index 0000000..892d02b --- /dev/null +++ b/Online Quiz System/WebContent/startquiz.jsp @@ -0,0 +1,107 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + + + + +
+ +<%session.setAttribute("startques","1"); %> +<%session.setAttribute("quiznum","1");%> +<%session.setAttribute("prevnoques","0");%> +



+
+Enter Quiz Details +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Enter No. of teams in the quiz :
Enter No. of questions in the quiz :
Enter marks for correct answer :
Enter marks for wrong answer :
Enter pass marks :
+    +    +    + +
+
+
+ + \ No newline at end of file diff --git a/Online Quiz System/WebContent/thanks.jsp b/Online Quiz System/WebContent/thanks.jsp new file mode 100644 index 0000000..d98b4e9 --- /dev/null +++ b/Online Quiz System/WebContent/thanks.jsp @@ -0,0 +1,35 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + + + + +
+ +
+
+

!! QUIZ DATA DELETED SUCCESSFULLY !!

+


+

+ +
+ + \ No newline at end of file diff --git a/Online Quiz System/build/classes/vdb/Db.class b/Online Quiz System/build/classes/vdb/Db.class new file mode 100644 index 0000000..e27f3e7 Binary files /dev/null and b/Online Quiz System/build/classes/vdb/Db.class differ diff --git a/Online Quiz System/src/vdb/Db.java b/Online Quiz System/src/vdb/Db.java new file mode 100644 index 0000000..5d0ea68 --- /dev/null +++ b/Online Quiz System/src/vdb/Db.java @@ -0,0 +1,117 @@ +package vdb; +import java.sql.*; +public class Db { +public static synchronized Connection connect() + { + Connection con=null; + try{ + String url = "jdbc:mysql://localhost:3306/"; + String db = "bluebook"; + String driver = "com.mysql.jdbc.Driver"; + String user = "root"; + String pass = "root"; + Class.forName(driver).newInstance(); + con = DriverManager.getConnection(url+db, user, pass); + System.out.println("Connected to database."); + } + catch(Exception e) + { + e.printStackTrace(); + } + return con; + } +public static synchronized ResultSet getTable(Connection con,String tablename) +{ + ResultSet rs=null; + try + { + PreparedStatement pst=con.prepareStatement("select * from "+tablename); + rs=pst.executeQuery(); + + } + catch (Exception e) + { + System.out.println(e); + } + System.out.println(tablename+" table retrieved successfully"); + return rs; +} +public static synchronized ResultSet getSelected(Connection con,String query) +{ + ResultSet rs=null; + try + { + PreparedStatement pst=con.prepareStatement(query); + rs=pst.executeQuery(); + } + catch (Exception e) + { + System.out.println(e); + } + System.out.println("Executing: "+query+"\nRows retrieved successfully"); + return rs; +} +public static synchronized void insert(Connection con,String query) +{ + int stat=0; + try + { + PreparedStatement pst=con.prepareStatement(query); + stat=pst.executeUpdate(); + } + catch (Exception e) + { + System.out.println(e); + } + if(stat==1) + { + System.out.println("Executing: "+query+"\ninserted successfully"); + } + else + { + System.out.println("Executing: "+query+"\ninsertion failed"); + } +} +public static synchronized void update(Connection con,String query) +{ + int stat=0; + try + { + PreparedStatement pst=con.prepareStatement(query); + stat=pst.executeUpdate(); + } + catch (Exception e) + { + System.out.println(e); + } + if(stat==1) + { + System.out.println("Executing: "+query+"\nupdated successfully"); + } + else + { + System.out.println("Executing: "+query+"\nupdation failed"); + } +} +public static synchronized void deleteTable(Connection con,String tablename) +{ + int stat=0; + try + { + PreparedStatement pst=con.prepareStatement("delete from "+tablename); + stat=pst.executeUpdate(); + } + catch (Exception e) + { + System.out.println(e); + } + if(stat==1) + { + System.out.println(tablename+" deleted successfully"); + } + else + { + System.out.println(tablename+" deletion failed"); + } +} +}