'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
This diff is collapsed.
<!--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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!--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
This diff is collapsed.
<!--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