Untitled
Untitled
Untitled
in
partial fulfillment for the award
of
Degree
in
Computer Science
by
NAVANEETH KRISHNAN P
Reg. No.
CCASSCS016
under the guidance of
Mr.Linto George
Assistant Professor
Christ College(Autonomous)
Irinjalakuda
CERTIFICATE
1
ACKNOWLEDGMENT
First and foremost we like to thank lord almighty for his providence and
for being the guiding light throughout the project. We express our sincere
gratitude to our beloved Department head for giving me all the facilities for
our project
We are using this opportunity to express our gratitude to the class teacher
Ms.SINI THOMAS and head of the department Ms.VIJI VISWANATHAN
who has been supported us throughout the course of this project. We are
thankful for her aspiring guidance and valuable advice during the project
work. We extend our sincere thanks to our project guide Mr.LINTO
GEORGE, for supporting and guiding us throughout the project.
We would take this opportunity to specially thank all other faculty mem-
bers for their constant and continuous motivation. Finally we would like to
thank our family and friends for giving us valuable advice and moral support
throughout our project.
DECLARATION
We hereby declare that this project work ”QUESTRA” submitted to christ
college (Autonomous) Irinjalakuda, Affiliated to Calicut University in par-
tial fulfillment of the requirement for the award of the Bachelor of Com-
puter Science, is a record of original work done by us, under the guidance of
Mr.LINTO GEORGE, Department of computer Science.
1 Introduction 1
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 System Analysis 2
2.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1.1 Existing System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1.2 Proposed System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Problem definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 Feasibility study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3.1 Technical Feasibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3.2 Economical Feasibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3.3 Operational Feasibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.4 Module Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.4.1 Host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.4.2 User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5 System Testing 15
5.1 Unit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.2 Integration Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.3 Validation Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.4 Output Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.5 White Box Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.6 Black Box Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Appendix 20
A ER Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
B Data Flow Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
C Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
D User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Christ College(Autonomous) Questra
Chapter 1
Introduction
Questra is used to administer a quiz for school or college pupils, or this software can also be
used by the organization in the recruiting process. At first, the student must register his/her name
along with all the information required and choose the username and password for the login process.
Using this username and password to log in to the ”QUESTRA” application. The next procedure
is to answer the quiz. As soon as the student chooses the quiz menu strip, the questions with four
choices will be shown. The student must type any of the options and click on the Next button. On
this click, the next series of questions and answers will be shown. This is going to go until the end
of the issue. The admin has the right to add or change some question or alternative. The answers
to each query would be stored in the database. The resulting choice displays the marks of all the
students who replied in descending order so that the admin cab obtains the top students who can
proceed to the next round. The Admin includes the username and password for others, so that
they can verify the results in the absence of Admin, but not for pupils. The ability to check the
student’s data using the student’s login name will also be offered.
1.1 Overview
The objective of the Quiz app is to design a simple and adaptable website and mobile application
for conducting online quiz.The host can create the quiz and the user can play quiz. It provides a
unique page of mobile application for user and host.The application includes many functions such
as user registration,host registration,host login,user login and some other features.
Chapter 2
System Analysis
2.1 Purpose
This Quiz app is to help the users to prepare for necessary educational purposes regarding Computer
Science and IT field with an easy access to our app directly on their Android phones. Through our
app, users can learn and prepare themselves for interviews, tests and exams on Android phones,
and can also use this app for increasing their general knowledge about Computer Science, Verbal
and Analytical, everywhere and anytime.
Available mobile applications are very few and most of them are in dead state
User friendly interfaces: the system provides friendly graphical user interfaces with effi-
cient help and tips, which makes easier for the hosts and the user to conduct and play.
Easier access of services: the users can access the services easily by simply login to the
site..
2.4.1 Host
Host can use the system after registration.On registration,the farmer have to supply a username
and password using this username and password combination,the host can login to the system.The
host can use the system for the following puposes:
2.4.2 User
User have to install the mobile application using apk file.User fills a simple registration form in his
mobile.After registration,user can do the following activities:
Can find out available quizzes
Chapter 3
Software Requirement
Specification
3.1 Purpose
The purpose of this document is to give a detailed description of the requirements for the QUES-
TRA. It will illustrate the purpose and complete declaration for the development of the system.
It will also explain system constraints, interface and interactions with other external applications.
This document is primarily intended to be proposed to a host to conduct quiz
3.2 Scope
This is an Android based mobile application that is developed to help conducting a quiz. The
mobile application with Android Java at the front end Php-mysql at the backend, will record
product related activities in a secure manner. The concept of this quiz app system is to administer
a quiz.
Implementation planning.
System training
Validation and verification:Checks whether all the fields are filled and valid.The password
is invisible by applying dots
Destruction of hardware
Modification of software
Removal of programs.
Disclosure of information.
Threat retention.
The security measures of a computer system should be specified at an early stage in the design of
the system. During the system operation each user should understand the procedures required to
keep the system secure.
There are many possible threats to the security and integrity of any system where more than
one user is associated with the system. Software integrity has become increasingly important.
The attribute measures a system’s ability to withstand attacks, both accidental and intentional
on its security. Attacks can be made on all the three components of software: programs date and
documents.
In this project the data security, data validation checking methods are applied using a password
authentication. All the data, which is entered by the administrator, will be validated.
Library modules
By default, Android Studio displays your project files in the Android project view. This view is
organized by modules to provide quick access to your project’s key source files. All the build files
are visible at the top level under Gradle Scripts and each app module contains the following folders:
manifests: Contains the AndroidManifest.xml file.
java: Contains the Java source code files, including JUnit test code.
res: Contains all non-code resources, such as XML layouts, UI strings, and bitmap images.
Chapter 4
Design Document
4.1 Purpose
The purpose of this document is to give a design overview for the QUESTRA
4.2 Scope
To develop a description of the design of a system.
4.3 Overview
System design transforms a logical representation what the system is required to do into the physical
specification. The specifications are converted into a physical reality during the development.
Design forms a blueprint of the system and adds how the components relates to each other. The
design phase proceeds accordingly to an ordinary sequence of steps, beginning with review and
assigning of task and ending with package design. Design phase is the lifecycle phase in which the
detailed design of the system selected in the study phase is accomplished. A smooth transition
form the study phase to design is necessary because the design phase continues the activities in
the earlier phase. Simplicity is the most important criteria of design phase. The most creative
and challenging phase of the system life cycle is system design . The term design describes the
final system and the process by which it is developed. The first step in design is to determine how
the output is to be produced and in what format . Second the formats of input screens are to be
determined. The input data and the master files have to be designed to meet the requirements of
the proposed output.
4.4 Normalization
Normalization is a systematic approach of decomposing tables to eliminate data redundancy(repetition)
and undesirable characteristics like Insertion, Update and Deletion Anomalies. It is a multi-step
process that puts data into tabular form, removing duplicated data from the relation tables.
4.5 ER Diagram
Entity relational model is a high-level conceptual data model diagram. The Entity-Relation model
represents real-world entities and the relationship between them. Entity Relation Diagram (ERD)
displays the relationships of entity set stored in a database.
The various process involved in between the interaction of two or more entities in the system
are clearly pointed out.
The various data stores, which hold the data in between the processes are clearly identified.
4.7 Tables
user table
Name DataType Constraints
user id int(11) Primarykey
user email address varchar(250) Notnull
user password varchar(150) Notnul
user verificatioon code varchar(100) Notnull
user name varchar(150) Notnull
user gender enum Notnull
user address text Notnull
user mobile no varchar(30) Notnull
user image varchar(150) Notnul
user created on datetime Notnull
user email verified enum Notnull
host table
Name DataType Constraints
user id int(11) Primarykey
user email address varchar(250) Notnull
user password varchar(150) Notnul
user verification code varchar(100) Notnull
user name varchar(150) Notnull
user gender enum Notnull
user address text Notnull
user mobile no varchar(30) Notnull
user image varchar(150) Notnull
user created on datetime Notnull
user email verified enum Notnull
question table
Name DataType Constraints
qno mediumint(9) Notnull
question text Notnull
choice1 text Notnull
choice2 text Notnull
choice3 text Notnull
choice4 text Notnull
answer text Notnull
programme varchar(50) Notnull
batch int(20) Notnull
scores
Name DataType Constraints
id int(10) Primarykey
username varchar(40) Notnull
regno varchar(30) Notnul
programme varchar(30) Notnull
total varchar(30) Notnull
Chapter 5
System Testing
Software testing is a critical element of software quality assurance and represents the ultimate
review of specification ,design and coding. Testing represents an interesting anomaly or the software.
Testing is vital to the success of the system. Errors can be injected at any state during development.
System testing makes a logical assumption that all the part of the system is correct,the goal will
be successfully achieved. During testing the program to be tested is executed with set of data and
the output of the program for the test data is evaluated to determine if the program is performing
as expected. A series of testing are performed for the proposed system before the system is ready
for user acceptance testing.
Chapter 6
6.1 Maintenance
The maintenance phase of the software cycle is the time in which a software product forms useful
work. After a system is successfully implemented, it should be maintained in a proper manner.
System maintenance is an important aspect in the software development life cycle. The need for
maintenance is to make it adaptable to the changes in the environment. There may be social,
technical, and other environmental changes, which effects a system to be implemented. Software
produce enhancement that may provide new functional capabilities, improving administrator dis-
plays and mode of interaction, upgrading the performance characteristics of the system. So only
through proper system maintenance procedures, the system can be adapted to cop up with these
changes. Software maintenance is of course far more than “Finding mistakes”. We may define
maintenance by describing four activities. Those are undertaken after a program is released for use.
The first maintenance activity occurs because it is unreasonable to assume that software testing will
uncover all latent errors in a large software system. During the use of any large program, errors will
occur and be reported to the developer. The process that include that the diagnosis and correction
of one or more errors is called corrective maintenance. The second activity that contributes to a
definition of maintenance occurs because of the rapid change that is encountered in every aspects
of computing. Therefore adaptive maintenance is an activity that modifies software interface with
a changing environment is so common. After a system is successfully implemented, it should be
maintained in a proper manner. System maintenance is performing to make the system adaptable
to the changing environment.
Interruption of communication
Destruction of hardware
Modification of software
Removal of programs.
Disclosure of information.
Threat retention.
The security measures of a computer system should be specified at an early stage in the design of
the system. During the system operation each user should understand the procedures required to
keep the system secure.
There are many possible threats to the security and integrity of any system where more than
one user is associated with the system. Software integrity has become increasingly important.
The attribute measures a system’s ability to withstand attacks, both accidental and intentional
on its security. Attacks can be made on all the three components of software: programs date and
documents.
In this project the data security, data validation checking methods are applied using a password
authentication. All the data, which is entered by the administrator, will be validated.
Chapter 7
7.1 Conclusion
A large number of participants, with instant results of your online quiz (for the creator as well as
the participants), a better overview, you’re able to randomize your questions and set a timer. That
all without the need of an instructor. What’s holding you back to not use online quizzes?
Appendix
A ER Diagram
Figure 1: ER diagram
Figure 2: Level 0
C Code
Index
<?php
//index.php
include(’master/Examination.php’);
include(’header.php’);
?>
<div class="containter">
<br />
<br />
<br />
<br />
<br />
<br />
<?php
if(isset($_SESSION["user_id"]))
{
?>
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<select name="exam_list" id="exam_list" class="form-control input-lg">
<option value="">Select Exam</option>
<?php
echo $exam->Fill_exam_list();
?>
</select>
<br />
<span id="exam_details"></span>
</div>
<div class="col-md-3"></div>
</div>
<script>
$(document).ready(function(){
$(’#exam_list’).parsley();
$(’#exam_list’).change(function(){
$(’#exam_list’).attr(’required’, ’required’);
if($(’#exam_list’).parsley().validate())
{
exam_id = $(’#exam_list’).val();
$.ajax({
url:"user_ajax_action.php",
method:"POST",
data:{action:’fetch_exam’, page:’index’, exam_id:exam_id},
success:function(data)
{
$(’#exam_details’).html(data);
}
});
}
});
url:"user_ajax_action.php",
method:"POST",
data:{action:’enroll_exam’, page:’index’, exam_id:exam_id},
beforeSend:function()
{
$(’#enroll_button’).attr(’disabled’, ’disabled’);
$(’#enroll_button’).text(’please wait’);
},
success:function()
{
$(’#enroll_button’).attr(’disabled’, false);
$(’#enroll_button’).removeClass(’btn-warning’);
$(’#enroll_button’).addClass(’btn-success’);
$(’#enroll_button’).text(’Enroll success’);
}
});
});
});
</script>
<?php
}
else
{
?>
<div align="center">
<p><a href="register.php" class="btn btn-warning btn-lg">Register</a></p>
<p><a href="login.php" class="btn btn-dark btn-lg">Login</a></p>
<p><a href="hostregister.php" class="btn btn-dark btn-lg">Host Access</a></p>
</div>
<?php
}
?>
<br />
<br />
<br />
<br />
<br />
<br />
</div>
</div>
</body>
</html>
Android
"mainactivity.xml"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="110dp"
android:layout_centerInParent="true"
android:orientation="vertical">
<android.widget.Button
android:layout_width="match_parent"
android:layout_height="55dp"
android:text="Host"
android:gravity="center"
android:background="@drawable/buttonshape"
android:textColor="@color/orange"
android:textSize="20dp"
android:id="@+id/hostselection"
/>
<android.widget.Button
android:layout_width="match_parent"
android:layout_height="55dp"
android:text="Participant"
android:layout_marginTop="30dp"
android:gravity="center"
android:textColor="@color/orange"
android:background="@drawable/buttonshape"
android:textSize="20dp"
android:id="@+id/participantselection"
/>
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_height="50dp"
android:src="@drawable/logo"
android:layout_marginBottom="35dp"
></ImageView>
</RelativeLayout>
"MAINACTIVITY.JAVA"
package com.example.questra;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import java.util.Random;
Button host,participant;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
host=findViewById(R.id.hostselection);
participant=findViewById(R.id.participantselection);
host.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this, Webview.class);
startActivity(intent);
}
});
participant.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this, Webview.class);
startActivity(intent);
}
});
}
"WEBVIEW.XML"
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
"WEBVIEW.JAVA"
package com.example.questra;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
WebView w;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview);
w = findViewById(R.id.webview);
@Override
public void onBackPressed() {
if (w.canGoBack()){
w.goBack();
} else {
super.onBackPressed();
}
}
}
Admin Login
<?php
//login.php
include(’master/Examination.php’);
$exam->user_session_public();
include(’header.php’);
?>
<div class="container">
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6" style="margin-top:100px;">
<span id="message">
<?php
if(isset($_GET[’verified’]))
{
echo ’
<div class="alert alert-success">
Verified The Details
</div>
’;
}
?>
</span>
<div class="card">
<div class="card-header"> Login</div>
<div class="card-body">
<form method="post" id="user_login_form">
<div class="form-group">
<label>Enter Email Address</label>
<input type="text" name="user_email_address"
id="user_email_address" class="form-control" />
</div>
<div class="form-group">
<label>Enter Password</label>
<input type="password" name="user_password"
id="user_password" class="form-control" />
</div>
<div class="form-group">
<input type="hidden" name="page" value="adminlogin" />
<input type="hidden" name="action" value="adminlogin" />
<input type="submit" name="user_login" id="user_login"
class="btn btn-info" value="Login" />
</div>
</form>
<div align="center">
</div>
</div>
</div>
</div>
<div class="col-md-3">
</div>
</div>
</div>
</body>
</html>
<script>
$(document).ready(function(){
$(’#user_login_form’).parsley();
$(’#user_login_form’).on(’submit’, function(event){
event.preventDefault();
$(’#user_email_address’).attr(’required’, ’required’);
$(’#user_password’).attr(’required’, ’required’);
if($(’#user_login_form’).parsley().validate())
{
$.ajax({
url:"user_ajax_action.php",
method:"POST",
data:$(this).serialize(),
dataType:"json",
beforeSend:function()
{
$(’#user_login’).attr(’disabled’, ’disabled’);
$(’#user_login’).val(’please wait...’);
},
success:function(data)
{
if(data.success)
{
location.href=’adminindex.php’;
}
else
{
$(’#user_login’).attr(’disabled’, false);
$(’#user_login’).val(’Login’);
}
})
}
});
});
</script>
Admin Index
<?php
//index.php
include(’header1.php’);
?>
Register
<?php
//register.php
include(’master/Examination.php’);
$exam->user_session_public();
include(’header.php’);
?>
<div class="containter">
<div class="d-flex justify-content-center">
<br /><br />
<div class="card" style="margin-top:50px;margin-bottom: 100px;">
<div class="card-header"><h4>User Registration</h4></div>
<div class="card-body">
<span id="message"></span>
<form method="post" id="user_register_form">
<div class="form-group">
<label>Enter Email Address</label>
<input type="text" name="user_email_address"
id="user_email_address" class="form-control"
data-parsley-checkemail data-parsley-checkemail-message=
’Email Address already Exists’ />
</div>
<div class="form-group">
<label>Enter Password</label>
<input type="password" name="user_password"
id="user_password" class="form-control" />
</div>
<div class="form-group">
<label>Enter Confirm Password</label>
<input type="password" name="confirm_user_password"
id="confirm_user_password" class="form-control" />
</div>
<div class="form-group">
<label>Enter Name</label>
<input type="text" name="user_name" id="user_name"
class="form-control" />
</div>
<div class="form-group">
<label>Select Gender</label>
<select name="user_gender" id="user_gender"
class="form-control">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
<div class="form-group">
<label>Enter Address</label>
<textarea name="user_address" id="user_address"
class="form-control"></textarea>
</div>
<div class="form-group">
<br />
<div class="form-group" align="center">
<input type="hidden" name=’page’ value=’register’ />
<input type="hidden" name="action" value="register" />
<input type="submit" name="user_register" id="user_register"
class="btn btn-info" value="Register" />
</div>
</form>
<div align="center">
<a href="login.php">Login</a>
</div>
</div>
</div>
<br /><br />
<br /><br />
</div>
</div>
</body>
</html>
<script>
$(document).ready(function(){
window.ParsleyValidator.addValidator(’checkemail’, {
validateString: function(value){
return $.ajax({
url:’user_ajax_action.php’,
method:’post’,
data:{page:’register’, action:’check_email’, email:value},
dataType:"json",
async: false,
success:function(data)
{
return true;
}
});
}
});
$(’#user_register_form’).parsley();
$(’#user_register_form’).on(’submit’, function(event){
event.preventDefault();
$(’#user_email_address’).attr(’required’, ’required’);
$(’#user_email_address’).attr(’data-parsley-type’, ’email’);
$(’#user_password’).attr(’required’, ’required’);
$(’#confirm_user_password’).attr(’required’, ’required’);
$(’#confirm_user_password’).attr(’data-parsley-equalto’, ’#user_password’);
$(’#user_name’).attr(’required’, ’required’);
$(’#user_address’).attr(’required’, ’required’);
$(’#user_mobile_no’).attr(’required’, ’required’);
$(’#user_mobile_no’).attr(’data-parsley-pattern’, ’^[0-9]+$’);
if($(’#user_register_form’).parsley().validate())
{
$.ajax({
url:’user_ajax_action.php’,
method:"POST",
data:new FormData(this),
dataType:"json",
contentType:false,
cache:false,
processData:false,
beforeSend:function()
{
$(’#user_register’).attr(’disabled’, ’disabled’);
$(’#user_register’).val(’please wait...’);
},
success:function(data)
{
if(data.success)
{
$(’#message’).html(’<div class="alert alert-success">
Please check your email</div>’);
$(’#user_register_form’)[0].reset();
$(’#user_register_form’).parsley().reset();
}
$(’#user_register’).attr(’disabled’, false);
$(’#user_register’).val(’Register’);
}
})
}
});
});
</script>
Host Register
<?php
//register.php
include(’master/Examination.php’);
$exam->user_session_public();
include(’header.php’);
?>
<div class="containter">
<div class="d-flex justify-content-center">
<br /><br />
<div class="card" style="margin-top:50px;margin-bottom: 100px;">
<div class="card-header"><h4>Host Registration</h4></div>
<div class="card-body">
<span id="message"></span>
<br />
<div class="form-group" align="center">
<input type="hidden" name=’page’ value=’hostregister’ />
<input type="hidden" name="action" value="hostregister" />
</body>
</html>
<script>
$(document).ready(function(){
$(’#host_register_form’).parsley();
$(’#host_register_form’).on(’submit’, function(event){
event.preventDefault();
$(’#user_email_address’).attr(’required’, ’required’);
$(’#user_email_address’).attr(’data-parsley-type’, ’email’);
$(’#user_password’).attr(’required’, ’required’);
$(’#confirm_user_password’).attr(’required’, ’required’);
$(’#confirm_user_password’).attr(’data-parsley-equalto’, ’#user_password’);
$(’#user_name’).attr(’required’, ’required’);
$(’#user_address’).attr(’required’, ’required’);
$(’#user_mobile_no’).attr(’required’, ’required’);
$(’#user_mobile_no’).attr(’data-parsley-pattern’, ’^[0-9]+$’);
if($(’#host_register_form’).parsley().validate())
{
$.ajax({
url:’user_ajax_action.php’,
method:"POST",
data:new FormData(this),
dataType:"json",
contentType:false,
cache:false,
processData:false,
beforeSend:function()
{
$(’#host_register’).attr(’disabled’, ’disabled’);
$(’#host_register’).val(’please wait...’);
},
success:function(data)
{
if(data.success)
{
$(’#message’).html(’<div class="alert alert-success">Success</div>’);
$(’#host_register_form’)[0].reset();
$(’#host_register_form’).parsley().reset();
}
$(’#host_register’).attr(’disabled’, false);
$(’#host_register’).val(’Register’);
}
})
}
});
});
</script>
DB Connection
<?php
$objConnect = mysqli_connect("localhost","grapeste_root",
"gopi1234","grapeste_mydatabase") or die("connection error".mysqli_error());
//$objDB = mysql_select_db("grapeste_mydatabase") or
die("error in selection".mysql_error());
?>
Login
<?php
//login.php
include(’master/Examination.php’);
$exam->user_session_public();
include(’header.php’);
?>
<div class="container">
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6" style="margin-top:100px;">
<span id="message">
<?php
if(isset($_GET[’verified’]))
{
echo ’
<div class="alert alert-success">
Your email has been verified, now you can login
</div>
’;
}
?>
</span>
<div class="card">
<div class="card-header">User Login</div>
<div class="card-body">
<form method="post" id="user_login_form">
<div class="form-group">
<label>Enter Email Address</label>
<input type="text" name="user_email_address"
id="user_email_address" class="form-control" />
</div>
<div class="form-group">
<label>Enter Password</label>
<input type="password" name="user_password"
id="user_password" class="form-control" />
</div>
<div class="form-group">
<input type="hidden" name="page" value="login" />
<input type="hidden" name="action" value="login" />
<input type="submit" name="user_login"
id="user_login" class="btn btn-info" value="Login" />
</div>
</form>
<div align="center">
<a href="register.php">Register</a>
</div>
</div>
</div>
</div>
<div class="col-md-3">
</div>
</div>
</div>
</body>
</html>
<script>
$(document).ready(function(){
$(’#user_login_form’).parsley();
$(’#user_login_form’).on(’submit’, function(event){
event.preventDefault();
$(’#user_email_address’).attr(’required’, ’required’);
$(’#user_email_address’).attr(’data-parsley-type’, ’email’);
$(’#user_password’).attr(’required’, ’required’);
if($(’#user_login_form’).parsley().validate())
{
$.ajax({
url:"user_ajax_action.php",
method:"POST",
data:$(this).serialize(),
dataType:"json",
beforeSend:function()
{
$(’#user_login’).attr(’disabled’, ’disabled’);
$(’#user_login’).val(’please wait...’);
},
success:function(data)
{
if(data.success)
{
location.href=’index.php’;
}
else
{
$(’#message’).html(’<div class="alert alert-danger">’+data.error+’
</div>’);
}
$(’#user_login’).attr(’disabled’, false);
$(’#user_login’).val(’Login’);
}
})
}
});
});
</script>
Profile
<?php
//profile.php
include(’master/Examination.php’);
$exam->user_session_private();
include(’header.php’);
$exam->query = "
SELECT * FROM user_table
WHERE user_id = ’".$_SESSION[’user_id’]."’
";
$result = $exam->query_result();
?>
<div class="containter">
<div class="d-flex justify-content-center">
<br /><br />
<span id="message"></span>
<div class="card" style="margin-top:50px;margin-bottom: 100px;">
<div class="card-header"><h4>Profile</h4></div>
<div class="card-body">
<form method="post" id="profile_form">
<?php
foreach($result as $row)
{
?>
<script>
$(document).ready(function(){
$(’#user_gender’).val("<?php echo $row["user_gender"]; ?>");
});
</script>
<div class="form-group">
<label>Enter Name</label>
<input type="text" name="user_name" id="user_name" class="form-control"
value="<?php echo $row["user_name"]; ?>" />
</div>
<div class="form-group">
<label>Select Gender</label>
<select name="user_gender" id="user_gender" class="form-control">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
<div class="form-group">
<label>Enter Address</label>
<textarea name="user_address" id="user_address" class="form-control">
<?php echo $row["user_address"]; ?></textarea>
</div>
<div class="form-group">
<label>Enter Mobile Number</label>
<input type="text" name="user_mobile_no" id="user_mobile_no"
class="form-control" value="<?php echo $row["user_mobile_no"]; ?>" />
</div>
<div class="form-group">
<label>Select Profile Image - </label>
<input type="file" name="user_image" id="user_image"
accept="image/*" /><br />
<img src="upload/<?php echo $row["user_image"]; ?>"
class="img-thumbnail" width="250" />
<input type="hidden" name="hidden_user_image"
value="<?php echo $row["user_image"]; ?>" />
</div>
<br />
<div class="form-group" align="center">
<input type="hidden" name="page" value="profile" />
<input type="hidden" name="action" value="profile" />
<input type="submit" name="user_profile" id="user_profile"
class="btn btn-info" value="Save" />
</div>
<?php
}
?>
</form>
</div>
</div>
<br /><br />
<br /><br />
</div>
</div>
</body>
</html>
<script>
$(document).ready(function(){
$(’#profile_form’).parsley();
$(’#profile_form’).on(’submit’, function(event){
event.preventDefault();
$(’#user_name’).attr(’required’, ’required’);
$(’#user_address’).attr(’required’, ’required’);
$(’#user_mobile_no’).attr(’required’, ’required’);
$(’#user_mobile_no’).attr(’data-parsley-pattern’, ’^[0-9]+$’);
//$(’#user_image’).attr(’required’, ’required’);
$(’#user_image’).attr(’accept’, ’image/*’);
if($(’#profile_form’).parsley().validate())
{
$.ajax({
url:"user_ajax_action.php",
method:"POST",
data: new FormData(this),
dataType:"json",
contentType: false,
cache: false,
processData:false,
beforeSend:function()
{
$(’#user_profile’).attr(’disabled’, ’disabled’);
$(’#user_profile’).val(’please wait...’);
},
success:function(data)
{
if(data.success)
{
location.reload(true);
}
else
{
$(’#message’).html(’<div class="alert alert-danger">’+data.error+’</div>’);
}
$(’#user_profile’).attr(’disabled’, false);
$(’#user_profile’).val(’Save’);
}
});
}
});
});
</script>
Logout
<?php
//logout.php
session_start();
session_destroy();
header(’location:login.php’);
?>
Header
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet"
href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src=
"https://cdn.jsdelivr.net/gh/guillaumepotier/[email protected]/dist/parsley.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src=
"https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src=
"https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
<link rel="stylesheet" href="style/style.css" />
<link rel="stylesheet" href="style/TimeCircles.css" />
<script src="style/TimeCircles.js"></script>
</head>
<body>
<div class="jumbotron text-center" style="margin-bottom:0; padding: 1rem 1rem;">
<img src="master/logo.png" class="img-fluid" width="300"
alt="Online Examination System in PHP" />
</div>
<?php
if(isset($_SESSION[’user_id’]))
{
?>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<a class="navbar-brand" href="index.php">User Side</a>
<button class="navbar-toggler" type="button"
data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="enroll_exam.php">Enroll Exam</a>
</li>
<li class="nav-item">
<a class="nav-link" href="view_exam0.php">Start Exam</a>
</li>
<li class="nav-item">
<a class="nav-link" href="profile.php">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="change_password.php">Change Password</a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php">Logout</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<?php
}
?>
Header1
<?php
session_start();
?>
<html lang="en">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet"
href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js">
</script>
<script src=
"https://cdn.jsdelivr.net/gh/guillaumepotier/[email protected]/dist/parsley.js">
</script>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src=
"https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src=
"https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
<link rel="stylesheet" href="style/style.css" />
<link rel="stylesheet" href="style/TimeCircles.css" />
<script src="style/TimeCircles.js"></script>
</head>
<body>
<div class="jumbotron text-center" style="margin-bottom:0; padding: 1rem 1rem;">
<img src="master/logo.png" class="img-fluid" width="300"
alt="Online Examination System in PHP" />
</div>
<?php
if(isset($_SESSION[’user_id’]))
{
?>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<a class="navbar-brand" href="index.php">Scheduler Side</a>
<button class="navbar-toggler" type="button"
data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="scheduleexam.php">Schedule Exam</a>
</li>
<li class="nav-item">
<a class="nav-link" href="schedulequestions.php">Add Questions</a>
</li>
<li class="nav-item">
<a class="nav-link" href="listquestions.php">List All</a>
</li>
<li class="nav-item">
<a class="nav-link" href="setstatus.php">Manage Exam</a>
</li>
<li class="nav-item">
<a class="nav-link" href="listenrolled.php">Enrolled List</a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php">Logout</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<?php
}
?>
Change Password
<?php
//change_password.php
include(’master/Examination.php’);
$exam->user_session_private();
include(’header.php’);
?>
<div class="containter">
<div class="d-flex justify-content-center">
<br /><br />
</body>
</html>
<script>
$(document).ready(function(){
$(’#change_password_form’).parsley();
$(’#change_password_form’).on(’submit’, function(event){
event.preventDefault();
$(’#user_password’).attr(’required’, ’required’);
$(’#confirm_user_password’).attr(’required’, ’required’);
$(’#confirm_user_password’).attr(’data-parsley-equalto’, ’#user_password’);
if($(’#change_password_form’).parsley().validate())
{
$.ajax({
url:"user_ajax_action.php",
method:"POST",
data:$(this).serialize(),
dataType:"json",
beforeSend:function()
{
$(’#change_password’).attr(’disabled’, ’disabled’);
$(’#change_password’).val(’please wait...’);
},
success:function(data)
{
if(data.success)
{
alert(data.success);
location.reload(true);
}
$(’#change_password’).attr(’disabled’, false);
$(’#change_password’).val(’Change’);
}
})
}
});
});
</script>
Schedule Exam
"mainactivity.xml"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="110dp"
android:layout_centerInParent="true"
android:orientation="vertical">
<android.widget.Button
android:layout_width="match_parent"
android:layout_height="55dp"
android:text="Host"
android:gravity="center"
android:background="@drawable/buttonshape"
android:textColor="@color/orange"
android:textSize="20dp"
android:id="@+id/hostselection"
/>
<android.widget.Button
android:layout_width="match_parent"
android:layout_height="55dp"
android:text="Participant"
android:layout_marginTop="30dp"
android:gravity="center"
android:textColor="@color/orange"
android:background="@drawable/buttonshape"
android:textSize="20dp"
android:id="@+id/participantselection"
/>
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_height="50dp"
android:src="@drawable/logo"
android:layout_marginBottom="35dp"
></ImageView>
</RelativeLayout>
"MAINACTIVITY.JAVA"
package com.example.questra;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import java.util.Random;
Button host,participant;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
host=findViewById(R.id.hostselection);
participant=findViewById(R.id.participantselection);
host.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this, Webview.class);
startActivity(intent);
}
});
participant.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this, Webview.class);
startActivity(intent);
}
});
}
"WEBVIEW.XML"
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
"WEBVIEW.JAVA"
package com.example.questra;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
WebView w;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview);
w = findViewById(R.id.webview);
@Override
public void onBackPressed() {
if (w.canGoBack()){
w.goBack();
} else {
super.onBackPressed();
}
}
}
Schedule Questions
<?php
//register.php
$objConnect = mysqli_connect("localhost","grapeste_root",
"gopi1234","grapeste_mydatabase") or die("connection error".mysql_error());
// $objDB = mysql_select_db("grapeste_mydatabase") or
die("error in selection".mysql_error());
include(’header1.php’);
$logged=$_SESSION[’user_id’];
?>
<div class="containter">
<div class="d-flex justify-content-center">
<br /><br />
<div class="card" style="margin-top:50px;margin-bottom: 100px;">
<div class="card-header"><h4>Exam Schedule Addition</h4></div>
<div class="card-body">
<span id="message"></span>
<form method="post" id="user_register_form"
action="addchoiceprocess.php">
<div class="form-group">
<label>Enter Exam ID</label>
<select name="examtitle">;
<?php
while($throw_nurse_name = mysqli_fetch_array($fetch_nurse_name)) {
echo ’<option value=’.$throw_nurse_name[0].’>’.$throw_nurse_name[0].’</option>’;
}
echo "</select>";
?>
</div>
<div class="form-group">
<label>Enter Level</label>
<select name="level">
<option value="1">1</option>
<option value="4">2</option>
<!--<option value="3">3</option>-->
<!--<option value="4">4</option>-->
</select>
</div>
<div class="form-group">
<label>Enter Question Title</label>
</div>
<br />
<div class="form-group" align="center">
<input type="hidden" name=’page’ value=’examregister’ />
<input type="hidden" name="action" value="examregister" />
<input type="submit" name="user_register" id="user_register"
class="btn btn-info" value="Add Choices" />
</div>
</form>
<div align="center">
</div>
</div>
</div>
<br /><br />
<br /><br />
</div>
</div>
</body>
</html>
$b=$_POST[’examtitle’];
$d=$_POST[’qtitle’];
$e=$_POST[’o1’];
$f=$_POST[’o2’];
$g=$_POST[’o3’];
$h=$_POST[’o4’];
$i=$_POST[’c’];
$title1=1;
$title2=2;
$title3=3;
$title4=4;
$level=$_POST[’level’];
$status="created";
$objConnect = mysqli_connect("localhost","grapeste_root","gopi1234",
"grapeste_mydatabase") or die("connection error".mysql_error());
// $objDB = mysql_select_db("grapeste_mydatabase") or
die("error in selection".mysql_error());
// if($b=="4")
if($level=="4")
{
$q1="insert into level4(question,option1,option2,answer,programme,level)
values(’$d’,’$e’,’$f’,’$i’,’$b’,’$level’)";
}
else
{
$q1="insert into m1(question,choice1,choice2,choice3,choice4,answer,programme,batch)
values(’$d’,’$e’,’$f’,’$g’,’$h’,’$i’,’$b’,’$level’)";
}
$rr=mysqli_query($objConnect,$q1) or
die("query error: ".mysqli_error($objConnect));
if($rr) {
?>
<script language="javascript">alert(’Question added’);
window.location.replace(’adminindex.php’);</script>
<?php
}
else {
?>
<script language="javascript">alert(’Question adding failed’);
window.location.replace(’adminindex.php’);</script>
<?php
}
?>
List Questions
<?php
session_start();
include(’header1.php’);
$logged=$_SESSION[’logged’];
$examid=$_GET[’examtitle’];
//echo "title".$examid;
$objConnect = mysqli_connect("localhost","grapeste_root",
"gopi1234","grapeste_mydatabase") or die("connection error".mysql_error());
// $objDB = mysql_select_db("grapeste_mydatabase") or
die("error in selection".mysql_error());
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Simple Responsive Admin</title>
<!-- BOOTSTRAP STYLES-->
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<!-- FONTAWESOME STYLES-->
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<!-- CUSTOM STYLES-->
<link href="assets/css/custom.css" rel="stylesheet" />
<!-- GOOGLE FONTS-->
<link href=’http://fonts.googleapis.com/css?family=Open+Sans’
<div id="wrapper">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="adjust-nav">
<div class="navbar-header">
<button type="button" class="navbar-toggle"
data-toggle="collapse" data-target=".sidebar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">
</a>
</div>
</span>
</div>
</div>
<!-- /. NAV TOP -->
<nav class="navbar-default navbar-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav" id="main-menu">
<a href="adminindex.php">Home</a>
</ul>
</div>
</nav>
<!-- /. NAV SIDE -->
<br><br>
<div class="col-md-12">
<h2 class="text-center">QUESTIONS </h2>
<table border="1"align="center">
<tr>
<td>Question ID</td>
<td>Question Title</td>
<?php
$status1="t";
$query1="select * from m1 where programme=’$examid’ order by qno desc";
// echo $query1;
$res1=mysqli_query($objConnect,$query1) or die("error".mysqli_error());
while($row1=mysqli_fetch_array($res1))
{
$id=$row1[’qno’];
$img=$row1[’question’];
$imgname=$row1[’choice1’];
$a=$row1[’choice2’];
$b=$row1[’choice3’];
$c=$row1[’choice4’];
?>
<tr><td><?php echo $id;?></td><td><?php echo $img;?></td><td>
<?php echo $imgname;?></td><td><?php echo $a;?></td><td>
<?php echo $b;?></td><td><?php echo $c;?></td><td>
<a href="deletequestions.php?id=<?php echo $id;?>">Delete</a></td></tr>
<?php
?>
</table>
</div>
</div>
<!-- /. ROW -->
<hr />
<table border="1"align="center">
<tr>
<td>Question ID</td>
<td>Question Title</td>
<td>C1</td>
<td>C2</td>
<td>Correct Answer</td>
<td>Delete</td>
</tr>
<?php
$status1="t";
$query1="select * from level4 where programme=’$examid’
order by qno desc";
// echo $query1;
$res1=mysqli_query($objConnect,$query1) or die("error".mysqli_error());
while($row1=mysqli_fetch_array($res1))
{
$id=$row1[’qno’];
$q=$row1[’question’];
$a=$row1[’option1’];
$b=$row1[’option2’];
$answer=$row1[’answer’];
?>
<tr>
<td><?php echo $id;?></td>
<td><?php echo $q;?></td>
<td><?php echo $a;?></td>
<td><?php echo $b;?></td>
<td><?php echo $answer;?></td>
<td><a href="deletechoicequestions.php?id=<?php echo $id;?>">Delete
</a></td></tr>
<?php
?>
</table>
</div>
</div>
<!-- /. ROW -->
<hr />
</div>
<div class="footer">
<div class="row">
<div class="col-lg-12" >
</div>
</div>
</div>
</body>
</html>
Delete Questions
<?php
$objConnect = mysql_connect("localhost",
"grapeste_root","gopi1234") or die("connection error".mysql_error());
$objDB = mysql_select_db("grapeste_mydatabase") or
die("error in selection".mysql_error());
$id=$_GET[’id’];
$q0="delete from m1 where qno=’$id’";
mysql_query($q0);
?>
<script language="javascript">alert(’Deleted’);
window.location.replace(’adminindex.php’)</script>
Enroll Exam
<?php
//enroll_exam.php
include(’master/Examination.php’);
$exam->user_session_private();
$exam->Change_exam_status($_SESSION[’user_id’]);
include(’header.php’);
$logged=$_SESSION[’user_id’];
$objConnect = mysql_connect("localhost","grapeste_root","gopi1234")
or die("connection error".mysql_error());
$objDB = mysql_select_db("grapeste_mydatabase")
or die("error in selection".mysql_error());
?>
<br />
<div class="card">
<div class="card-header">Online Exam List</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover"
id="exam_data_table">
<thead>
<tr>
<th>Exam Title</th>
<th>Date & Time</th>
<th>Duration</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<?php
$status1="t";
$query1="select * from user_exam_enroll_table where user_id=’$logged’";
echo "inside".$query1;
$res1=mysql_query($query1) or die("error".mysql_error());
while($row=mysql_fetch_array($res1))
{
$examid=$row[’exam_id’];
$q0="select * from online_exam_table where online_exam_id=’$examid’";
$res2=mysql_query($q0) or die("error".mysql_error());
echo "inside".$q0;
while($row1=mysql_fetch_array($res2))
{
$id=$row1[’online_exam_title’];
$img=$row1[’online_exam_datetime’];
$imgname=$row1[’online_exam_duration’];
$a=$row1[’online_exam_status’];
$b=$row1[’choice3’];
$c=$row1[’choice4’];
?>
<tr><td><?php echo $id;?></td><td><?php echo $img;?></td><td>
<?php echo $imgname;?></td><td><?php echo $a;?></td><td>
<a href="view_exam0.php?id=<?php echo $id;?>">Start</a></td></tr>
<?php
?>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
Delete Enrolled
<?php
$objConnect = mysql_connect("localhost","grapeste_root","gopi1234")
or die("connection error".mysql_error());
$objDB = mysql_select_db("grapeste_mydatabase")
or die("error in selection".mysql_error());
$id=$_GET[’id’];
$q0="delete from user_exam_enroll_table where user_id=’$id’";
mysql_query($q0);
?>
<script language="javascript">alert(’Deleted’);
window.location.replace(’adminindex.php’)</script>
View Exam
<?php
$objConnect = mysqli_connect("localhost","grapeste_root","gopi1234",
"grapeste_mydatabase") or
die("connection error".mysqli_error());
// $objDB = mysql_select_db("grapeste_mydatabase") or
die("error in selection".mysql_error());
//error_reporting(E_ALL ^ E_NOTICE);
session_start();
$username=$_SESSION[’user_id’];
//$username=$_GET[’user_id’];
$bat=1;
$_SESSION[’username’]=$username;
echo $username;
//$batch=$_SESSION[’batch’];
$pro=$_GET[’programme’];
$_SESSION[’pro1’]=$pro;
$pro1=$_SESSION[’pro1’];
//$batch=$_SESSION[’batch’];
//rogramme=$_SESSION[’programme’];
//echo "logged".$username;
//echo "session".$SESSION[’’]
$stati="started";
$sqll="select * from online_exam_table where online_exam_status!=’$stati’ and
online_exam_title=’$pro’";
$resultl=mysqli_query($objConnect,$sqll)
or die(’error in selection’.mysqli_error());
if($ll=mysqli_fetch_array($resultl))
{
?>
<script>window.location.replace(’errorpage.html’);</script>
<?php
}
//$objConnect = mysqli_connect("localhost","root","","satdb") or
die("connection error".mysql_error());
//$objDB = mysql_select_db("satdb") or die("error in selection".mysql_error());
$q0="delete from answers where user=’$username’";
mysqli_query($objConnect,$q0);
//error_reporting(0);
$page=$_GET[’page’];
//echo "page is".$page;
if($page==""||$page==NULL||$page=="0")
{
$page=0;
}
$_SESSION["page_" . $page][’usr’]=$_SESSION[’username’];
$_SESSION["page_" . $page][’sb’]="l";
$tablename=$_SESSION["page_" . $page][’sb’];
$_SESSION["page_" . $page][’usr’];
$_SESSION["page_" . $page][’sb’];
//echo "ff".$table;
$totalscore=10;
$_SESSION["page_" . $page][’useranswer’]=$_POST[’answer’];
echo "answer".$_POST[’answer’];
}
$answer=$row[’answer’];
?>
<html>
<head>
<meta charset="utf-8">
<title>Exam</title>
<meta name="author" content="webzclub" />
<meta name="audience" content="all" />
<link href="style/css.css" rel="stylesheet" type="text/css">
<script>
var myVar;
function myFunction() {
myVar = setTimeout(alertFunc,1200000);
}
function alertFunc() {
alert("Your time has finished!!!!!");
window.location.replace(’examindex.php’);
}
</script>
</head>
<body class="header_style" onload="myFunction()">
<form name="attendexam" action="" method="post"><b>
<br><br><br>
<?php
$prevpage=$npage=$page;
if($prevpage!=0)
{
--$prevpage;
?>
<?php
}
?>
<a href="view_exam0.php?page=<?php echo $prevpage;?>
&tab=&username=<?php echo $username;?>
&batch=<?php echo $bat;?>&programme=<?php echo $pro1;?>">
<img src="previous.jpg" width="150"></a>
<?php
if($npage<=$totalscore)
{
$npage++;
?>
<?php
}
?>
<a href="view_exam0.php?page=<?php echo $npage ;?>&tab=&username=<?php
echo $username;?>
&batch=<?php echo $bat;?>&programme=<?php echo $pro1;?>">
<img src="next.jpg" width="150"></a>
<input type="hidden" value="<?php echo $page;?>" name="hpage">
</div>
</div>
</b>
</form>
</body>
</html>
<?php
if($page==$totalscore)
{
echo "page:".$page;
echo "score:".$totalscore;
?>
<?php
}
if($page==$totalscore)
{
$page=0;
?>
<!--<center><a href="examindex.php?username=<?php echo $_SESSION[’username’];?>">
<b>logout</b></a></center>-->
<?php
for($i=0;$i<$totalscore;$i++)
{
$sql2 = "select * from m1 where programme=’$pro’ order by qno LIMIT $page,1";
//echo "query".$sql2;
$r2=mysqli_query($objConnect,$sql2)or die(’errorr in’.mysqli_error());
if($row=mysqli_fetch_array($r2))
{
$ca=$row[’answer’];
// echo "correct answer".$ca;
$question=$row[’alt3’];
$ua= $_SESSION["page_" . $page][’useranswer’];
//echo "user answer".$ua;
$page++;
$a= $_SESSION["page_" . 0][’usr’];
$b=$_SESSION["page_" . 0][’sb’];
$batch=$_SESSION[’batch’];
$programme=$_SESSION[’programme’];
$regno=$_SESSION[’regno’];
$sql = "INSERT INTO ‘answers‘(questionid,user,subject,userans,realans,batch,
programme,regno)
VALUES (’$i’,’$username’,’$b’,’$ua’,’$ca’,’$batch’,’$programme’,’$regno’)";
//echo "query".$sql;
$r=mysqli_query($objConnect,$sql) or die(mysqli_error());
}
}
$total=0;
// $username=$_GET[’register’];
// echo $username;
$sqll="select * from answers where user=’$username’ and regno=’$regno’";
$resultl=mysqli_query($objConnect,$sqll)
or die(’error in selection’.mysqli_error());
while($ll=mysqli_fetch_array($resultl))
{
if($ll[’userans’]==$ll[’realans’])
{$total++;
}
}
$sqll = "INSERT INTO ‘scores‘(username,regno,programme,total)
VALUES (’$username’,’$regno’,’$programme’,’$total’)";
//echo "query".$sql;
$rl=mysqli_query($objConnect,$sqll) or die(mysqli_error());
echo "ds";
?>
<script language="javascript">
window.location.replace(’viewresult.php?id=<?php echo $username;?>
&&program=<?php echo $pro;?>’)</script>
<?php
// header(’location:viewresult.php?username=’.$_SESSION[’username’].’’);
}
?>
Result
<?php
session_start();
$objConnect = mysqli_connect("localhost","grapeste_root","gopi1234",
"grapeste_mydatabase") or die("connection error".mysqli_error());
// $objDB = mysql_select_db("grapeste_mydatabase")
or die("error in selection".mysql_error());
$username=$_GET[’username’];
$batch=$_GET[’batch’];
echo $username;
echo "<table border=’2’>
<tr>
<td>Question Number</td>
<td>User Answer</td>
<td>Correct Answer</td>
<td>Status</td>
</tr>";
$sqls = "select totalscore from admin";
$rs=mysqli_query($objConnect,$sqls)
or die(’errorr in’.mysqli_error());
$rows=mysqli_fetch_array($rs);
$totalscore=$rows[’totalscore’];
$sql="select * from answers where user=’$username’ order by batch asc";
$result=mysqli_query($objConnect,$sql) or die(’error in selection’.mysqli_error());
$score=0;
while($line=mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>";
echo $line[’questionid’];
echo "</td>";
echo "<td>";
echo $line[’userans’];
echo "</td>";
echo "<td>";
echo $line[’realans’];
echo "</td>";
if($line[’userans’]==$line[’realans’])
{$status="Correct";
$score++;
}
else
{$status="wrong";
}
echo "<td>";
echo $status;
echo "</td>";
}
echo "<tr><td><b>Score</td><td>$score;</b></td></tr></table>";
?>
//pdf_exam_result.php
include(’master/Examination.php’);
require_once(’class/pdf.php’);
if(isset($_GET["code"]))
{
$exam_id = $exam->Get_exam_id($_GET["code"]);
$exam->query = "
SELECT * FROM question_table
INNER JOIN user_exam_question_answer
ON user_exam_question_answer.question_id = question_table.question_id
WHERE question_table.online_exam_id = ’$exam_id’
AND user_exam_question_answer.user_id = ’".$_SESSION["user_id"]."’
";
$result = $exam->query_result();
$output = ’
<h3 align="center">Exam Result</h3>
<table width="100%" border="1" cellpadding="5" cellspacing="0">
<tr>
<th>Question</th>
<th>Your Answer</th>
<th>Answer</th>
<th>Result</th>
<th>Marks</th>
</tr>
’;
$total_mark = 0;
foreach($result as $row)
{
$exam->query = "
SELECT * FROM option_table
WHERE question_id = ’".$row["question_id"]."’
";
$sub_result = $exam->query_result();
$user_answer = ’’;
$orignal_answer = ’’;
$question_result = ’’;
if($row["marks"] == ’0’)
{
$question_result = ’Not Attend’;
}
$output .= ’
<tr>
<td>’.$row["question_title"].’</td>
’;
foreach($sub_result as $sub_row)
{
if($sub_row["option_number"] == $row["user_answer_option"])
{
$user_answer = $sub_row["option_title"];
}
if($sub_row["option_number"] == $row["answer_option"])
{
$orignal_answer = $sub_row["option_title"];
}
}
$output .= ’
<td>’.$user_answer.’</td>
<td>’.$orignal_answer.’</td>
<td>’.$question_result.’</td>
<td>’.$row["marks"].’</td>
</tr>
’;
}
$exam->query = "
SELECT SUM(marks) as total_mark FROM user_exam_question_answer
WHERE user_id = ’".$_SESSION[’user_id’]."’
AND exam_id = ’".$exam_id."’
";
$marks_result = $exam->query_result();
foreach($marks_result as $row)
{
$output .= ’
<tr>
<td colspan="4" align="right">Total Marks</td>
<td align="right">’.$row["total_mark"].’</td>
</tr>
’;
}
$output .= ’</table>’;
$pdf->set_paper(’letter’,’landscape’);
$pdf->loadHtml($output);
$pdf->render();
?>
D User Interfaces