'added_php_pages'

parent df9eda2c
<!--Body Starts Here-->
<div class="container">
<div class="title">Registration</div>
<div class="content">
<a href="<?php echo SITEURL; ?>admin/index.php?page=parent"><img src="../box/assets/img/unnamed.png" alt="" class="header__img"></a>
<form method="post" action="" class="forms">
<h2>Add Parent</h2>
<?php
if(isset($_SESSION['validation']))
{
echo $_SESSION['validation'];
unset($_SESSION['validation']);
}
if(isset($_SESSION['add']))
{
echo $_SESSION['add'];
unset($_SESSION['add']);
}
?>
<div class="user-details">
<div class="input-box">
<span class="details">First Name</span>
<input type="text" name="first_name" placeholder="First Name" required="true" /> <br />
</div>
<div class="input-box">
<span class="details">Last Name</span>
<input type="text" name="last_name" placeholder="Last Name" required="true" /><br />
</div>
<div class="input-box">
<span class="details">Email</span>
<input type="email" name="email" placeholder="Email Address" required="true" /><br />
</div>
<div class="input-box">
<span class="details">Username</span>
<input type="text" name="username" placeholder="Username" required="true" /><br />
</div>
<div class="input-box">
<span class="details">Password</span>
<input type="text" name="password" placeholder="Password" required="true" /><br />
</div>
<div class="input-box">
<span class="details">Contact</span>
<input type="tel" name="contact" placeholder="Contact Number" /><br />
</div>
<div class="input-box">
<span class="details">address</span>
<input type="text" name="address" placeholder="Address" required="true" /><br />
</div>
<div class="gender-details">
<input type="radio" name="gender" id="dot-1">
<input type="radio" name="gender" id="dot-2">
<input type="radio" name="gender" id="dot-3">
<span class="gender-title">Gender</span>
<div class="category">
<label for="dot-1">
<span class="dot one"></span>
<span class="gender">Male</span>
</label>
<label for="dot-2">
<span class="dot two"></span>
<span class="gender">Female</span>
</label>
</div>
</div>
<br><br>
<br><br>
<br><br>
<div class="button"><input type="submit" name="submit" value="Add Parent"/>
</form>
</div>
</div>
<?php
if(isset($_POST['submit']))
{
//Getting Values from the form
$first_name=$obj->sanitize($conn,$_POST['first_name']);
$last_name=$obj->sanitize($conn,$_POST['last_name']);
$email=$obj->sanitize($conn,$_POST['email']);
$username=$obj->sanitize($conn,$_POST['username']);
$password=$obj->sanitize($conn,$_POST['password']);
$address=$obj->sanitize($conn,$_POST['address']);
$contact=$obj->sanitize($conn,$_POST['contact']);
$added_date=date('Y-m-d');
//Backend Validation, Checking whether the input fields are empty or not
if(($first_name||$last_name||$email||$username||$password)==null)
{
//SET SSESSION Message
$_SESSION['validation']="<div class='error'>First Name or Last Name, or Email or Username or Password is Empty.</div>";
header('location:'.SITEURL.'admin/index.php?page=add_parent');
}
//Addding to the database
$tbl_name='tbl_parent';
$data="first_name='$first_name',
last_name='$last_name',
email='$email',
username='$username',
password='$password',
contact='$contact',
address='$address',
gender='$gender',
added_date='$added_date',
updated_date=''";
$query=$obj->insert_data($tbl_name,$data);
$res=$obj->execute_query($conn,$query);
if($res===true)
{
$_SESSION['add']="<div class='success'>New Parent successfully added.</div>";
header('location:'.SITEURL.'admin/index.php?page=parent');
}
else
{
$_SESSION['add']="<div class='error'>Failed to add new student. Try again.</div>";
header('location:'.SITEURL.'admin/index.php?page=add_parent');
}
}
?>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<!--Body Starts Here-->
<div class="main">
<div class="content">
<div class="report">
<form method="post" action="" class="forms" enctype="multipart/form-data">
<h2>Add Question</h2>
<?php
if(isset($_SESSION['add']))
{
echo $_SESSION['add'];
unset($_SESSION['add']);
}
if(isset($_SESSION['invalid']))
{
echo $_SESSION['invalid'];
unset($_SESSION['invalid']);
}
if(isset($_SESSION['upload']))
{
echo $_SESSION['upload'];
unset($_SESSION['upload']);
}
?>
<span class="name">Question</span> <br />
<textarea name="question" placeholder="Add Your Question" required="true"></textarea> <br />
<script>
CKEDITOR.replace( 'question' );
</script>
<span class="name">Image</span>
<input type="file" name="image" /><br />
<span class="name">First Answer</span>
<input type="text" name="first_answer" placeholder="First Answer" required="true" /><br />
<span class="name">Second Answer</span>
<input type="text" name="second_answer" placeholder="Second Answer" required="true" /><br />
<span class="name">Third Answer</span>
<input type="text" name="third_answer" placeholder="Third Answer" required="true" /><br />
<span class="name">Fourth Answer</span>
<input type="text" name="fourth_answer" placeholder="Fourth Answer" required="true" /><br />
<span class="name">Fifth Answer</span>
<input type="text" name="fifth_answer" placeholder="Fifth Answer" required="true" /><br />
<span class="name">Answer</span>
<select name="answer">
<option value="1">First Answer</option>
<option value="2">Second Answer</option>
<option value="3">Third Answer</option>
<option value="4">Fourth Answer</option>
<option value="5">Fifth Answer</option>
</select>
<br />
<span class="name">Reason</span><br />
<textarea name="reason" placeholder="Reason to be the answer"></textarea>
<script>
CKEDITOR.replace( 'reason' );
</script>
<br />
<span class="name">Marks</span>
<input type="text" name="marks" placeholder="Marks for this question" />
<br />
<span class="name">Category</span>
<select name="category">
<option value="sinhala">sinhala</option>
<option value="Math">Math</option>
<option value="parisaraya">parisaraya</option>
</select>
<br />
<span class="name">Faculty</span>
<select name="faculty">
<?php
//Get Faculties from database
$tbl_name="tbl_class";
$query=$obj->select_data($tbl_name);
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
if($count_rows>0)
{
while($row=$obj->fetch_data($res))
{
$faculty_id=$row['faculty_id'];
$faculty_name=$row['faculty_name'];
?>
<option value="<?php echo $faculty_id; ?>"><?php echo $faculty_name; ?></option>
<?php
}
}
else
{
?>
<option value="0">Uncategorized</option>
<?php
}
?>
</select>
<br />
<span class="name">Is Active?</span>
<input type="radio" name="is_active" value="yes" /> Yes
<input type="radio" name="is_active" value="no" /> No
<br />
<input type="submit" name="submit" value="Add Question" class="btn-add" style="margin-left: 15%;" />
<a href="<?php echo SITEURL; ?>admin/index.php?page=questions"><button type="button" class="btn-delete">Cancel</button></a>
</form>
<?php
if(isset($_POST['submit']))
{
//echo "Clicked";
//Managing Question Images
if($_FILES['image']['name']!="")
{
//echo "Book Cover is Available";
//Getting File Extension
$ext=end(explode('.',$_FILES['image']['name']));
//Checking if the file type is valid or not
$valid_file=$obj->check_image_type($ext);
if($valid_file==false)
{
$_SESSION['invalid']="<div class='error'>Invalid Image type. Please use JPG or PNG or GIF file type.</div>";
header('location:'.SITEURL.'admin/index.php?page=add_question');
die();
}
//Uploading if the file is valid
//first changing image name
$new_name='Exam_Question_Vijay_Thapa_'.$obj->uniqid();
$image_name=$new_name.'.'.$ext;
//Adding Watermark to the image fie too
$source=$_FILES['image']['tmp_name'];
$destination="../images/questions/".$image_name;
$upload=$obj->upload_file($source,$destination);
if($upload==false)
{
$_SESSION['upload']="<div class='error'>Failed to upload question image. Try again.</div>";
header('location:'.SITEURL.'admin/index.php?page=add_question');
die();
}
}
else
{
$image_name="";
}
//Get all values from the forms
$question=$obj->sanitize($conn,$_POST['question']);
$first_answer=$obj->sanitize($conn,$_POST['first_answer']);
$second_answer=$obj->sanitize($conn,$_POST['second_answer']);
$third_answer=$obj->sanitize($conn,$_POST['third_answer']);
$fourth_answer=$obj->sanitize($conn,$_POST['fourth_answer']);
$fifth_answer=$obj->sanitize($conn,$_POST['fifth_answer']);
$faculty=$obj->sanitize($conn,$_POST['faculty']);
if(isset($_POST['is_active']))
{
$is_active=$_POST['is_active'];
}
else
{
$is_active='yes';
}
$answer=$obj->sanitize($conn,$_POST['answer']);
$reason=$obj->sanitize($conn,$_POST['reason']);
$marks=$obj->sanitize($conn,$_POST['marks']);
$category=$obj->sanitize($conn,$_POST['category']);
$added_date=date('Y-m-d');
$tbl_name='tbl_question';
$data="question='$question',
first_answer='$first_answer',
second_answer='$second_answer',
third_answer='$third_answer',
fourth_answer='$fourth_answer',
fifth_answer='$fifth_answer',
answer='$answer',
reason='$reason',
marks='$marks',
category='$category',
faculty='$faculty',
is_active='$is_active',
added_date='$added_date',
updated_date='',
image_name='$image_name'
";
$query=$obj->insert_data($tbl_name,$data);
$res=$obj->execute_query($conn,$query);
if($res===true)
{
$_SESSION['add']="<div class='success'>Question successfully added.</div>";
header('location:'.SITEURL.'admin/index.php?page=questions');
}
else
{
$_SESSION['add']="<div class='error'>Failed to add question. Try again.</div>";
header('location:'.SITEURL.'admin/index.php?page=add_question');
}
}
?>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<!--Body Starts Here-->
<div class="container">
<div class="title">Registration</div>
<div class="content">
<a href="<?php echo SITEURL; ?>admin/index.php?page=students"><img src="../box/assets/img/unnamed.png" alt="" class="header__img"></a>
<form method="post" action="" class="forms">
<?php
if(isset($_SESSION['validation']))
{
echo $_SESSION['validation'];
unset($_SESSION['validation']);
}
if(isset($_SESSION['add']))
{
echo $_SESSION['add'];
unset($_SESSION['add']);
}
?>
<div class="user-details">
<div class="input-box">
<span class="details">First Name</span>
<input type="text" name="first_name" placeholder="First Name" required="true" /> <br />
</div>
<div class="input-box">
<span class="details">Last Name</span>
<input type="text" name="last_name" placeholder="Last Name" required="true" /><br />
</div>
<div class="input-box">
<span class="details">Email</span>
<input type="email" name="email" placeholder="Email Address" required="true" /><br />
</div>
<div class="input-box">
<span class="details">Username</span>
<input type="text" name="username" placeholder="Username" required="true" /><br />
</div>
<div class="input-box">
<span class="details">Password</span>
<input type="text" name="password" placeholder="Password" required="true" /><br />
</div>
<div class="input-box">
<span class="details">Contact</span>
<input type="tel" name="contact" placeholder="Contact Number" /><br />
</div> </div>
<div class="gender-details">
<input type="radio" name="gender" id="dot-1">
<input type="radio" name="gender" id="dot-2">
<input type="radio" name="gender" id="dot-3">
<span class="gender-title">Gender</span>
<div class="category">
<label for="dot-1">
<span class="dot one"></span>
<span class="gender">Male</span>
</label>
<label for="dot-2">
<span class="dot two"></span>
<span class="gender">Female</span>
</label>
<label for="dot-3">
<span class="dot three"></span>
<span class="gender">Prefer not to say</span>
</label>
</div>
</div>
<div class="user">
<span class="details">Faculty</span>
<select name="faculty">
<?php
//Get Faculty from database
$tbl_name="tbl_class";
$where="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)
{
while($row=$obj->fetch_data($res))
{
$faculty_id=$row['faculty_id'];
$faculty_name=$row['faculty_name'];
?>
<option value="<?php echo $faculty_id; ?>"><?php echo $faculty_name; ?></option>
<?php
}
}
else
{
echo("<option value='none'>NONE</option>");
}
?>
</select>
<br />
</div>
<div class="user-detailss">
<div class="input-box"><br>
<span class="details">Is Active?</span>
<div class="category">
Yes
<input type="checkbox" name="is_active" value="yes"id="dot-1" />
No<input type="checkbox" name="is_active" value="no"id="dot-2" />
<br />
</div></div></div>
<div class="button">
<input type="submit" name="submit" value="Add Student"/></div>
</form>
</div>
</div>
<?php
if(isset($_POST['submit']))
{
//Getting Values from the form
$first_name=$obj->sanitize($conn,$_POST['first_name']);
$last_name=$obj->sanitize($conn,$_POST['last_name']);
$email=$obj->sanitize($conn,$_POST['email']);
$username=$obj->sanitize($conn,$_POST['username']);
$password=$obj->sanitize($conn,$_POST['password']);
$contact=$obj->sanitize($conn,$_POST['contact']);
if(isset($_POST['gender']))
{
$gender=$obj->sanitize($conn,$_POST['gender']);
}
else
{
$gender='male';
}
$faculty=$obj->sanitize($conn,$_POST['faculty']);
if(isset($_POST['is_active']))
{
$is_active=$_POST['is_active'];
}
else
{
$is_active='yes';
}
$added_date=date('Y-m-d');
//Backend Validation, Checking whether the input fields are empty or not
if(($first_name||$last_name||$email||$username||$password)==null)
{
//SET SSESSION Message
$_SESSION['validation']="<div class='error'>First Name or Last Name, or Email or Username or Password is Empty.</div>";
header('location:'.SITEURL.'admin/index.php?page=add_student');
}
//Addding to the database
$tbl_name='tbl_student';
$data="first_name='$first_name',
last_name='$last_name',
email='$email',
username='$username',
password='$password',
contact='$contact',
gender='$gender',
faculty='$faculty',
is_active='$is_active',
added_date='$added_date',
updated_date=''";
$query=$obj->insert_data($tbl_name,$data);
$res=$obj->execute_query($conn,$query);
if($res===true)
{
$_SESSION['add']="<div class='success'>New student successfully added.</div>";
header('location:'.SITEURL.'admin/index.php?page=students');
}
else
{
$_SESSION['add']="<div class='error'>Failed to add new student. Try again.</div>";
header('location:'.SITEURL.'admin/index.php?page=add_student');
}
}
?>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<?php
$host = "localhost"; /* Host name */
$user = "root"; /* User */
$password = ""; /* Password */
$dbname = "quizapp"; /* Database name */
$con = mysqli_connect($host, $user, $password,$dbname);
// Check connection
if (!$con) {
die("Connection failed: " . mysqli_connect_error());
}
?> <?php
$time=time();
$res=mysqli_query($con,"select * from tbl_student");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<style type="text/css">
.container {
margin-top: 100px;
border: 1px solid #9C9C9C;
background-color: #fff;
padding:30px;
}
.container h2{
margin-bottom:25px;
}
.text-info {
color: #000 !important;
}
</style>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th width="5%">#</th>
<th width="80%">Name</th>
<th width="15%">Status</th>
</tr>
</thead>
<tbody id="user_grid">
<?php
$i=1;
while($row=mysqli_fetch_assoc($res)){
$status='Offline';
$class="btn-danger";
if($row['last_login']>$time){
$status='Online';
$class="btn-success";
}
?>
<tr>
<th scope="row"><?php echo $i?></th>
<td><?php echo $row['first_name']?></td>
<td><button type="button" class="btn <?php echo $class?>"><?php echo $status?></button></td>
</tr>
<?php
$i++;
} ?>
</tbody>
</table>
</div>
<script>
function updateUserStatus(){
jQuery.ajax({
url:'update_user_status.php',
success:function(){
}
});
}
function getUserStatus(){
jQuery.ajax({
url:'get_user_status.php',
success:function(result){
jQuery('#user_grid').html(result);
}
});
}
setInterval(function(){
updateUserStatus();
},3000);
setInterval(function(){
getUserStatus();
},7000);
</script>
</body>
</html>
\ No newline at end of file
<head>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="custom.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:100,200,400,500,600" rel="stylesheet" type="text/css">
</head>
<style>
body{
font-family: 'Raleway', sans-serif;
}
.main-section{
width: 950px;
margin-left: -70px;
text-align: center;
padding: 0px 5px;
}
.dashbord{
width:32%;
display: inline-block;
background-color:#34495E;
color:#fff;
margin-top: 50px;
}
.icon-section i{
font-size: 30px;
padding:10px;
border:1px solid #fff;
border-radius:50%;
margin-top:-25px;
margin-bottom: 10px;
background-color:#34495E;
}
}
.icon-section p{
margin:0px;
font-size: 20px;
padding-bottom: 10px;
}
.detail-section{
background-color: #2F4254;
padding: 5px 0px;
}
.dashbord .detail-section:hover{
background-color: #5a5a5a;
cursor: pointer;
}
.detail-section a{
color:#fff;
text-decoration: none;
}
.dashbord-green .icon-section,.dashbord-green .icon-section i{
background-color: #16A085;
}
.dashbord-green .detail-section{
background-color: #149077;
}
.dashbord-orange .icon-section,.dashbord-orange .icon-section i{
background-color: #F39C12;
}
.dashbord-orange .detail-section{
background-color: #DA8C10;
}
.dashbord-blue .icon-section,.dashbord-blue .icon-section i{
background-color: #2980B9;
}
.dashbord-blue .detail-section{
background-color:#2573A6;
}
.dashbord-red .icon-section,.dashbord-red .icon-section i{
background-color:#E74C3C;
}
.dashbord-red .detail-section{
background-color:#CF4436;
}
.dashbord-skyblue .icon-section,.dashbord-skyblue .icon-section i{
background-color:#8E44AD;
}
.dashbord-skyblue .detail-section{
background-color:#803D9B;
}
</style>
<!--Body Starts Here--><br><br><br>
<center><h2>Dashboard</h2></center>
<div class="main-section">
<div class="dashbord">
<div class="icon-section">
<i class="fa fa-users" aria-hidden="true"></i><br>
<small>Students</small>
<p>25</p>
<small>Students</small>
</div>
<div class="detail-section">
<a href="#">More Info </a>
</div>
</div>
<div class="dashbord dashbord-green">
<div class="icon-section">
<i class="fa fa-user" aria-hidden="true"></i><br>
<small>Parents</small>
<p> 25</p>
<small>Students</small>
</div>
<div class="detail-section">
<a href="#">More Info </a>
</div>
</div>
<div class="dashbord dashbord-orange">
<div class="icon-section">
<i class="fa fa-bell" aria-hidden="true"></i><br>
<small>Class</small>
<p>9 New</p>
<small>Students</small>
</div>
<div class="detail-section">
<a href="#">More Info </a>
</div>
</div>
<div class="dashbord dashbord-blue">
<div class="icon-section">
<i class="fa fa-question-circle" aria-hidden="true"></i><br>
<small>Questions</small>
<p>30</p>
<small>Students</small>
</div>
<div class="detail-section">
<a href="#">More Info </a>
</div>
</div>
<div class="dashbord dashbord-red">
<div class="icon-section">
<i class="fa fa-gamepad" aria-hidden="true"></i><br>
<small>Activites</small>
<p>5</p>
<small>Students</small>
</div>
<div class="detail-section">
<a href="#">More Info </a>
</div>
</div>
<div class="dashbord dashbord-skyblue">
<div class="icon-section">
<i class="fa fa-film" aria-hidden="true"></i><br>
<small>Records</small>
<p>6</p>
<small>Students</small>
</div>
<div class="detail-section">
<a href="#">More Info </a>
</div>
</div>
</div>
<br>
<br>
<br>
</body>
<!--Body Ends Here-->
\ No newline at end of file
<?php
include('../config/apply.php');
if((isset($_GET['id']))&&(isset($_GET['page'])))
{
//echo "DELETE PAGE";
//Get the values from URL
$id=$_GET['id'];
$page=$_GET['page'];
switch($page)
{
case "students":
{
$tbl_name="tbl_student";
$title="Student";
$where="student_id=$id";
}
break;
case "faculties":
{
$tbl_name="tbl_class";
$title="Faculty";
$where="faculty_id=$id";
}
break;
case "questions":
{
$tbl_name="tbl_question";
$title="Question";
$where="question_id=$id";
}
break;
}
//Query to Delete
$query=$obj->delete_data($tbl_name,$where);
$res=$obj->execute_query($conn,$query);
if($res==true)
{
$_SESSION['delete']="<div class='success'>".$title." successfully deleted.</div>";
header('location:'.SITEURL.'admin/index.php?page='.$page);
}
else
{
$_SESSION['delete']="<div class='error'>Failed to delete ".$title.".</div>";
header('location:'.SITEURL.'admin/index.php?page='.$page);
}
}
else
{
$_SESSION['fail']="<div class='error'>Failed to delete. Please Try Again.</div>";
header('location:'.SITEURL.'admin/');
}
?>
\ No newline at end of file
<?php
include('../config/apply.php');
//Get all the values from the URL
if((isset($_GET['summary_id']))&&(isset($_GET['student_id']))&&(isset($_GET['added_date'])))
{
//echo "DELETE PAGE";
$summary_id=$_GET['summary_id'];
$student_id=$_GET['student_id'];
$added_date=$_GET['added_date'];
//Deleting from tbl_result_summary
$tbl_name="tbl_result_summary";
$where="summary_id='$summary_id'";
$query=$obj->delete_data($tbl_name,$where);
$res=$obj->execute_query($conn,$query);
if($res==true)
{
//Deleting from tbl_result
$tbl_name2="tbl_result";
$where2="student_id='$student_id' && added_date='$added_date'";
$query2=$obj->delete_data($tbl_name2,$where2);
$res2=$obj->execute_query($conn,$query2);
if($res2==true)
{
$_SESSION['delete']="<span class='success'>Result successfully deleted.</span>";
header('location:'.SITEURL.'admin/index.php?page=results');
}
else
{
$_SESSION['delete']="<span class='error'>Failed to delete result.</span>";
header('location:'.SITEURL.'admin/index.php?page=results');
}
}
}
else
{
header('location:'.SITEURL.'admin/index.php?page=results');
}
?>
\ No newline at end of file
<?php
$host = "localhost"; /* Host name */
$user = "root"; /* User */
$password = ""; /* Password */
$dbname = "quizapp"; /* Database name */
$con = mysqli_connect($host, $user, $password,$dbname);
// Check connection
if (!$con) {
die("Connection failed: " . mysqli_connect_error());
}
?><?php
$time=time();
$res=mysqli_query($con,"select * from tbl_student");
$i=1;
$html='';
while($row=mysqli_fetch_assoc($res)){
$status='Offline';
$class="btn-danger";
if($row['last_login']>$time){
$status='Online';
$class="btn-success";
}
$html.='<tr>
<th scope="row">'.$i.'</th>
<td>'.$row['first_name'].'</td>
<td><button type="button" class="btn '.$class.'">'.$status.'</button></td>
</tr>';
$i++;
}
echo $html;
?>
\ No newline at end of file
<?php
if(isset($_GET['page']))
{
$page=$_GET['page'];
}
else
{
$page='home';
}
switch($page)
{
case "home":
{
include('dashboard.php');
}
break;
case "users":
{
include('users.php');
}
break;
case "add_user":
{
include('add_user.php');
}
break;
case "update_user":
{
include('add_user.php');
}
break;
case "students":
{
include('students.php');
}
break;
case "add_student":
{
include('add_student.php');
}
break;
case "update_student":
{
include('update_student.php');
}
break;
case "add_parent":
{
include('add_parent.php');
}
break;
case "parent":
{
include('parent.php');
}
break;
case "faculties":
{
include('faculties.php');
}
break;
case "add_faculty":
{
include('add_faculty.php');
}
break;
case "update_faculty":
{
include('update_faculty.php');
}
break;
case "questions":
{
include('questions.php');
}
break;
case "add_question":
{
include('add_question.php');
}
break;
case "update_question":
{
include('update_question.php');
}
break;
case "results":
{
include('results.php');
}
break;
case "view_result":
{
include('view_result.php');
}
break;
case "settings":
{
include('settings.php');
}
break;
case "my_uploads":
{
include('my_uploads.php');
}
break;
case "my_upload":
{
include('my_upload.php');
}
break;
case "uploadlist":
{
include('uploadlist.php');
}
break;
case "upload":
{
include('upload.php');
}
break;
case "att":
{
include('att.php');
}
break;
case "update_user_status":
{
include('update_user_status.php');
}
break; case "get_user_status":
{
include('get_user_status.php');
}
break;
case "logout":
{
if(isset($_SESSION['user']))
{
unset($_SESSION['user']);
header('location:'.SITEURL.'admin/login.php');
}
}
break;
default:
{
include('dashboard.php');
}
}
?>
\ No newline at end of file
<style>
</style>
<div class="container">
<div class="row">
<div class="col-lg-12">
<form id="manage-upload">
<input type="hidden" name="id" value="<?php echo isset($id)? $id : '' ?>">
<div class="row">
<div class="col-md-6 border-right">
<div class="user-details">
<div class="input-box">
<span class="details">Upload Video</b></apan>
<input type="file" class="form-control form-control-sm" name="vid" onchange="displayVID(this,$(this))">
</div>
<div class="form-group">
<label for="" class="control-label"><b>Thumbnail/Poster</b></label>
<input type="file" class="form-control form-control-sm" name="img" onchange="displayImg(this,$(this))">
</div>
<div class="form-group">
<label for="" class="control-label"><b>Title</b></label>
<textarea name="title" id="" cols="30" rows="2" class="form-control" style="resize:none"><?php echo isset($title) ? $title : '' ?></textarea>
</div>
<div class="form-group">
<label for="" class="control-label"><b>Description</b></label>
<textarea name="description" id="" cols="30" rows="5" class="form-control"><?php echo isset($title) ? $title : '' ?></textarea>
</div>
</div>
<div class="col-md-6">
<div class="form-group d-flex justify-content-center bg-dark border-dark img-thumbnail">
<video width="320" height="240" id="vid-field" controls class="img-fluid" poster="<?php echo isset($thumbnail_path) && !empty($thumbnail_path) ? "assets/uploads/thumbnail/".$thumbnail_path : '' ?>">
<?php if(isset($video_path)): ?>
<source src="<?php echo isset($video_path) && !empty($video_path) ? "assets/uploads/videos/".$video_path : '' ?>">
<?php endif; ?>
</video>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer display py-2 px-0 row">
<div class="row">
<div class="col-lg-12">
<button class="btn btn-secondary float-right mr-2" data-dismiss="modal">Cancel</button>
<button class="btn btn-light bg-light border float-right mr-2" onclick="$('#manage-upload').submit()" type="button"><i class="fa fa-upload"></i> <?php echo isset($id) ? "Update" :'Upload' ?></button>
</div>
</div>
</div>
<style>
#uni_modal .modal-footer{
display: none;
}
#uni_modal .modal-footer.display{
display: block;
}
</style>
<script>
function displayVID(input,_this) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#vid-field').html("<source src='"+e.target.result+"'>");
console.log(e.target.result)
}
reader.readAsDataURL(input.files[0]);
}
}
function displayImg(input,_this) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#vid-field').attr('poster', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$('#manage-upload').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url:'ajax.php?action=save_upload',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp == 1){
alert_toast('<i class="fa fa-check text-white"></i> Video successfully Upload.',"success");
setTimeout(function(){
location.reload()
},750)
}
}
})
})
</script>
\ No newline at end of file
<head>
<style>
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 6px 22px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
}
.button {
background-color: white;
color: black;
border: 2px solid #4CAF50;
border-radius: 12px;
}
.button:hover {
background-color: #4CAF50;
color: white;
}
</style>
</head>
<?php
$host = "localhost"; /* Host name */
$user = "root"; /* User */
$password = ""; /* Password */
$dbname = "quizapp"; /* Database name */
$con = mysqli_connect($host, $user, $password,$dbname);
// Check connection
if (!$con) {
die("Connection failed: " . mysqli_connect_error());
}
?>
<?php
if(isset($_POST['but_upload'])){
$maxsize = 5242880; // 5MB
if(isset($_FILES['file']['name']) && $_FILES['file']['name'] != ''){
$name = $_FILES['file']['name'];
$target_dir = "../images/questions/";
$target_file = $target_dir . $_FILES["file"]["name"];
$subject=$obj->sanitize($conn,$_POST['subject']);
$topic=$obj->sanitize($conn,$_POST['topic']);
$content=$obj->sanitize($conn,$_POST['content']);
// Select file type
$extension = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Valid file extensions
$extensions_arr = array("mp4","avi","3gp","mov","mpeg","jpg","png");
// Check extension
if( in_array($extension,$extensions_arr) ){
// Check file size
if(($_FILES['file']['size'] >= $maxsize) || ($_FILES["file"]["size"] == 0)) {
$_SESSION['message'] = "File too large. File must be less than 5MB.";
}else{
// Upload
if(move_uploaded_file($_FILES['file']['tmp_name'],$target_file)){
// Insert record
$query = "INSERT INTO videos(name,location,subject,topic,content) VALUES('".$name."','".$target_file."','".$subject."','".$topic."','".$content."')";
mysqli_query($con,$query);
$_SESSION['message'] = "Upload successfully.";
}
}
}else{
$_SESSION['message'] = "Invalid file extension.";
}
}else{
$_SESSION['message'] = "Please select a file.";
}
exit;
}
?>
<!doctype html>
<html>
<body>
<!-- Upload response -->
<?php
if(isset($_SESSION['message'])){
echo $_SESSION['message'];
unset($_SESSION['message']);
}
?>
<script type="text/javascript">
function preview() {
frame.src=URL.createObjectURL(event.target.files[0]);
}</script>
<div class="container">
<div class="title">Registration</div>
<div class="content">
<a href="<?php echo SITEURL; ?>admin/index.php?page=students"><img src="../box/assets/img/unnamed.png" alt="" class="header__img"></a>
<form method="post" action="" enctype='multipart/form-data'class="forms">
<div class="user-details"><img id="frame" src="" width="600px" height="600px"/>
<div class="input-box">
<span class="details">Subject</span>
<input type="text" name="subject" placeholder="subject" required="true" /> </div>
<div class="user-details">
<div class="input-box">
<span class="details">Topic</span>
<input type="text" name="topic" placeholder="topic" required="true" />
</div>
<div class="user-details">
<div class="input-box">
<span class="details">Content</span>
<input type="text" name="content" placeholder="content" required="true" />
</div>
<input type='file' name='file' class="button"onchange="preview()" />
<input type='submit' value='Upload' name='but_upload'class="button"/>
</form>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!--Body Starts Here-->
<!--Body Starts Here-->
<head>
<link rel="stylesheet" href="../box/assets/css/styles.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="custom.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:100,200,400,500,600" rel="stylesheet" type="text/css">
<style>
.container-xl{
color:#5d5c5c;
display: block;
height: 572px;
width:1250px;
overflow-y: auto;
margin-right: -10px;
}
.table-responsive {
margin: 0px 0;
Overflow:auto
}
.table-wrapper {
background: #fff;
padding: 20px 25px;
border-radius: 3px;
min-width: 1200px;
box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.table-title {
padding-bottom: 15px;
background: #435d7d;
color: #fff;
padding: 16px 30px;
min-width: 100%;
margin: -20px -25px 10px;
border-radius: 3px 3px 0 0;
}
.table-title h2 {
margin: 5px 0 0;
font-size: 24px;
}
.table-title .btn-group {
float: right;
}
.table-title .btn {
color: #fff;
float: right;
font-size: 13px;
border: none;
min-width: 50px;
border-radius: 2px;
border: none;
outline: none !important;
margin-left: 10px;
}
.table-title .btn i {
float: left;
font-size: 21px;
margin-right: 10px;
margin-top: -20px;
}
.table-title .btn span {
float: left;
margin-top: -25px;
}
table.table tr th, table.table tr td {
border-color: red;
padding: 12px 30px;
vertical-align: middle;
}
tr:nth-child(even) {background-color: #c8cdd0;}
table.table tr th:first-child {
width: 60px;
}
table.table tr th:last-child {
width: 100px;
}
table.table-striped tbody tr:nth-of-type(odd) {
background-color: #fcfcfc;
}
table.table-striped.table-hover tbody tr:hover {
background: #f5f5f5;
}
table.table th i {
font-size: 13px;
margin: 0 5px;
cursor: pointer;
}
table.table td:last-child i {
opacity: 0.9;
font-size: 22px;
margin: 0 5px;
}
table.table td a {
font-weight: bold;
color: #566787;
display: inline-block;
text-decoration: none;
outline: none !important;
}
table.table td a:hover {
color: #2196F3;
}
table.table td a.edit {
color: #FFC107;
}
table.table td a.delete {
color: #F44336;
}
table.table td i {
font-size: 19px;
}
table.table .avatar {
border-radius: 50%;
vertical-align: middle;
margin-right: 10px;
}
.pagination {
float: right;
margin: 0 0 5px;
}
.pagination li a {
border: none;
font-size: 13px;
min-width: 30px;
min-height: 30px;
color: #999;
margin: 0 2px;
line-height: 30px;
border-radius: 2px !important;
text-align: center;
padding: 0 6px;
}
.pagination li a:hover {
color: #666;
}
.pagination li.active a, .pagination li.active a.page-link {
background: #03A9F4;
}
.pagination li.active a:hover {
background: #0397d6;
}
.pagination li.disabled i {
color: #ccc;
}
.pagination li i {
font-size: 16px;
padding-top: 6px
}
.hint-text {
float: left;
margin-top: 10px;
font-size: 13px;
}
/* Custom checkbox */
.custom-checkbox {
position: relative;
}
.custom-checkbox input[type="checkbox"] {
opacity: 0;
position: absolute;
margin: 5px 0 0 3px;
z-index: 9;
}
.custom-checkbox label:before{
width: 18px;
height: 18px;
}
.custom-checkbox label:before {
content: '';
margin-right: 10px;
display: inline-block;
vertical-align: text-top;
background: white;
border: 1px solid #bbb;
border-radius: 2px;
box-sizing: border-box;
z-index: 2;
}
.custom-checkbox input[type="checkbox"]:checked + label:after {
content: '';
position: absolute;
left: 6px;
top: 3px;
width: 6px;
height: 11px;
border: solid #000;
border-width: 0 3px 3px 0;
transform: inherit;
z-index: 3;
transform: rotateZ(45deg);
}
.custom-checkbox input[type="checkbox"]:checked + label:before {
border-color: #03A9F4;
background: #03A9F4;
}
.custom-checkbox input[type="checkbox"]:checked + label:after {
border-color: #fff;
}
.custom-checkbox input[type="checkbox"]:disabled + label:before {
color: #b8b8b8;
cursor: auto;
box-shadow: none;
background: #ddd;
}
/* Modal styles */
.modal .modal-dialog {
max-width: 400px;
}
.modal .modal-header, .modal .modal-body, .modal .modal-footer {
padding: 20px 30px;
}
.modal .modal-content {
border-radius: 3px;
font-size: 14px;
}
.modal .modal-footer {
background: #ecf0f1;
border-radius: 0 0 3px 3px;
}
.modal .modal-title {
display: inline-block;
}
.modal .form-control {
border-radius: 2px;
box-shadow: none;
border-color: #dddddd;
}
.modal textarea.form-control {
resize: vertical;
}
.modal .btn {
border-radius: 2px;
min-width: 100px;
}
.modal form label {
font-weight: normal;
}
.search-box {
position: relative;
float: right;
}
.search-box input {
height: 34px;
border-radius: 20px;
padding-left: 35px;
border-color: #ddd;
box-shadow: none;
}
.search-box input:focus {
border-color: #3FBAE4;
}
.search-box i {
color: #a0a5b1;
position: absolute;
font-size: 19px;
top: 8px;
left: 10px;
}
</style>
<script>
$(document).ready(function(){
// Activate tooltip
$('[data-toggle="tooltip"]').tooltip();
// Select/Deselect checkboxes
var checkbox = $('table tbody input[type="checkbox"]');
$("#selectAll").click(function(){
if(this.checked){
checkbox.each(function(){
this.checked = true;
});
} else{
checkbox.each(function(){
this.checked = false;
});
}
});
checkbox.click(function(){
if(!this.checked){
$("#selectAll").prop("checked", false);
}
});
});
</script>
</head>
<div class="container-xl
">
<div class="table-responsive">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><i class="fa fa-user-circle" aria-hidden="true"></i>&nbsp;Manage <b>Parents</b></h2>
</div>
<div class="col-sm-6"><div class="search-box">
<i class="fa fa-search"></i>
<input type="text" class="form-control" placeholder="Search&hellip;"id="filter"name="filter">
</div><a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-download"></i> <span>Feedback</span></a><a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-download"></i> <span>Export CSV</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-upload"></i> <span>Import CSV</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_parent" class="btn btn-success" data-toggle="modal"><i class="fa fa-plus"></i> <span>Add New Parent</span></a>
</div>
</div>
</div>
<table class="table table-striped table-hover">
<thead>
<br>
<?php
if(isset($_SESSION['add']))
{
echo $_SESSION['add'];
unset($_SESSION['add']);
}
if(isset($_SESSION['update']))
{
echo $_SESSION['update'];
unset($_SESSION['update']);
}
if(isset($_SESSION['delete']))
{
echo $_SESSION['delete'];
unset($_SESSION['delete']);
}
?>
<tr>
<th>S.N.</th>
<th>Full Name</th>
<th>Email</th>
<th>Contact</th>
<th>Address</th>
<th>User Name</th>
<th>Actions</th>
</tr>
<!--Displaying All Data From Database-->
<?php
$tbl_name="tbl_parent ORDER BY parent_id DESC";
$query=$obj->select_data($tbl_name);
$sn=1;
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
if($count_rows>0)
{
while($row=$obj->fetch_data($res))
{
$parent_id=$row['parent_id'];
$first_name=$row['first_name'];
$last_name=$row['last_name'];
$full_name=$first_name.' '.$last_name;
$email=$row['email'];
$contact=$row['contact'];
$address=$row['address'];
$username=$row['username'];
?>
<tr>
<td><?php echo $sn++; ?> </td>
<td><?php echo $full_name; ?></td>
<td><?php echo $email; ?></td>
<td><?php echo $contact; ?></td>
<td><?php echo $address; ?></td>
<td><?php echo $username; ?></td>
</td>
<td>
<a href="<?php echo SITEURL; ?>admin/index.php?page=update_parent&parent_id=<?php echo $parent_id; ?>"><button type="button" class="btn-update"><i class="fa fa-cog"></i></button></a>
<a href="<?php echo SITEURL; ?>admin/pages/delete.php?id=<?php echo $parent_id; ?>&page=parent"><button type="button" class="btn-delete" onclick="return confirm('Are you sure?')"><i class="fa fa-trash"></i></button></a>
</td>
</tr>
<?php
}
}
else
{
echo "<tr><td colspan='7'><div class='error'>No Parents Added Yet.</div></tr></td>";
}
?>
</table>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<head>
<link rel="stylesheet" href="../box/assets/css/styles.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="custom.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:100,200,400,500,600" rel="stylesheet" type="text/css">
<style>
.container-xl{
color:#5d5c5c;
display: block;
height: 572px;
width:1250px;
overflow-y: auto;
margin-right: -10px;
}
.table-responsive {
margin: 0px 0;
Overflow:auto
}
.table-wrapper {
background: #fff;
padding: 20px 25px;
border-radius: 3px;
min-width: 1200px;
box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.table-title {
padding-bottom: 15px;
background: #435d7d;
color: #fff;
padding: 16px 30px;
min-width: 100%;
margin: -20px -25px 10px;
border-radius: 3px 3px 0 0;
}
.table-title h2 {
margin: 5px 0 0;
font-size: 24px;
}
.table-title .btn-group {
float: right;
}
.table-title .btn {
color: #fff;
float: right;
font-size: 13px;
border: none;
min-width: 50px;
border-radius: 2px;
border: none;
outline: none !important;
margin-left: 10px;
}
.table-title .btn i {
float: left;
font-size: 21px;
margin-right: 10px;
margin-top: -20px;
}
.table-title .btn span {
float: left;
margin-top: -25px;
}
table.table tr th, table.table tr td {
border-color: red;
padding: 12px 30px;
vertical-align: middle;
}
tr:nth-child(even) {background-color: #c8cdd0;}
table.table tr th:first-child {
width: 60px;
}
table.table tr th:last-child {
width: 100px;
}
table.table-striped tbody tr:nth-of-type(odd) {
background-color: #fcfcfc;
}
table.table-striped.table-hover tbody tr:hover {
background: #f5f5f5;
}
table.table th i {
font-size: 13px;
margin: 0 5px;
cursor: pointer;
}
table.table td:last-child i {
opacity: 0.9;
font-size: 22px;
margin: 0 5px;
}
table.table td a {
font-weight: bold;
color: #566787;
display: inline-block;
text-decoration: none;
outline: none !important;
}
table.table td a:hover {
color: #2196F3;
}
table.table td a.edit {
color: #FFC107;
}
table.table td a.delete {
color: #F44336;
}
table.table td i {
font-size: 19px;
}
table.table .avatar {
border-radius: 50%;
vertical-align: middle;
margin-right: 10px;
}
.pagination {
float: right;
margin: 0 0 5px;
}
.pagination li a {
border: none;
font-size: 13px;
min-width: 30px;
min-height: 30px;
color: #999;
margin: 0 2px;
line-height: 30px;
border-radius: 2px !important;
text-align: center;
padding: 0 6px;
}
.pagination li a:hover {
color: #666;
}
.pagination li.active a, .pagination li.active a.page-link {
background: #03A9F4;
}
.pagination li.active a:hover {
background: #0397d6;
}
.pagination li.disabled i {
color: #ccc;
}
.pagination li i {
font-size: 16px;
padding-top: 6px
}
.hint-text {
float: left;
margin-top: 10px;
font-size: 13px;
}
/* Custom checkbox */
.custom-checkbox {
position: relative;
}
.custom-checkbox input[type="checkbox"] {
opacity: 0;
position: absolute;
margin: 5px 0 0 3px;
z-index: 9;
}
.custom-checkbox label:before{
width: 18px;
height: 18px;
}
.custom-checkbox label:before {
content: '';
margin-right: 10px;
display: inline-block;
vertical-align: text-top;
background: white;
border: 1px solid #bbb;
border-radius: 2px;
box-sizing: border-box;
z-index: 2;
}
.custom-checkbox input[type="checkbox"]:checked + label:after {
content: '';
position: absolute;
left: 6px;
top: 3px;
width: 6px;
height: 11px;
border: solid #000;
border-width: 0 3px 3px 0;
transform: inherit;
z-index: 3;
transform: rotateZ(45deg);
}
.custom-checkbox input[type="checkbox"]:checked + label:before {
border-color: #03A9F4;
background: #03A9F4;
}
.custom-checkbox input[type="checkbox"]:checked + label:after {
border-color: #fff;
}
.custom-checkbox input[type="checkbox"]:disabled + label:before {
color: #b8b8b8;
cursor: auto;
box-shadow: none;
background: #ddd;
}
/* Modal styles */
.modal .modal-dialog {
max-width: 400px;
}
.modal .modal-header, .modal .modal-body, .modal .modal-footer {
padding: 20px 30px;
}
.modal .modal-content {
border-radius: 3px;
font-size: 14px;
}
.modal .modal-footer {
background: #ecf0f1;
border-radius: 0 0 3px 3px;
}
.modal .modal-title {
display: inline-block;
}
.modal .form-control {
border-radius: 2px;
box-shadow: none;
border-color: #dddddd;
}
.modal textarea.form-control {
resize: vertical;
}
.modal .btn {
border-radius: 2px;
min-width: 100px;
}
.modal form label {
font-weight: normal;
}
.search-box {
position: relative;
float: right;
}
.search-box input {
height: 34px;
border-radius: 20px;
padding-left: 35px;
border-color: #ddd;
box-shadow: none;
}
.search-box input:focus {
border-color: #3FBAE4;
}
.search-box i {
color: #a0a5b1;
position: absolute;
font-size: 19px;
top: 8px;
left: 10px;
}
</style>
<script>
$(document).ready(function(){
// Activate tooltip
$('[data-toggle="tooltip"]').tooltip();
// Select/Deselect checkboxes
var checkbox = $('table tbody input[type="checkbox"]');
$("#selectAll").click(function(){
if(this.checked){
checkbox.each(function(){
this.checked = true;
});
} else{
checkbox.each(function(){
this.checked = false;
});
}
});
checkbox.click(function(){
if(!this.checked){
$("#selectAll").prop("checked", false);
}
});
});
</script>
</head>
<div class="container-xl
">
<div class="table-responsive">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><i class="fa fa-question-circle" aria-hidden="true"></i>&nbsp;Quiz <b>Activity</b></h2>
</div>
<div class="col-sm-6"><div class="search-box">
<i class="fa fa-search"></i>
<input type="text" class="form-control" placeholder="Search&hellip;"id="filter"name="filter">
</div>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-plus-square"></i> <span>Maths</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-language"></i> <span>Sinhala</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-pagelines"></i> <span>Enviroment Science</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-plus"></i> <span>Add Quiz pool</span></a>
</div>
</div>
</div>
<table class="table table-striped table-hover">
<thead>
<br>
<?php
if(isset($_SESSION['add']))
{
echo $_SESSION['add'];
unset($_SESSION['add']);
}
if(isset($_SESSION['update']))
{
echo $_SESSION['update'];
unset($_SESSION['update']);
}
if(isset($_SESSION['delete']))
{
echo $_SESSION['delete'];
unset($_SESSION['delete']);
}
?>
<tr>
<th>S.N.</th>
<th>Question</th>
<th>Answer</th>
<th>Faculty</th>
<th>Is Active?</th>
<th>Actions</th>
</tr>
<?php
//Getting Data From Database
$tbl_name="tbl_question ORDER BY question_id DESC";
$query=$obj->select_data($tbl_name);
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
$sn=1;
if($count_rows>0)
{
while($row=$obj->fetch_data($res))
{
$question_id=$row['question_id'];
$question=$row['question'];
$answer=$row['answer'];
$faculty=$row['faculty'];
$is_active=$row['is_active'];
?>
<tr>
<td><?php echo $sn++; ?>. </td>
<td style="width: 650px;"><?php echo $question; ?></td>
<td><?php echo $answer; ?></td>
<td><?php echo $faculty; ?></td></td>
<td><?php echo $is_active; ?></td>
<td>
<a href="<?php echo SITEURL; ?>admin/index.php?page=update_question&id=<?php echo $question_id; ?>"><button type="button" class="btn-update"><i class="fa fa-cog"></i></button></a>
<a href="<?php echo SITEURL; ?>admin/pages/delete.php?id=<?php echo $question_id; ?>&page=questions"><button type="button" class="btn-delete" onclick="return confirm('Are you sure?')"><i class="fa fa-trash"></i></button></a>
</td>
</tr>
<?php
}
}
else
{
echo "<tr><td colspan='6'><div class='error'></div></td></tr>";
}
?>
</table>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<head>
<link rel="stylesheet" href="../box/assets/css/styles.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="custom.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:100,200,400,500,600" rel="stylesheet" type="text/css">
<style>
.container-xl{
color:black;
margin-top: 10px;
}
.table-responsive {
margin: 30px 0;
Overflow:auto
}
.table-wrapper {
background: #fff;
padding: 20px 25px;
border-radius: 3px;
min-width: 1200px;
box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.table-title {
padding-bottom: 15px;
background: #435d7d;
color: #fff;
padding: 16px 30px;
min-width: 100%;
margin: -20px -25px 10px;
border-radius: 3px 3px 0 0;
}
.table-title h2 {
margin: 5px 0 0;
font-size: 24px;
}
.table-title .btn-group {
float: right;
}
.table-title .btn {
color: #fff;
float: right;
font-size: 13px;
border: none;
min-width: 50px;
border-radius: 2px;
border: none;
outline: none !important;
margin-left: 10px;
}
.table-title .btn i {
float: left;
font-size: 21px;
margin-right: 10px;
margin-top: -20px;
}
.table-title .btn span {
float: left;
margin-top: -25px;
}
table.table tr th, table.table tr td {
border-color: red;
padding: 12px 30px;
vertical-align: middle;
}
tr:nth-child(even) {background-color: #c8cdd0;}
table.table tr th:first-child {
width: 60px;
}
table.table tr th:last-child {
width: 100px;
}
table.table-striped tbody tr:nth-of-type(odd) {
background-color: #fcfcfc;
}
table.table-striped.table-hover tbody tr:hover {
background: #f5f5f5;
}
table.table th i {
font-size: 13px;
margin: 0 5px;
cursor: pointer;
}
table.table td:last-child i {
opacity: 0.9;
font-size: 22px;
margin: 0 2px;
}
table.table td a {
font-weight: bold;
color: #566787;
display: inline-block;
text-decoration: none;
outline: none !important;
}
table.table td a:hover {
color: #2196F3;
}
table.table td a.edit {
color: #FFC107;
}
table.table td a.delete {
color: #F44336;
}
table.table td i {
font-size: 19px;
}
table.table .avatar {
border-radius: 50%;
vertical-align: middle;
margin-right: 10px;
}
.pagination {
float: right;
margin: 0 0 5px;
}
.pagination li a {
border: none;
font-size: 13px;
min-width: 30px;
min-height: 30px;
color: #999;
margin: 0 2px;
line-height: 30px;
border-radius: 2px !important;
text-align: center;
padding: 0 6px;
}
.pagination li a:hover {
color: #666;
}
.pagination li.active a, .pagination li.active a.page-link {
background: #03A9F4;
}
.pagination li.active a:hover {
background: #0397d6;
}
.pagination li.disabled i {
color: #ccc;
}
.pagination li i {
font-size: 16px;
padding-top: 6px
}
.hint-text {
float: left;
margin-top: 10px;
font-size: 13px;
}
/* Custom checkbox */
.custom-checkbox {
position: relative;
}
.custom-checkbox input[type="checkbox"] {
opacity: 0;
position: absolute;
margin: 5px 0 0 3px;
z-index: 9;
}
.custom-checkbox label:before{
width: 18px;
height: 18px;
}
.custom-checkbox label:before {
content: '';
margin-right: 10px;
display: inline-block;
vertical-align: text-top;
background: white;
border: 1px solid #bbb;
border-radius: 2px;
box-sizing: border-box;
z-index: 2;
}
.custom-checkbox input[type="checkbox"]:checked + label:after {
content: '';
position: absolute;
left: 6px;
top: 3px;
width: 6px;
height: 11px;
border: solid #000;
border-width: 0 3px 3px 0;
transform: inherit;
z-index: 3;
transform: rotateZ(45deg);
}
.custom-checkbox input[type="checkbox"]:checked + label:before {
border-color: #03A9F4;
background: #03A9F4;
}
.custom-checkbox input[type="checkbox"]:checked + label:after {
border-color: #fff;
}
.custom-checkbox input[type="checkbox"]:disabled + label:before {
color: #b8b8b8;
cursor: auto;
box-shadow: none;
background: #ddd;
}
/* Modal styles */
.modal .modal-dialog {
max-width: 400px;
}
.modal .modal-header, .modal .modal-body, .modal .modal-footer {
padding: 20px 30px;
}
.modal .modal-content {
border-radius: 3px;
font-size: 14px;
}
.modal .modal-footer {
background: #ecf0f1;
border-radius: 0 0 3px 3px;
}
.modal .modal-title {
display: inline-block;
}
.modal .form-control {
border-radius: 2px;
box-shadow: none;
border-color: #dddddd;
}
.modal textarea.form-control {
resize: vertical;
}
.modal .btn {
border-radius: 2px;
min-width: 100px;
}
.modal form label {
font-weight: normal;
}
.search-box {
position: relative;
float: right;
}
.search-box input {
height: 34px;
border-radius: 20px;
padding-left: 35px;
border-color: #ddd;
box-shadow: none;
}
.search-box input:focus {
border-color: #3FBAE4;
}
.search-box i {
color: #a0a5b1;
position: absolute;
font-size: 19px;
top: 8px;
left: 10px;
}
</style>
<script>
$(document).ready(function(){
// Activate tooltip
$('[data-toggle="tooltip"]').tooltip();
// Select/Deselect checkboxes
var checkbox = $('table tbody input[type="checkbox"]');
$("#selectAll").click(function(){
if(this.checked){
checkbox.each(function(){
this.checked = true;
});
} else{
checkbox.each(function(){
this.checked = false;
});
}
});
checkbox.click(function(){
if(!this.checked){
$("#selectAll").prop("checked", false);
}
});
});
</script>
</head>
<div class="container-xl
">
<div class="table-responsive">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><i class="fa fa-user-circle" aria-hidden="true"></i>&nbsp;Manage <b>Students</b></h2>
</div>
<div class="col-sm-6"><div class="search-box">
<i class="fa fa-search"></i>
<input type="text" class="form-control" placeholder="Search&hellip;"id="filter"name="filter">
</div>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-plus"></i> <span>Add New Student</span></a>
</div>
</div>
</div>
<table class="table table-striped table-hover">
<thead>
<br><!--Body Starts Here-->
<h2>Result Manager</h2>
<!--<button type="button" class="btn-add">Add User</button>-->
<?php
if(isset($_SESSION['delete']))
{
echo $_SESSION['delete'];
unset($_SESSION['delete']);
}
?>
<tr>
<th>S.N.</th>
<th>Full Name</th>
<th>Date</th>
<th>Mark</th>
<th>Faculty</th>
<th>Actions</th>
</tr>
<?php
$tbl_name="tbl_result_summary ORDER BY added_date DESC";
$query=$obj->select_data($tbl_name);
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
$sn=1;
if($count_rows>0)
{
while($row=$obj->fetch_data($res))
{
$summary_id=$row['summary_id'];
$student_id=$row['student_id'];
$marks=$row['marks'];
$added_date=$row['added_date'];
?>
<tr>
<td><?php echo $sn++; ?>. </td>
<td>
<?php
$tbl_name="tbl_student";
$full_name=$obj->get_fullname($tbl_name,$student_id,$conn);
echo $full_name;
?>
</td>
<td><?php echo $added_date; ?></td>
<td><?php echo $marks; ?></td>
<td>
<?php
//Get FAculty from STudent ID
$tbl="tbl_student";
$tbl2="tbl_class";
$faculty=$obj->get_faculty($tbl,$student_id,$conn);
echo $faculty_name=$obj->get_facultyname($tbl2,$faculty,$conn);
?>
</td>
<td>
<a href="<?php echo SITEURL; ?>admin/index.php?page=view_result&student_id=<?php echo $student_id; ?>&added_date=<?php echo $added_date; ?>"><button type="button" class="btn-update">VIEW</button></a>
<a href="<?php echo SITEURL; ?>admin/pages/delete_result.php?summary_id=<?php echo $summary_id; ?>&student_id=<?php echo $student_id; ?>&added_date=<?php echo $added_date; ?>"><button type="button" class="btn-delete">DELETE</button></a>
</td>
</tr>
<?php
}
}
else
{
echo "<tr><td colspan='7'><span class='error'>No Results Found Yet.</span></td></tr>";
}
?>
</table>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<?php
if(isset($_SESSION['user']))
{
$username=$_SESSION['user'];
$tbl_name="tbl_app";
$where="username='$username'";
$query=$obj->select_data($tbl_name,$where);
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
if($count_rows==1)
{
$row=$obj->fetch_data($res);
$app_id=$row['app_id'];
$app_name=$row['app_name'];
$email=$row['email'];
$username=$row['username'];
$password=$row['password'];
$contact=$row['contact'];
$image_name=$row['image_name'];
}
else
{
header('location:'.SITEURL.'admin/login.php');
}
}
else
{
header('location:'.SITEURL.'admin/index.php?page=logout');
}
?>
<!--Body Starts Here-->
<div class="main">
<div class="content">
<div class="report">
<!--
<form method="post" action="" class="forms">
<h2>Update App Details</h2>
-->
<?php
if(isset($_SESSION['update']))
{
echo $_SESSION['update'];
unset($_SESSION['update']);
}
if(isset($_SESSION['invalid']))
{
echo $_SESSION['invalid'];
unset($_SESSION['invalid']);
}
if(isset($_SESSION['password']))
{
echo $_SESSION['password'];
unset($_SESSION['password']);
}
if(isset($_SESSION['not_match']))
{
echo $_SESSION['not_match'];
unset($_SESSION['not_match']);
}
?>
<!--
<span class="name">App Name</span>
<input type="text" name="app_name" value="<?php echo $app_name; ?>" required="true" /><br />
<span class="name">Email</span>
<input type="email" name="email" value="<?php echo $email; ?>" required="true" /><br />
<span class="name">Username</span>
<input type="text" name="username" value="<?php echo $username; ?>" required="true" /><br />
<span class="name">Contact</span>
<input type="tel" name="contact" value="<?php echo $contact; ?>" required="true" /><br />
<span class="note">Note: Please Enter Your Current Password To Make Changes.</span><br />
<span class="name">Current Password</span>
<input type="password" name="current_password" placeholder="Current Password" required="true" /><br />
<input type="submit" name="submit" value="Update Settings" class="btn-update" style="margin-left: 15%;" />
<a href="<?php echo SITEURL; ?>admin/index.php"><button type="button" class="btn-delete">Cancel</button></a>
</form>
<hr />
-->
<?php
if(isset($_POST['submit']))
{
//echo "Clicked";
$app_name=$obj->sanitize($conn,$_POST['app_name']);
$email=$obj->sanitize($conn,$_POST['email']);
$username=$obj->sanitize($conn,$_POST['username']);
$contact=$obj->sanitize($conn,$_POST['contact']);
$current_password=$obj->sanitize($conn,$_POST['current_password']);
//Normal Validation
if(($app_name=="")or($email=="")or($username=="")or($contact=="")or($current_password==""))
{
$_SESSION['validation']="<div class='error'>App Name or Email or Username or Contact or Password is Empty.</div>";
header('location:'.SITEURL.'admin/index.php?page=settings');
}
if($current_password==$password)
{
$tbl_name="tbl_app";
$data="
app_name='$app_name',
email='$email',
username='$username',
contact='$contact'
";
$where="app_id=$app_id";
$query=$obj->update_data($tbl_name,$data,$where);
$res=$obj->execute_query($conn,$query);
if($res===true)
{
$_SESSION['update']="<div class='success'>App details successfully updated.</div>";
header('location:'.SITEURL.'admin/index.php?page=settings');
}
else
{
$_SESSION['update']="<div class='error'>Failed to update app details.</div>";
header('location:'.SITEURL.'admin/index.php?page=settings');
}
}
else{
$_SESSION['invalid']="<div class='error'>Current Password did not match.</div>";
header('location:'.SITEURL.'admin/index.php?page=settings');
}
}
?>
</div>
<div class="report">
<form method="post" action="" class="forms">
<h2>Change Password</h2>
<span class="name">Current Password</span>
<input type="password" name="current_password" placeholder="Current Password" required="true" /><br />
<span class="name">New Password</span>
<input type="password" name="new_password" placeholder="New Password" required="true" /><br />
<span class="name">Confirm Password</span>
<input type="password" name="confirm_password" placeholder="Confirm Password" required="true" /><br />
<input type="submit" name="update" value="Update Password" class="btn-update" style="margin-left: 15%;" />
<a href="<?php echo SITEURL; ?>admin/index.php"><button type="button" class="btn-delete">Cancel</button></a>
</form>
<?php
if(isset($_POST['update']))
{
//echo "Clicked";
//Get Details from forms
$new_password=md5($obj->sanitize($conn,$_POST['new_password']));
$confirm_password=md5($obj->sanitize($conn,$_POST['confirm_password']));
$current_password=md5($obj->sanitize($conn,$_POST['current_password']));
if($current_password==$password)
{
if($new_password==$confirm_password)
{
$tbl_name='tbl_app';
$data="password='$new_password'";
$where="app_id='$app_id'";
$query=$obj->update_data($tbl_name,$data,$where);
$res=$obj->execute_query($conn,$query);
if($res==true)
{
$_SESSION['password']="<div class='success'>Password changed successfully.</div>";
header('location:'.SITEURL.'admin/index.php?page=settings');
}
else
{
$_SESSION['password']="<div class='error'>Failed to change password. Try again.</div>";
header('location:'.SITEURL.'admin/index.php?page=settings');
}
}
else
{
$_SESSION['not_match']="<div class='error'>New Password and Confirm Password did not match.</div>";
header('location:'.SITEURL.'admin/index.php?page=settings');
}
}
else
{
$_SESSION['not_match']="<div class='error'>Current Password did not match.</div>";
header('location:'.SITEURL.'admin/index.php?page=settings');
}
}
?>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<!--Body Starts Here-->
<head>
<link rel="stylesheet" href="../box/assets/css/styles.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="custom.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:100,200,400,500,600" rel="stylesheet" type="text/css">
<style>
.container-xl{
color:#5d5c5c;
display: block;
height: 572px;
width:1250px;
overflow-y: auto;
margin-right: -10px;
}
.table-responsive {
margin: 0px 0;
Overflow:auto;
}
.table-wrapper {
background: #fff;
padding: 20px 25px;
border-radius: 3px;
min-width: 1200px;
box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.table-title {
padding-bottom: 15px;
background: #435d7d;
color: #fff;
padding: 16px 30px;
min-width: 100%;
margin: -20px -25px 10px;
border-radius: 3px 3px 0 0;
}
.table-title h2 {
margin: 5px 0 0;
font-size: 24px;
}
.table-title .btn-group {
float: right;
}
.table-title .btn {
color: #fff;
float: right;
font-size: 13px;
border: none;
min-width: 50px;
border-radius: 2px;
border: none;
outline: none !important;
margin-left: 10px;
}
.table-title .btn i {
float: left;
font-size: 21px;
margin-right: 10px;
margin-top: -20px;
}
.table-title .btn span {
float: left;
margin-top: -25px;
}
table.table tr th, table.table tr td {
border-color: red;
padding: 12px 30px;
vertical-align: middle;
}
tr:nth-child(even) {background-color: #c8cdd0;}
table.table tr th:first-child {
width: 60px;
}
table.table tr th:last-child {
width: 100px;
}
table.table-striped tbody tr:nth-of-type(odd) {
background-color: #fcfcfc;
}
table.table-striped.table-hover tbody tr:hover {
background: #f5f5f5;
}
table.table th i {
font-size: 13px;
margin: 0 5px;
cursor: pointer;
}
table.table td:last-child i {
opacity: 1;
font-size: 22px;
margin: 0 2px;
}
table.table td a {
font-weight: bold;
color: #566787;
display: inline-block;
text-decoration: none;
outline: none !important;
}
table.table td a:hover {
color: #2196F3;
}
table.table td a.edit {
color: #FFC107;
}
table.table td a.delete {
color: #F44336;
}
table.table td i {
font-size: 19px;
}
table.table .avatar {
border-radius: 50%;
vertical-align: middle;
margin-right: 10px;
}
.pagination {
float: right;
margin: 0 0 5px;
}
.pagination li a {
border: none;
font-size: 13px;
min-width: 30px;
min-height: 30px;
color: #999;
margin: 0 2px;
line-height: 30px;
border-radius: 2px !important;
text-align: center;
padding: 0 6px;
}
.pagination li a:hover {
color: #666;
}
.pagination li.active a, .pagination li.active a.page-link {
background: #03A9F4;
}
.pagination li.active a:hover {
background: #0397d6;
}
.pagination li.disabled i {
color: #ccc;
}
.pagination li i {
font-size: 16px;
padding-top: 6px
}
.hint-text {
float: left;
margin-top: 10px;
font-size: 13px;
}
/* Custom checkbox */
.custom-checkbox {
position: relative;
}
.custom-checkbox input[type="checkbox"] {
opacity: 0;
position: absolute;
margin: 5px 0 0 3px;
z-index: 9;
}
.custom-checkbox label:before{
width: 18px;
height: 18px;
}
.custom-checkbox label:before {
content: '';
margin-right: 10px;
display: inline-block;
vertical-align: text-top;
background: white;
border: 1px solid #bbb;
border-radius: 2px;
box-sizing: border-box;
z-index: 2;
}
.custom-checkbox input[type="checkbox"]:checked + label:after {
content: '';
position: absolute;
left: 6px;
top: 3px;
width: 6px;
height: 11px;
border: solid #000;
border-width: 0 3px 3px 0;
transform: inherit;
z-index: 3;
transform: rotateZ(45deg);
}
.custom-checkbox input[type="checkbox"]:checked + label:before {
border-color: #03A9F4;
background: #03A9F4;
}
.custom-checkbox input[type="checkbox"]:checked + label:after {
border-color: #fff;
}
.custom-checkbox input[type="checkbox"]:disabled + label:before {
color: #b8b8b8;
cursor: auto;
box-shadow: none;
background: #ddd;
}
/* Modal styles */
.modal .modal-dialog {
max-width: 400px;
}
.modal .modal-header, .modal .modal-body, .modal .modal-footer {
padding: 20px 30px;
}
.modal .modal-content {
border-radius: 3px;
font-size: 14px;
}
.modal .modal-footer {
background: #ecf0f1;
border-radius: 0 0 3px 3px;
}
.modal .modal-title {
display: inline-block;
}
.modal .form-control {
border-radius: 2px;
box-shadow: none;
border-color: #dddddd;
}
.modal textarea.form-control {
resize: vertical;
}
.modal .btn {
border-radius: 2px;
min-width: 100px;
}
.modal form label {
font-weight: normal;
}
.search-box {
position: relative;
float: right;
}
.search-box input {
height: 34px;
border-radius: 20px;
padding-left: 35px;
border-color: #ddd;
box-shadow: none;
}
.search-box input:focus {
border-color: #3FBAE4;
}
.search-box i {
color: #a0a5b1;
position: absolute;
font-size: 19px;
top: 8px;
left: 10px;
}
</style>
<script>
$(document).ready(function(){
// Activate tooltip
$('[data-toggle="tooltip"]').tooltip();
// Select/Deselect checkboxes
var checkbox = $('table tbody input[type="checkbox"]');
$("#selectAll").click(function(){
if(this.checked){
checkbox.each(function(){
this.checked = true;
});
} else{
checkbox.each(function(){
this.checked = false;
});
}
});
checkbox.click(function(){
if(!this.checked){
$("#selectAll").prop("checked", false);
}
});
});
</script>
</head>
<div class="container-xl
">
<div class="table-responsive">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><i class="fa fa-user-circle" aria-hidden="true"></i>&nbsp;Manage <b>Students</b></h2>
</div>
<div class="col-sm-6"><div class="search-box">
<i class="fa fa-search"></i>
<input type="text" class="form-control" placeholder="Search&hellip;"id="filter"name="filter">
</div> <a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-download"></i> <span>Export CSV</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-upload"></i> <span>Import CSV</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-plus"></i> <span>Add New Student</span></a>
</div>
</div>
</div>
<table class="table table-striped table-hover">
<thead>
<br>
<?php
if(isset($_SESSION['add']))
{
echo $_SESSION['add'];
unset($_SESSION['add']);
}
if(isset($_SESSION['update']))
{
echo $_SESSION['update'];
unset($_SESSION['update']);
}
if(isset($_SESSION['delete']))
{
echo $_SESSION['delete'];
unset($_SESSION['delete']);
}
?>
<tr>
<tr>
<th>S.N.</th>
<th>Full Name</th>
<th>Email</th>
<th>Contact</th>
<th>Faculty</th>
<th>Is Active?</th>
<th>Actions</th>
</tr>
<!--Displaying All Data From Database-->
<?php
$tbl_name="tbl_student ORDER BY student_id DESC";
$query=$obj->select_data($tbl_name);
$sn=1;
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
if($count_rows>0)
{
while($row=$obj->fetch_data($res))
{
$student_id=$row['student_id'];
$first_name=$row['first_name'];
$last_name=$row['last_name'];
$full_name=$first_name.' '.$last_name;
$email=$row['email'];
$contact=$row['contact'];
$faculty=$row['faculty'];
$is_active=$row['is_active'];
?>
<tr>
<td><?php echo $sn++; ?> </td>
<td><?php echo $full_name; ?></td>
<td><?php echo $email; ?></td>
<td><?php echo $contact; ?></td>
<td>
<?php
//Get FAculty Name from faculty_id
$tbl_name2="tbl_class";
$faculty_name=$obj->get_facultyname($tbl_name2,$faculty,$conn);
echo $faculty_name;
?>
</td>
<td><?php echo $is_active; ?></td>
<td>
<a href="<?php echo SITEURL; ?>admin/index.php?page=update_student&student_id=<?php echo $student_id; ?>"><button type="button" class="btn-update"><i class="fa fa-cog"></i></button></a>
<a href="<?php echo SITEURL; ?>admin/pages/delete.php?id=<?php echo $student_id; ?>&page=students"><button type="button" class="btn-delete" onclick="return confirm('Are you sure?')"><i class="fa fa-trash"></i></button></a>
</td>
</tr>
<?php
}
}
else
{
echo "<tr><td colspan='7'><div class='error'>No Students Added Yet.</div></tr></td>";
}
?>
</thead>
</table>
</div></div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<!--Body Starts Here-->
<?php
if(isset($_GET['id']))
{
$question_id=$_GET['id'];
$tbl_name='tbl_question';
$where="question_id=$question_id";
$query=$obj->select_data($tbl_name,$where);
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
if($count_rows==1)
{
$row=$obj->fetch_data($res);
$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'];
$reason=$row['reason'];
$marks=$row['marks'];
$category=$row['category'];
$faculty_db=$row['faculty'];
$is_active=$row['is_active'];
$previous_image=$row['image_name'];
}
else
{
header('location:'.SITEURL.'admin/index.php?page=questions');
}
}
else
{
header('location:'.SITEURL.'admin/index.php?page=questions');
}
?>
<div class="main">
<div class="content">
<div class="report">
<form method="post" action="" class="forms" enctype="multipart/form-data">
<h2>Update Question</h2>
<?php
if(isset($_SESSION['validation']))
{
echo $_SESSION['validation'];
unset($_SESSION['validation']);
}
if(isset($_SESSION['update']))
{
echo $_SESSION['update'];
unset($_SESSION['update']);
}
?>
<span class="name">Question</span><br />
<textarea name="question" required="true"><?php echo $question; ?></textarea> <br />
<script>
CKEDITOR.replace( 'question' );
</script>
<?php
if($previous_image!="")
{
?>
<span class="name">Previous Image</span>
<img src="<?php echo SITEURL; ?>images/questions/<?php echo $previous_image; ?>" /> <br />
<?php
}
?>
<input type="hidden" name="previous_image" value="<?php echo $previous_image; ?>" />
<span class="name">New Image</span>
<input type="file" name="image" /><br />
<span class="name">First Answer</span>
<input type="text" name="first_answer" value="<?php echo $first_answer;; ?>" required="true" /><br />
<span class="name">Second Answer</span>
<input type="text" name="second_answer" value="<?php echo $second_answer; ?>" required="true" /><br />
<span class="name">Third Answer</span>
<input type="text" name="third_answer" value="<?php echo $third_answer; ?>" required="true" /><br />
<span class="name">Fourth Answer</span>
<input type="text" name="fourth_answer" value="<?php echo $fourth_answer; ?>" required="true" /><br />
<span class="name">Fifth Answer</span>
<input type="text" name="fifth_answer" value="<?php echo $fifth_answer; ?>" required="true" /><br />
<span class="name">Answer</span>
<select name="answer">
<option <?php if($answer==1){echo "selected='seleccted'";} ?> value="1">First Answer</option>
<option <?php if($answer==2){echo "selected='seleccted'";} ?> value="2">Second Answer</option>
<option <?php if($answer==3){echo "selected='seleccted'";} ?> value="3">Third Answer</option>
<option <?php if($answer==4){echo "selected='seleccted'";} ?> value="4">Fourth Answer</option>
<option <?php if($answer==5){echo "selected='seleccted'";} ?> value="5">Fifth Answer</option>
</select>
<br />
<span class="name">Reason</span><br />
<textarea name="reason" ><?php echo $reason; ?></textarea>
<script>
CKEDITOR.replace( 'reason' );
</script>
<br />
<span class="name">Marks</span>
<input type="text" name="marks" value="<?php echo $marks; ?>" />
<br />
<span class="name">Category</span>
<select name="category">
<option <?php if($category=="English"){echo "selected='seleccted'";} ?> value="English">English</option>
<option <?php if($category=="Math"){echo "selected='seleccted'";} ?> value="Math">Math</option>
</select>
<br />
<span class="name">Faculty</span>
<select name="faculty">
<?php
//Get Faculties from database
$tbl_name="tbl_class";
$query=$obj->select_data($tbl_name);
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
if($count_rows>0)
{
while($row=$obj->fetch_data($res))
{
$faculty_id=$row['faculty_id'];
$faculty_name=$row['faculty_name'];
?>
<option <?php if($faculty_db==$faculty_id){echo"selected='selected'";} ?> value="<?php echo $faculty_id; ?>"><?php echo $faculty_name; ?></option>
<?php
}
}
else
{
?>
<option value="0">Uncategorized</option>
<?php
}
?>
</select>
<br />
<span class="name">Is Active?</span>
<input <?php if($is_active=='yes'){echo "checked='checked'";} ?> type="radio" name="is_active" value="yes" /> Yes
<input <?php if($is_active=='no'){echo "checked='checked'";} ?> type="radio" name="is_active" value="no" /> No
<br />
<input type="submit" name="submit" value="Update Question" class="btn-update" style="margin-left: 15%;" />
<a href="<?php echo SITEURL; ?>admin/index.php?page=questions"><button type="button" class="btn-delete">Cancel</button></a>
</form>
<?php
if(isset($_POST['submit']))
{
//echo "Clicked";
$question=$obj->sanitize($conn,$_POST['question']);
$first_answer=$obj->sanitize($conn,$_POST['first_answer']);
$second_answer=$obj->sanitize($conn,$_POST['second_answer']);
$third_answer=$obj->sanitize($conn,$_POST['third_answer']);
$fourth_answer=$obj->sanitize($conn,$_POST['fourth_answer']);
$fifth_answer=$obj->sanitize($conn,$_POST['fifth_answer']);
$answer=$obj->sanitize($conn,$_POST['answer']);
$reason=$obj->sanitize($conn,$_POST['reason']);
$marks=$obj->sanitize($conn,$_POST['marks']);
$category=$obj->sanitize($conn,$_POST['category']);
$faculty=$obj->sanitize($conn,$_POST['faculty']);
$previous_image=$_POST['previous_image'];
if(isset($_POST['is_active']))
{
$is_active=$_POST['is_active'];
}
else
{
$is_active="yes";
}
$updated_date=date('Y-m-d');
//Managing Question Images
if($_FILES['image']['name']!="")
{
//echo "Book Cover is Available";
//Getting File Extension
$ext=end(explode('.',$_FILES['image']['name']));
//Checking if the file type is valid or not
$valid_file=$obj->check_image_type($ext);
if($valid_file==false)
{
$_SESSION['invalid']="<div class='error'>Invalid Image type. Please use JPG or PNG or GIF file type.</div>";
header('location:'.SITEURL.'admin/index.php?page=update_question&id='.$question_id);
die();
}
//Removing Previous Image
if($previous_image!="")
{
$path="../images/questions/".$previous_image;
$remove=$obj->remove_file($path);
if($remove==false)
{
$_SESSION['remove_book']="Failed to remove previous Image. Try again.";
header('location:'.SITEURL.'admin/index.php?page=update_question&id='.$question_id);
die();
}
}
//Uploading if the file is valid
//first changing image name
$new_name='Exam_Question_Vijay_Thapa_'.$obj->uniqid();
$image_name=$new_name.'.'.$ext;
//Adding Watermark to the image fie too
$source=$_FILES['image']['tmp_name'];
$destination="../images/questions/".$image_name;
$upload=$obj->upload_file($source,$destination);
if($upload==false)
{
$_SESSION['upload']="<div class='error'>Failed to upload question image. Try again.</div>";
header('location:'.SITEURL.'admin/index.php?page=update_question&id='.$question_id);
die();
}
}
else
{
$image_name=$previous_image;
}
//Normal PHP Validation
if(($question==null)or($first_answer==null)or($second_answer==null)or($third_answer==null)or($fourth_answer==null)or($answer==null))
{
$_SESSION['validation']="<div class='error'>Either Question or One of the Answers field is empty.</div>";
header('location:'.SITEURL.'admin/index.php?page=update_question&id='.$question_id);
}
//Updating Question
$tbl_name="tbl_question";
$data="
question='$question',
first_answer='$first_answer',
second_answer='$second_answer',
third_answer='$third_answer',
fourth_answer='$fourth_answer',
fifth_answer='$fifth_answer',
answer='$answer',
reason='$reason',
marks='$marks',
category='$category',
faculty='$faculty',
is_active='$is_active',
updated_date='$updated_date',
image_name='$image_name'
";
$where="question_id='$question_id'";
$query=$obj->update_data($tbl_name,$data,$where);
$res=$obj->execute_query($conn,$query);
if($res===true)
{
$_SESSION['update']="<div class='success'>Question successfully updated.</div>";
header('location:'.SITEURL.'admin/index.php?page=questions');
}
else
{
$_SESSION['update']="<div class='error'>Failed to update question.</div>";
header('location:'.SITEURL.'admin/index.php?page=update_question&id='.$question_id);
}
}
?>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<!--Body Starts Here-->
<?php
if(isset($_GET['student_id']))
{
$student_id=$_GET['student_id'];
$tbl_name='tbl_student';
$where="student_id=$student_id";
$query=$obj->select_data($tbl_name,$where);
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
if($count_rows==1)
{
$row=$obj->fetch_data($res);
$first_name=$row['first_name'];
$last_name=$row['last_name'];
$email=$row['email'];
$username=$row['username'];
$password=$row['password'];
$contact=$row['contact'];
$gender=$row['gender'];
$faculty=$row['faculty'];
$is_active=$row['is_active'];
}
else
{
header('location:'.SITEURL.'admin/index.php?page=students');
}
}
else
{
header('location:'.SITEURL.'admin/index.php?page=students');
}
?>
<div class="main">
<div class="content">
<div class="report">
<form method="post" action="" class="forms">
<h2>Update Student</h2>
<?php
if(isset($_SESSION['validation']))
{
echo $_SESSION['validation'];
unset($_SESSION['validation']);
}
if(isset($_SESSION['update']))
{
echo $_SESSION['update'];
unset($_SESSION['update']);
}
?>
<span class="name">First Name</span>
<input type="text" name="first_name" value="<?php echo $first_name; ?>" required="true" /> <br />
<span class="name">Last Name</span>
<input type="text" name="last_name" value="<?php echo $last_name; ?>" required="true" /><br />
<span class="name">Email</span>
<input type="email" name="email" value="<?php echo $email; ?>" required="true" /><br />
<span class="name">Username</span>
<input type="text" name="username" value="<?php echo $username; ?>" required="true" /><br />
<span class="name">Password</span>
<input type="text" name="password" value="<?php echo $password; ?>" required="true" /><br />
<span class="name">Contact</span>
<input type="tel" name="contact" value="<?php echo $contact; ?>" /><br />
<span class="name">Gender</span>
<input <?php if($gender=='male'){echo "checked='checked'";} ?> type="radio" name="gender" value="male" /> Male
<input <?php if($gender=='female'){echo "checked='checked'";} ?> type="radio" name="gender" value="female" /> Female
<input <?php if($gender=='other'){echo "checked='checked'";} ?> type="radio" name="gender" value="other" /> Other
<br />
<span class="name">Faculty</span>
<select name="faculty">
<?php
//Get Faculties from database
$tbl_name="tbl_class";
$query=$obj->select_data($tbl_name);
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
if($count_rows>0)
{
while($row=$obj->fetch_data($res))
{
$faculty_id=$row['faculty_id'];
$faculty_name=$row['faculty_name'];
?>
<option <?php if($faculty==$faculty_id){echo"selected='selected'";} ?> value="<?php echo $faculty_id; ?>"><?php echo $faculty_name; ?></option>
<?php
}
}
else
{
?>
<option value="0">Uncategorized</option>
<?php
}
?>
</select>
<br />
<span class="name">Is Active?</span>
<input <?php if($is_active=='yes'){echo "checked='checked'";} ?> type="radio" name="is_active" value="yes" /> Yes
<input <?php if($is_active=='no'){echo "checked='checked'";} ?> type="radio" name="is_active" value="no" /> No
<br />
<input type="submit" name="submit" value="Update Student" class="btn-update" style="margin-left: 15%;" />
<a href="<?php echo SITEURL; ?>admin/index.php?page=students"><button type="button" class="btn-delete">Cancel</button></a>
</form>
<?php
if(isset($_POST['submit']))
{
//echo "Clicked";
$first_name=$obj->sanitize($conn,$_POST['first_name']);
$last_name=$obj->sanitize($conn,$_POST['last_name']);
$email=$obj->sanitize($conn,$_POST['email']);
$username=$obj->sanitize($conn,$_POST['username']);
$password=$obj->sanitize($conn,$_POST['password']);
$contact=$obj->sanitize($conn,$_POST['contact']);
if(isset($_POST['gender']))
{
$gender=$_POST['gender'];
}
$faculty=$_POST['faculty'];
if(isset($_POST['is_active']))
{
$is_active=$_POST['is_active'];
}
$updated_date=date('Y-m-d');
//Normal Validation
if(($first_name||$last_name||$email||$username||$password)==null)
{
//SET SSESSION Message
$_SESSION['validation']="<div class='error'>First Name or Last Name, or Email or Username or Password is Empty.</div>";
header('location:'.SITEURL.'admin/index.php?page=update_student&student_id='.$student_id);
}
//Set Table name to update
$tbl_name='tbl_student';
//SEt New Data to Change
$data="first_name='$first_name',
last_name='$last_name',
email='$email',
username='$username',
password='$password',
contact='$contact',
gender='$gender',
faculty='$faculty',
is_active='$is_active',
updated_date='$updated_date'
";
$where="student_id=$student_id";
$query=$obj->update_data($tbl_name,$data,$where);
$res=$obj->execute_query($conn,$query);
if($res===true)
{
$_SESSION['update']="<div class='success'>Student detail successfully updated.</div>";
header('location:'.SITEURL.'admin/index.php?page=students');
}
else
{
$_SESSION['update']="<div class='error'>Failed to update student details.</div>";
header('location:'.SITEURL.'admin/index.php?page=update_student&student_id='.$student_id);
}
}
?>
</div>
</div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<?php
$host = "localhost"; /* Host name */
$user = "root"; /* User */
$password = ""; /* Password */
$dbname = "quizapp"; /* Database name */
$con = mysqli_connect($host, $user, $password,$dbname);
// Check connection
if (!$con) {
die("Connection failed: " . mysqli_connect_error());
}
?><?php
$uid=$_SESSION['student_id'];
$time=time()+10;
$res=mysqli_query($con,"update tbl_student set last_login=$time where id=$student_id");
?>
\ No newline at end of file
tt<!--Body Starts Here-->
<head>
<link rel="stylesheet" href="../box/assets/css/styles.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="custom.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:100,200,400,500,600" rel="stylesheet" type="text/css">
<style>
.container-xl{
color:#5d5c5c;
display: block;
height: 572px;
width:1250px;
overflow-y: auto;
margin-right: -10px;
}
.table-responsive {
margin: 0px 0;
Overflow:auto;
}
.table-wrapper {
background: #fff;
padding: 20px 25px;
border-radius: 3px;
min-width: 1200px;
box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.table-title {
padding-bottom: 15px;
background: #435d7d;
color: #fff;
padding: 16px 30px;
min-width: 100%;
margin: -20px -25px 10px;
border-radius: 3px 3px 0 0;
}
.table-title h2 {
margin: 5px 0 0;
font-size: 24px;
}
.table-title .btn-group {
float: right;
}
.table-title .btn {
color: #fff;
float: right;
font-size: 13px;
border: none;
min-width: 50px;
border-radius: 2px;
border: none;
outline: none !important;
margin-left: 10px;
}
.table-title .btn i {
float: left;
font-size: 21px;
margin-right: 10px;
margin-top: -20px;
}
.table-title .btn span {
float: left;
margin-top: -25px;
}
table.table tr th, table.table tr td {
border-color: red;
padding: 12px 30px;
vertical-align: middle;
}
tr:nth-child(even) {background-color: #c8cdd0;}
table.table tr th:first-child {
width: 60px;
}
table.table tr th:last-child {
width: 100px;
}
table.table-striped tbody tr:nth-of-type(odd) {
background-color: #fcfcfc;
}
table.table-striped.table-hover tbody tr:hover {
background: #f5f5f5;
}
table.table th i {
font-size: 13px;
margin: 0 5px;
cursor: pointer;
}
table.table td:last-child i {
opacity: 1;
font-size: 22px;
margin: 0 2px;
}
table.table td a {
font-weight: bold;
color: #566787;
display: inline-block;
text-decoration: none;
outline: none !important;
}
table.table td a:hover {
color: #2196F3;
}
table.table td a.edit {
color: #FFC107;
}
table.table td a.delete {
color: #F44336;
}
table.table td i {
font-size: 19px;
}
table.table .avatar {
border-radius: 50%;
vertical-align: middle;
margin-right: 10px;
}
.pagination {
float: right;
margin: 0 0 5px;
}
.pagination li a {
border: none;
font-size: 13px;
min-width: 30px;
min-height: 30px;
color: #999;
margin: 0 2px;
line-height: 30px;
border-radius: 2px !important;
text-align: center;
padding: 0 6px;
}
.pagination li a:hover {
color: #666;
}
.pagination li.active a, .pagination li.active a.page-link {
background: #03A9F4;
}
.pagination li.active a:hover {
background: #0397d6;
}
.pagination li.disabled i {
color: #ccc;
}
.pagination li i {
font-size: 16px;
padding-top: 6px
}
.hint-text {
float: left;
margin-top: 10px;
font-size: 13px;
}
/* Custom checkbox */
.custom-checkbox {
position: relative;
}
.custom-checkbox input[type="checkbox"] {
opacity: 0;
position: absolute;
margin: 5px 0 0 3px;
z-index: 9;
}
.custom-checkbox label:before{
width: 18px;
height: 18px;
}
.custom-checkbox label:before {
content: '';
margin-right: 10px;
display: inline-block;
vertical-align: text-top;
background: white;
border: 1px solid #bbb;
border-radius: 2px;
box-sizing: border-box;
z-index: 2;
}
.custom-checkbox input[type="checkbox"]:checked + label:after {
content: '';
position: absolute;
left: 6px;
top: 3px;
width: 6px;
height: 11px;
border: solid #000;
border-width: 0 3px 3px 0;
transform: inherit;
z-index: 3;
transform: rotateZ(45deg);
}
.custom-checkbox input[type="checkbox"]:checked + label:before {
border-color: #03A9F4;
background: #03A9F4;
}
.custom-checkbox input[type="checkbox"]:checked + label:after {
border-color: #fff;
}
.custom-checkbox input[type="checkbox"]:disabled + label:before {
color: #b8b8b8;
cursor: auto;
box-shadow: none;
background: #ddd;
}
/* Modal styles */
.modal .modal-dialog {
max-width: 400px;
}
.modal .modal-header, .modal .modal-body, .modal .modal-footer {
padding: 20px 30px;
}
.modal .modal-content {
border-radius: 3px;
font-size: 14px;
}
.modal .modal-footer {
background: #ecf0f1;
border-radius: 0 0 3px 3px;
}
.modal .modal-title {
display: inline-block;
}
.modal .form-control {
border-radius: 2px;
box-shadow: none;
border-color: #dddddd;
}
.modal textarea.form-control {
resize: vertical;
}
.modal .btn {
border-radius: 2px;
min-width: 100px;
}
.modal form label {
font-weight: normal;
}
.search-box {
position: relative;
float: right;
}
.search-box input {
height: 34px;
border-radius: 20px;
padding-left: 35px;
border-color: #ddd;
box-shadow: none;
}
.search-box input:focus {
border-color: #3FBAE4;
}
.search-box i {
color: #a0a5b1;
position: absolute;
font-size: 19px;
top: 8px;
left: 10px;
}
</style>
<script>
$(document).ready(function(){
// Activate tooltip
$('[data-toggle="tooltip"]').tooltip();
// Select/Deselect checkboxes
var checkbox = $('table tbody input[type="checkbox"]');
$("#selectAll").click(function(){
if(this.checked){
checkbox.each(function(){
this.checked = true;
});
} else{
checkbox.each(function(){
this.checked = false;
});
}
});
checkbox.click(function(){
if(!this.checked){
$("#selectAll").prop("checked", false);
}
});
});
</script>
</head>
<div class="container-xl
">
<div class="table-responsive">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><i class="fa fa-user-circle" aria-hidden="true"></i>&nbsp;Manage <b>Students</b></h2>
</div>
<div class="col-sm-6"><div class="search-box">
<i class="fa fa-search"></i>
<input type="text" class="form-control" placeholder="Search&hellip;"id="filter"name="filter">
</div> <a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-book"></i> <span>Export CSV</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-video-camera"></i> <span>Video Lesson</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-calendar"></i> <span>Lesson Shedule</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-calendar"></i> <span>Live Lesson</span></a>
<a href="<?php echo SITEURL; ?>admin/index.php?page=add_student" class="btn btn-success" data-toggle="modal"><i class="fa fa-plus"></i> <span>Add New Lesson</span></a>
</div>
</div>
</div>
<table class="table table-striped table-hover">
<thead>
<br>
<?php
if(isset($_SESSION['add']))
{
echo $_SESSION['add'];
unset($_SESSION['add']);
}
if(isset($_SESSION['update']))
{
echo $_SESSION['update'];
unset($_SESSION['update']);
}
if(isset($_SESSION['delete']))
{
echo $_SESSION['delete'];
unset($_SESSION['delete']);
}
?>
<tr>
<tr>
<th>S.N.</th>
<th>Name</th>
<th>Subject</th>
<th>Topic</th>
<th>Content</th>
<th>Actions</th>
</tr>
<!--Displaying All Data From Database-->
<?php
$tbl_name="videos ORDER BY id DESC";
$query=$obj->select_data($tbl_name);
$sn=1;
$res=$obj->execute_query($conn,$query);
$count_rows=$obj->num_rows($res);
if($count_rows>0)
{
while($row=$obj->fetch_data($res))
{
$id=$row['id'];
$name=$row['name'];
$subject=$row['subject'];
$topic=$row['topic'];
$content=$row['content'];
?>
<tr>
<td><?php echo $sn++; ?> </td>
<td><?php echo $name; ?></td>
<td><?php echo $subject; ?></td>
<td><?php echo $topic; ?></td>
<td><?php echo $content; ?></td>
<td>
<a href="<?php echo SITEURL; ?>admin/index.php?page=update_student&student_id=<?php echo $student_id; ?>"><button type="button" class="btn-update"><i class="fa fa-cog"></i></button></a>
<a href="<?php echo SITEURL; ?>admin/pages/delete.php?id=<?php echo $student_id; ?>&page=students"><button type="button" class="btn-delete" onclick="return confirm('Are you sure?')"><i class="fa fa-trash"></i></button></a>
</td>
</tr>
<?php
}
}
else
{
echo "<tr><td colspan='7'><div class='error'>No Students Added Yet.</div></tr></td>";
}
?>
</thead>
</table>
</div></div>
</div>
<!--Body Ends Here-->
\ No newline at end of file
<!--Body Starts Here-->
<div class="main">
<div class="content">
<div class="report">
<?php
if(isset($_GET['student_id']))
{
$student_id=$_GET['student_id'];
$full_name=$obj->get_fullname('tbl_student',$student_id,$conn);
echo "<h2>".$full_name."'s Result</h2>";
}
else
{
header('location:'.SITEURL.'admin/index.php?page=dashboard');
}
if(isset($_GET['added_date']))
{
$added_date=$_GET['added_date'];
}
else
{
header('location:'.SITEURL.'admin/index.php?page=dashboard');
}
//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
//Using Switch Case
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; ?>admin/index.php?page=dashboard">
<button type="button" class="btn-add">Go Home</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