'updated_pages'

parent 415c3f40
<?php
if(!isset($_SESSION['student']))
{
header('location:'.SITEURL.'index.php?page=login');
; }
?>
\ No newline at end of file
<!--Body Starts Here-->
<div class="main">
<div class="content">
<div class="report">
<?php
if(isset($_SESSION['USERID']))
{
$student_id=$_SESSION['USERID'];
$full_name=$obj->get_fullname('tbl_student',$student_id,$conn);
echo "<h2>".$full_name."'s Result</h2>";
}
else
{
header('location:'.SITEURL.'index.php?page=logout');
}
$added_date=date('Y-m-d');
//Now Getting VAlues Based on aded date and student id
$tbl_name="tbl_result";
$where="student_id='$student_id' && added_date='$added_date'";
$query=$obj->select_data($tbl_name,$where);
$res=$obj->execute_query($conn,$query);
$sn=1;
while($row=$obj->fetch_data($res))
{
$student_id=$row['student_id'];
$question_id=$row['question_id'];
$user_answer=$row['user_answer'];
$right_answer=$row['right_answer'];
$added_date=$row['added_date'];
//Get all the question and answers detail
$tbl_name2="tbl_question";
$where2="question_id='$question_id'";
$query2=$obj->select_data($tbl_name2,$where2);
$res2=$obj->execute_query($conn,$query2);
$row2=$obj->fetch_data($res2);
$question=$row2['question'];
$first_answer=$row2['first_answer'];
$second_answer=$row2['second_answer'];
$third_answer=$row2['third_answer'];
$fourth_answer=$row2['fourth_answer'];
$fifth_answer=$row2['fifth_answer'];
$reason=$row2['reason'];
?>
<label style="font-weight: bold;"><?php echo $sn++.'. '.$question; ?></label><br />
<?php
//To get usersAnswer
switch($user_answer)
{
case 0:
{
$userAnswer="None";
}
break;
case 1:
{
$userAnswer=$first_answer;
}
break;
case 2:
{
$userAnswer=$second_answer;
}
break;
case 3:
{
$userAnswer=$third_answer;
}
break;
case 4:
{
$userAnswer=$fourth_answer;
}
break;
case 5:
{
$userAnswer=$fifth_answer;
}
break;
}
//To get rightAnswer
switch($right_answer)
{
case 0:
{
$rightAnswer="None";
}
break;
case 1:
{
$rightAnswer=$first_answer;
}
break;
case 2:
{
$rightAnswer=$second_answer;
}
break;
case 3:
{
$rightAnswer=$third_answer;
}
break;
case 4:
{
$rightAnswer=$fourth_answer;
}
break;
case 5:
{
$rightAnswer=$fifth_answer;
}
break;
}
?>
<label>Users Answer: </label>
<?php
if($userAnswer==$rightAnswer)
{
?>
<label style="color: green;"><?php echo $userAnswer; ?></label>
<?php
}
else
{
?>
<label style="color: red;"><?php echo $userAnswer; ?></label>
<?php
}
?>
<br />
<label>Correct Answer:</label><label style="color: green;"><?php echo $rightAnswer; ?></label><br />
<?php
if($reason!="")
{
echo "<div class='success'>".$reason."</div>";
}
?>
<hr />
<?php
}
?>
<a href="<?php echo SITEURL; ?>index.php?page=logout">
<button type="button" class="btn-exit">Log Out</button>
</a>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<?php
include('check.php');
//Inserting Summary Result Here
if(isset($_SESSION['totalScore']))
{
$totalScore=$_SESSION['totalScore'];
}
else
{
$totalScore=0;
}
//To get student id from student username
$tbl_name="tbl_student";
$username=$_SESSION['student'];
$student_id=$obj->get_userid($tbl_name,$username,$conn);
//to add sesult summary to the database
$added_date=date('Y-m-d');
$tbl_name2="tbl_result_summary";
$data="student_id='$student_id',
marks='$totalScore',
added_date='$added_date'
";
$query=$obj->insert_data($tbl_name2,$data);
$res=$obj->execute_query($conn,$query);
?>
<!--Body Starts Here-->
<div class="main">
<div class="content">
<div class="welcome">
<?php
if(isset($_SESSION['time_complete']))
{
echo $_SESSION['time_complete'];
}
?>
You have successfully completed the test. Thank You.<br />
<?php
$tbl_name='tbl_student';
$username=$_SESSION['student'];
//Get Student ID from username
$userid=$obj->get_userid($tbl_name,$username,$conn);
//Getting Summary Result from the database
$tbl_name3="tbl_result_summary";
$where3="student_id=$userid ORDER BY summary_id DESC LIMIT 1";
$query=$obj->select_data($tbl_name3,$where3);
$res=$obj->execute_query($conn,$query);
$row=$obj->fetch_data($res);
$marks=$row['marks'];
$added_date=date('Y-m-d');
//Calculate Marks for different faculties
$obtainedMarks=$_SESSION['totalScore'];
$full_marks=$_SESSION['full_marks'];
$obtainedPercent=($obtainedMarks/$full_marks)*100;
//Get Student ID
//Get Faculty ID from Student ID then Show full marks based on the faculty and obtained percentage
if($_SESSION['facultyName']=='GRE')
{
$marksShown=260+round($obtainedPercent*0.8);
}
elseif($_SESSION['facultyName']=='GMAT')
{
$marksShown=200+round($obtainedPercent*6);
}
else
{
$marksShown=$obtainedMarks;
}
$_SESSION['USERID']= $userid;
//Round Off Marks
$lastDigit=substr($marksShown,-1);
if($lastDigit<5)
{
$realMark=$marksShown-$lastDigit;
}
else
{
$digitToAdd=10-$lastDigit;
$realMark=$marksShown+$digitToAdd;
}
?>
You got <h2><?php echo $realMark; ?></h2>
<a href="<?php echo SITEURL; ?>index.php?page=detail_result">
<button type="button" class="btn-exit">
View Result
</button>
</a>
<a href="<?php echo SITEURL; ?>index.php?page=logout">
<button type="button" class="btn-exit">&nbsp; Log Out &nbsp;</button>
</a>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<!--Body Starts Here-->
<div class="main">
<div class="login">
<form method="post" action="">
<style type="text/css">
.img {
display: block;
margin-left: auto;
margin-right: auto;
border: 10px solid #ddd;
border-radius: 250px;
}
</style>
<img class="img"src="boy.jpg" alt="Paris" style="width:82%">
<h2>User | Log In</h2>
<?php
if(isset($_SESSION['invalid']))
{
echo $_SESSION['invalid'];
unset($_SESSION['invalid']);
}
?>
<input type="text" name="username" placeholder="Username" required="true" />
<input type="password" name="password" placeholder="Password" required="true" />
<input type="submit" name="submit" value="Log In" class="btn-go" />
<input type="reset" name="reset" value="Reset" class="btn-exit" />
</form>
<?php
if(isset($_POST['submit']))
{
//echo "CLicked";
//Get Values from forms
$username=$obj->sanitize($conn,$_POST['username']);
$password=$obj->sanitize($conn,$_POST['password']);
//Check Login
$tbl_name="tbl_student";
$where="username='$username' && password='$password' && is_active='yes'";
$query=$obj->select_data($tbl_name,$where);
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
if($count_rows>0)
{
$_SESSION['student']=$username;
$_SESSION['login']="<div class='success'>Login Successful.</div>";
header('location:'.SITEURL.'index.php?page=welcome');
}
else
{
$_SESSION['invalid']="<div class='error'>Username or Password is invalid.</div>";
header('location:'.SITEURL.'index.php?page=login');
}
}
?>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<?php
if(isset($_GET['page']))
{
$page=$_GET['page'];
}
else
{
$page='welcome';
}
switch($page)
{
case "welcome":
{
include('welcome.php');
}
break;
case "question":
{
include('question.php');
}
break;
case "login":
{
include('login.php');
}
break;
case "endSession":
{
include('endSession.php');
}
break;
case "detail_result":
{
include('detail_result.php');
}
break;
case "logout":
{
/*
if(isset($_SESSION['totalScore']))
{
$totalScore=$_SESSION['totalScore'];
}
else
{
$totalScore=0;
}
//To get student id from student username
$tbl_name="tbl_student";
$username=$_SESSION['student'];
$student_id=$obj->get_userid($tbl_name,$username,$conn);
//to add sesult summary to the database
$added_date=date('Y-m-d');
$tbl_name2="tbl_result_summary";
$data="student_id='$student_id',
marks='$totalScore',
added_date='$added_date'
";
$query=$obj->insert_data($tbl_name2,$data);
$res=$obj->execute_query($conn,$query);
*/
$tbl_name="tbl_student";
$username=$_SESSION['student'];
$student_id=$obj->get_userid($tbl_name,$username,$conn);
$res=true;
if($res==true)
{
//Setting Student Is_Active Mode to No
$tbl_name3="tbl_student";
$data3="is_active='no'";
$where3="student_id='$student_id'";
$query3=$obj->update_data($tbl_name3,$data3,$where3);
$res3=$obj->execute_query($conn,$query3);
if($res3===true)
{
session_destroy();
header('location:'.SITEURL.'index.php?page=login');
}
else
{
echo "Error";
}
}
else
{
echo "Error";
}
}
break;
default:
{
include('welcome.php');
}
break;
}
?>
\ No newline at end of file
<head>
<style>
</style>
</head>
<?php
include('check.php');
include('pages/timeCheck.php');
$tbl_name4="tbl_student";
$username=$_SESSION['student'];
$where4="username='$username'";
$query4=$obj->select_data($tbl_name4,$where4);
$res4=$obj->execute_query($conn,$query4);
if($res4==true)
{
$row4=$obj->fetch_data($res4);
$student_id=$row4['student_id'];
$first_name=$row4['first_name'];
$last_name=$row4['last_name'];
$faculty=$row4['faculty'];
$full_name=$first_name.' '.$last_name;
}
//get total time and total no. of questions based on the faculty of the student
$tbl_name_qns='tbl_class';
$where_qns="faculty_id='$faculty'";
$query_qns=$obj->select_data($tbl_name_qns,$where_qns);
$res_qns=$obj->execute_query($conn,$query_qns);
if($res_qns==true)
{
$row_qns=$obj->fetch_data($res_qns);
$faculty_name=$row_qns['faculty_name'];
$_SESSION['facultyName']=$faculty_name;
$time_duration=$row_qns['time_duration'];
$totalTime=$time_duration*60;
$qns_per_page=$row_qns['qns_per_set'];
$total_english=$row_qns['total_english'];
//echo $total_english;die();
}
if(!isset($_SESSION['strt_time']))
{
$_SESSION['strt_time']=date('h:i:s A');
}
if(!isset($_SESSION['end_time']))
{
$_SESSION['end_time']=date('h:i:s A',strtotime("+".$time_duration." minutes"));
}
?>
<!--Body Starts Here-->
<body background="<?php echo SITEURL; ?>/images/background.jpg"wdith="100%"height="100%" alt="Beyond Boundaries" title="Beyond Boundaries" />
<div class="main">
<div class="content">
User: <span class="heavy"><?php echo $full_name; ?></span>&nbsp;&nbsp;
Grade: <span class="heavy"><?php echo $faculty_name; ?></span>&nbsp;&nbsp;
Start Time: <span class="heavy"><?php echo $_SESSION['strt_time']; ?></span>&nbsp;&nbsp;
End Time: <span class="heavy"><?php echo $_SESSION['end_time']; ?></span>&nbsp;&nbsp;
<?php
//Getting Time Difference
$startTime=strtotime($_SESSION['end_time']);
$currentTime=strtotime(date('h:i:s A'));
$timeDifference=$startTime-$currentTime;
?>
<span class="timer" data-seconds-left=<?php echo $timeDifference; ?>></span>
<form method="post" action="">
<div class="welcome">
<div class="ques">
<?php
if(!isset($_SESSION['all_qns']))
{
$_SESSION['all_qns']=0;
}
if(isset($_SESSION['sn']))
{
$sn=$_SESSION['sn'];
}
else
{
$sn=0;
}
$tbl_name="tbl_question";
//Get English Questions Only
if($sn<=$total_english)
{
//New Query FOR ENGLISH
$where="is_active='yes' && category='English' && faculty='".$faculty."' && question_id NOT IN (".$_SESSION['all_qns'].")";
}
else
{
//New Query FOR MATHS
$where="is_active='yes' && category='Math' && faculty='".$faculty."' && question_id NOT IN (".$_SESSION['all_qns'].")";
}
//Get Maths Questions Only
//New Query
//$where="is_active='yes' && faculty='".$faculty."' && question_id NOT IN (".$_SESSION['all_qns'].")";
//Old Query
//$where="is_active='yes'";
$limit=1;
$query=$obj->select_random_row($tbl_name,$where,$limit);
$res=$obj->execute_query($conn,$query);
if($res==true)
{
$count_rows=$obj->num_rows($res);
if($count_rows>0)
{
$row=$obj->fetch_data($res);
$question_id=$row['question_id'];
//Check if the question is answered or not
$question=$row['question'];
$first_answer=$row['first_answer'];
$second_answer=$row['second_answer'];
$third_answer=$row['third_answer'];
$fourth_answer=$row['fourth_answer'];
$fifth_answer=$row['fifth_answer'];
$answer=$row['answer'];
$marks=$row['marks'];
$image_name=$row['image_name'];
}
else
{
//echo "Error";
header('location:'.SITEURL.'index.php?page=endSession');
}
}
//Checking ALl Answered Questions
?>
<form method="post" action="">
<!--Question Starts Here-->
<div class="left-ques">
<?php
if(!isset($_SESSION['sn']))
{
$_SESSION['sn']=1;
echo $_SESSION['sn'];
}
else
{
echo $_SESSION['sn'];
}
//Set the total number of questions per set
if($_SESSION['sn']>$qns_per_page)
{
header('location:'.SITEURL.'index.php?page=endSession');
}
?>.
<?php echo $question; ?><br />
<?php
if($image_name!="")
{
?>
<img src="<?php echo SITEURL; ?>images/questions/<?php echo $image_name; ?>" alt="beyond boundaries" />
<?php
}
?>
</div>
<!--Question Ends Here-->
<!--Answer Starts Here-->
<div class="answers">
<input type="radio" name="answer" value="1" required="true" /> <span class="radio-ans"><?php echo $first_answer; ?></span> <br />
<input type="radio" name="answer" value="2" required="true" /> <span class="radio-ans"><?php echo $second_answer; ?></span> <br />
<input type="radio" name="answer" value="3" required="true" /> <span class="radio-ans"><?php echo $third_answer; ?></span> <br />
<input type="radio" name="answer" value="4" required="true" /> <span class="radio-ans"><?php echo $fourth_answer; ?></span> <br />
<input type="radio" name="answer" value="5" required="true" /> <span class="radio-ans"><?php echo $fifth_answer; ?> <br />&nbsp;
<input type="hidden" name="question_id" value="<?php echo $question_id; ?>" />
<input type="hidden" name="right_answer" value="<?php echo $answer; ?>" />
<input type="hidden" name="marks" value="<?php echo $marks; ?>" />
</div>
<!--Answer Ends Here-->
<div class="clearfix"></div>
<!--
<?php echo $question; ?> <br /><br />
<input type="radio" name="answer" value="1" /> <span class="radio-ans"><?php echo $first_answer; ?></span> <hr />
<input type="radio" name="answer" value="2" /> <span class="radio-ans"><?php echo $second_answer; ?></span> <hr />
<input type="radio" name="answer" value="3" /> <span class="radio-ans"><?php echo $third_answer; ?></span> <hr />
<input type="radio" name="answer" value="4" /> <span class="radio-ans"><?php echo $fourth_answer; ?> <hr /><br />&nbsp;
<input type="hidden" name="question_id" value="<?php echo $question_id; ?>" />
<input type="hidden" name="right_answer" value="<?php echo $answer; ?>" />
-->
<div class="buttons">
<input type="submit" name="submit" value="Submit and Next" class="btn-go1" />
<a href="<?php echo SITEURL; ?>index.php?page=logout">
<button type="button" class="btn-exit">&nbsp; Quit &nbsp;</button>
</a>
</div>
</form>
<?php
if(isset($_POST['submit']))
{
//echo "Clicked";
//CHeck if the answer is clicked or not
//Get the details from the form
$question_id=$_POST['question_id'];
//Submitting Answers to the database
if(isset($_POST['answer']))
{
$user_answer=$obj->sanitize($conn,$_POST['answer']);
}
else
{
$user_answer=0;
}
$right_answer=$obj->sanitize($conn,$_POST['right_answer']);
$question_id=$obj->sanitize($conn,$_POST['question_id']);
$username=$_SESSION['student'];
$marks=$_POST['marks'];
//Get User ID from username
$tbl_name="tbl_student";
$student_id=$obj->get_userid($tbl_name,$username,$conn);
$added_date=date('Y-m-d');
//Now Adding Data to Database
$tbl_name="tbl_result";
$data="
student_id='$student_id',
question_id='$question_id',
user_answer='$user_answer',
right_answer='$right_answer',
added_date='$added_date'
";
//CHeck if the total score is set or not
if(isset($_SESSION['totalScore']))
{
$totalScore=$_SESSION['totalScore'];
}
else
{
$totalScore=0;
}
//Check if the full marks is set or not
if(isset($_SESSION['full_marks']))
{
$full_marks=$_SESSION['full_marks'];
}
else
{
$full_marks=0;
}
if($user_answer==$right_answer)
{
$_SESSION['totalScore']=$totalScore+$marks;
$_SESSION['full_marks']=$full_marks+$marks;
}
else
{
$_SESSION['totalScore']=$totalScore+0;
$_SESSION['full_marks']=$full_marks+$marks;
}
$query=$obj->insert_data($tbl_name,$data);
//$res=true;
$res=$obj->execute_query($conn,$query);
if($res===true)
{
//Time Validation
/*echo $current_time;
if($current_time==$current_time)
{
echo "Okey"; die();
}*/
/*$start=strtotime($current_time);
$end=strtotime($_SESSION['end_time']);
if($start>$end)
{
$_SESSION['time_complete']="<div class='error'>Your exam time has ended. Thank You.</div>";
header('location:'.SITEURL.'index.php?page=endSession');
echo "session end";die();
}*/
include('pages/timeCheck.php');
/*
if($current_time>$_SESSION['end_time'])
{
$_SESSION['time_complete']="<div class='error'>Your exam time has ended. Thank You.</div>";
header('location:'.SITEURL.'index.php?page=endSession');
}
*/
//adding all the questions in session variable
if(isset($_SESSION['all_qns']))
{
$_SESSION['all_qns']=$_SESSION['all_qns'].','.$question_id;
}
else
{
$_SESSION['all_qns']=0;
}
//Save the answer for result
if(isset($_SESSION['sn']))
{
$_SESSION['sn']=$_SESSION['sn']+1;
}
else
{
$_SESSION['sn']=1;
}
$_SESSION['qns']=$question_id;
//Redirect to the question page
header('location:'.SITEURL.'index.php?page=question');
}
else
{
echo "Error";
}
}
?>
</div>
</div>
</form>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
User-Agent: *
User-agent: Googlebot
Disallow: /cgi-bin/
Disallow: /admin/
Disallow: /assets/
\ No newline at end of file
<?php
if(isset($_SESSION['end_time']))
{
$current_time=date('h:i:s A');
$start=strtotime($current_time);
$end=strtotime($_SESSION['end_time']);
if($start>$end)
{
$_SESSION['time_complete']="<div class='error'>Your exam time has ended. Thank You.</div>";
header('location:'.SITEURL.'index.php?page=endSession');
echo "session end";die();
}
}
?>
\ No newline at end of file
<?php
include('check.php');
?>
<!--Body Starts Here-->
<div class="main">
<div class="content">
<div class="welcome">
<?php
if(isset($_SESSION['login']))
{
echo $_SESSION['login'];
unset($_SESSION['login']);
}
//Setting Time Limit Here
if(!isset($_SESSION['start_time']))
{
//$_SESSION['start_time']=
}
?>
Hello <span class="heavy"><?php echo $_SESSION['student']; ?></span>. Welcome to Test Preparation Portal.<br />
<div class="success">
<p style="text-align: left;">
Here are some of the rules and regulations of this app.<br />
1. This test is automated and you won't be able to return to previous question.<br />
2. Once you successfully login, you can't log back in unless the permission of system administrator.<br />
3. After you click on "Take a Test", the timer will start and it can't be paused or stopped.<br />
4. English questions will appear first and after you finish Englihs, you will be given Math question.
</p>
</div>
<a href="<?php echo SITEURL; ?>index.php?page=question">
<button type="button" class="btn-go">Take a Test</button>
</a>
<a href="<?php echo SITEURL; ?>index.php?page=logout">
<button type="button" class="btn-exit">&nbsp; Quit &nbsp;</button>
</a>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment