0% found this document useful (0 votes)
16 views39 pages

CODING

The document contains PHP code for a student login system, including functionalities for user authentication, session management, and course enrollment. It includes HTML for the user interface, such as forms for entering registration numbers and passwords, as well as pincode verification. The system also handles logout and displays messages for successful or failed operations.

Uploaded by

karthiksenbagam5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views39 pages

CODING

The document contains PHP code for a student login system, including functionalities for user authentication, session management, and course enrollment. It includes HTML for the user interface, such as forms for entering registration numbers and passwords, as well as pincode verification. The system also handles logout and displays messages for successful or failed operations.

Uploaded by

karthiksenbagam5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

INDEX

<?php
session_start();
error_reporting(0);
include("includes/config.php");
if(isset($_POST['submit']))
{
$regno=$_POST['regno'];
$password=md5($_POST['password']);
$query=mysqli_query($con,"SELECT * FROM students WHERE StudentRegno='$regno' and
password='$password'");
$num=mysqli_fetch_array($query);
if($num>0)
{
$extra="change-password.php";//
$_SESSION['login']=$_POST['regno'];
$_SESSION['id']=$num['studentRegno'];
$_SESSION['sname']=$num['studentName'];
$uip=$_SERVER['REMOTE_ADDR'];
$status=1;
$log=mysqli_query($con,"insert into userlog(studentRegno,userip,status)
values('".$_SESSION['login']."','$uip','$status')");
$host=$_SERVER['HTTP_HOST'];
$uri=rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
header("location:http://$host$uri/$extra");
exit();
}
else
{
$_SESSION['errmsg']="Invalid Reg no or Password";
$extra="index.php";
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
header("location:http://$host$uri/$extra");
exit();
}
}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />

<title>Student Login</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/style.css" rel="stylesheet" />
</head>
<body>
<?php include('includes/header.php');?>
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h4 class="page-head-line">Please Login To Enter </h4>

</div>

</div>
<span style="color:red;" ><?php echo htmlentities($_SESSION['errmsg']); ?><?php echo
htmlentities($_SESSION['errmsg']="");?></span>
<form name="admin" method="post">
<div class="row">
<div class="col-md-6">
<label>Enter Reg no : </label>
<input type="text" name="regno" class="form-control" />
<label>Enter Password : </label>
<input type="password" name="password" class="form-control" />
<hr />
<button type="submit" name="submit" class="btn btn-info"><span class="glyphicon
glyphicon-user"></span> &nbsp;Log Me In </button>&nbsp;
</div>
</form>
<div class="col-md-6">
<div class="alert alert-info">
This is a free bootstrap admin template with basic pages you need to craft your project.
Use this template for free to use for personal and commercial use.
<br />
<strong> Some of its features are given below :</strong>
<ul>
<li>
Responsive Design Framework Used
</li>
<li>
Easy to use and customize
</li>
<li>
Font awesome icons included
</li>
<li>
Clean and light code used.
</li>
</ul>

</div>
</div>

</div>
</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
</body>
</html>

LOGOUT:

<?php
session_start();
include("includes/config.php");
$_SESSION['login']=="";
date_default_timezone_set('Asia/Kolkata');
$ldate=date( 'd-m-Y h:i:s A', time () );
mysqli_query($con,"UPDATE userlog SET logout = '$ldate' WHERE studentRegno =
'".$_SESSION['login']."' ORDER BY id DESC LIMIT 1");
session_unset();
$_SESSION['errmsg']="You have successfully logout";
?>
<script language="javascript">
document.location="index.php";
</script>

MY-PROFILE
<?php
session_start();
error_reporting(0);
include("includes/config.php");
if(isset($_POST['submit']))
{
$regno=$_POST['regno'];
$password=md5($_POST['password']);
$query=mysqli_query($con,"SELECT * FROM students WHERE StudentRegno='$regno' and
password='$password'");
$num=mysqli_fetch_array($query);
if($num>0)
{
$extra="change-password.php";//
$_SESSION['login']=$_POST['regno'];
$_SESSION['id']=$num['studentRegno'];
$_SESSION['sname']=$num['studentName'];
$uip=$_SERVER['REMOTE_ADDR'];
$status=1;
$log=mysqli_query($con,"insert into userlog(studentRegno,userip,status)
values('".$_SESSION['login']."','$uip','$status')");
$host=$_SERVER['HTTP_HOST'];
$uri=rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
header("location:http://$host$uri/$extra");
exit();
}
else
{
$_SESSION['errmsg']="Invalid Reg no or Password";
$extra="index.php";
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
header("location:http://$host$uri/$extra");
exit();
}
}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />

<title>Student Login</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/style.css" rel="stylesheet" />
</head>
<body>
<?php include('includes/header.php');?>
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h4 class="page-head-line">Please Login To Enter </h4>

</div>

</div>
<span style="color:red;" ><?php echo htmlentities($_SESSION['errmsg']); ?><?php echo
htmlentities($_SESSION['errmsg']="");?></span>
<form name="admin" method="post">
<div class="row">
<div class="col-md-6">
<label>Enter Reg no : </label>
<input type="text" name="regno" class="form-control" />
<label>Enter Password : </label>
<input type="password" name="password" class="form-control" />
<hr />
<button type="submit" name="submit" class="btn btn-info"><span class="glyphicon
glyphicon-user"></span> &nbsp;Log Me In </button>&nbsp;
</div>
</form>
<div class="col-md-6">
<div class="alert alert-info">
This is a free bootstrap admin template with basic pages you need to craft your project.
Use this template for free to use for personal and commercial use.
<br />
<strong> Some of its features are given below :</strong>
<ul>
<li>
Responsive Design Framework Used
</li>
<li>
Easy to use and customize
</li>
<li>
Font awesome icons included
</li>
<li>
Clean and light code used.
</li>
</ul>

</div>
</div>

</div>
</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
</body>
</html>

PINCOD VERIFICATION

<?php
session_start();
include('includes/config.php');
error_reporting(0);
if(strlen($_SESSION['login'])==0)
{
header('location:index.php');
}
else{
date_default_timezone_set('Asia/Kolkata');// change according timezone
$currentTime = date( 'd-m-Y h:i:s A', time () );
if(isset($_POST['submit']))
{
$sql=mysqli_query($con,"SELECT * FROM students where pincode='".trim($_POST['pincode'])."' &&
StudentRegno='".$_SESSION['login']."'");
$num=mysqli_fetch_array($sql);
if($num>0)
{
$_SESSION['pcode']=$_POST['pincode'];
header("location:enroll.php");
}
else
{
$_SESSION['msg']="Error :Wrong Pincode. Please Enter a Valid Pincode !!";
}
}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Pincode Verification</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/style.css" rel="stylesheet" />
</head>

<body>
<?php include('includes/header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['login']!="")
{
include('includes/menubar.php');
}
?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Student Pincode Verification</h1>
</div>
</div>
<div class="row" >
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Pincode Verification
</div>
<font color="red" align="center"><?php echo htmlentities($_SESSION['msg']);?><?php echo
htmlentities($_SESSION['msg']="");?></font>

<div class="panel-body">
<form name="pincodeverify" method="post">
<div class="form-group">
<label for="pincode">Enter Pincode</label>
<input type="password" class="form-control" id="pincode" name="pincode" placeholder="Pincode"
required />
</div>

<button type="submit" name="submit" class="btn btn-default">Verify</button>


<hr />

</form>
</div>
</div>
</div>

</div>
</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
</body>
</html>
<?php } ?>

ENROLL
<?php
session_start();
include('includes/config.php');
error_reporting(0);
if(strlen($_SESSION['login'])==0 or strlen($_SESSION['pcode'])==0)
{
header('location:index.php');
}
else{

if(isset($_POST['submit']))
{
$studentregno=$_POST['studentregno'];
$pincode=$_POST['Pincode'];
$session=$_POST['session'];
$dept=$_POST['department'];
$level=$_POST['level'];
$course=$_POST['course'];
$sem=$_POST['sem'];
$ret=mysqli_query($con,"insert into
courseenrolls(studentRegno,pincode,session,department,level,course,semester)
values('$studentregno','$pincode','$session','$dept','$level','$course','$sem')");
if($ret)
{
$_SESSION['msg']="Enroll Successfully !!";
}
else
{
$_SESSION['msg']="Error : Not Enroll";
}
}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Course Enroll</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/style.css" rel="stylesheet" />
</head>

<body>
<?php include('includes/header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['login']!="")
{
include('includes/menubar.php');
}
?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Course Enroll </h1>
</div>
</div>
<div class="row" >
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Course Enroll
</div>
<font color="green" align="center"><?php echo htmlentities($_SESSION['msg']);?><?php echo
htmlentities($_SESSION['msg']="");?></font>
<?php $sql=mysqli_query($con,"select * from students where StudentRegno='".$_SESSION['login']."'");
$cnt=1;
while($row=mysqli_fetch_array($sql))
{ ?>

<div class="panel-body">
<form name="dept" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="studentname">Student Name </label>
<input type="text" class="form-control" id="studentname" name="studentname" value="<?php echo
htmlentities($row['studentName']);?>" />
</div>
<div class="form-group">
<label for="studentregno">Student Reg No </label>
<input type="text" class="form-control" id="studentregno" name="studentregno" value="<?php echo
htmlentities($row['StudentRegno']);?>" placeholder="Student Reg no" readonly />

</div>

<div class="form-group">
<label for="Pincode">Pincode </label>
<input type="text" class="form-control" id="Pincode" name="Pincode" readonly value="<?php echo
htmlentities($row['pincode']);?>" required />
</div>

<div class="form-group">
<label for="Pincode">Student Photo </label>
<?php if($row['studentPhoto']==""){ ?>
<img src="studentphoto/noimage.png" width="200" height="200"><?php } else {?>
<img src="studentphoto/<?php echo htmlentities($row['studentPhoto']);?>" width="200"
height="200">
<?php } ?>
</div>
<?php } ?>

<div class="form-group">
<label for="Session">Session </label>
<select class="form-control" name="session" required="required">
<option value="">Select Session</option>
<?php
$sql=mysqli_query($con,"select * from session");
while($row=mysqli_fetch_array($sql))
{
?>
<option value="<?php echo htmlentities($row['id']);?>"><?php echo
htmlentities($row['session']);?></option>
<?php } ?>

</select>
</div>

<div class="form-group">
<label for="Department">Department </label>
<select class="form-control" name="department" required="required">
<option value="">Select Depertment</option>
<?php
$sql=mysqli_query($con,"select * from department");
while($row=mysqli_fetch_array($sql))
{
?>
<option value="<?php echo htmlentities($row['id']);?>"><?php echo
htmlentities($row['department']);?></option>
<?php } ?>

</select>
</div>

<div class="form-group">
<label for="Level">Level </label>
<select class="form-control" name="level" required="required">
<option value="">Select Level</option>
<?php
$sql=mysqli_query($con,"select * from level");
while($row=mysqli_fetch_array($sql))
{
?>
<option value="<?php echo htmlentities($row['id']);?>"><?php echo
htmlentities($row['level']);?></option>
<?php } ?>

</select>
</div>

<div class="form-group">
<label for="Semester">Semester </label>
<select class="form-control" name="sem" required="required">
<option value="">Select Semester</option>
<?php
$sql=mysqli_query($con,"select * from semester");
while($row=mysqli_fetch_array($sql))
{
?>
<option value="<?php echo htmlentities($row['id']);?>"><?php echo
htmlentities($row['semester']);?></option>
<?php } ?>
</select>
</div>

<div class="form-group">
<label for="Course">Course </label>
<select class="form-control" name="course" id="course" onBlur="courseAvailability()"
required="required">
<option value="">Select Course</option>
<?php
$sql=mysqli_query($con,"select * from course");
while($row=mysqli_fetch_array($sql))
{
?>
<option value="<?php echo htmlentities($row['id']);?>"><?php echo
htmlentities($row['courseName']);?></option>
<?php } ?>
</select>
<span id="course-availability-status1" style="font-size:12px;">
</div>

<button type="submit" name="submit" id="submit" class="btn btn-default">Enroll</button>


</form>
</div>
</div>
</div>

</div>

</div>

</div>
</div>
<?php include('includes/footer.php');?>
<script src="assets/js/jquery-1.11.1.js"></script>
<script src="assets/js/bootstrap.js"></script>
<script>
function courseAvailability() {
$("#loaderIcon").show();
jQuery.ajax({
url: "check_availability.php",
data:'cid='+$("#course").val(),
type: "POST",
success:function(data){
$("#course-availability-status1").html(data);
$("#loaderIcon").hide();
},
error:function (){}
});
}
</script>

</body>
</html>
<?php } ?>

ENROLL HISTORY
<?php
session_start();
include('includes/config.php');
error_reporting(0);
if(strlen($_SESSION['login'])==0)
{
header('location:index.php');
}
else{

?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Enroll History</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/style.css" rel="stylesheet" />
</head>

<body>
<?php include('includes/header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['login']!="")
{
include('includes/menubar.php');
}
?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Enroll History </h1>
</div>
</div>
<div class="row" >

<div class="col-md-12">
<!-- Bordered Table -->
<div class="panel panel-default">
<div class="panel-heading">
Enroll History
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="table-responsive table-bordered">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Course Name </th>
<th>Session </th>
<th> Department</th>
<th>Level</th>
<th>Semester</th>
<th>Enrollment Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$sql=mysqli_query($con,"select courseenrolls.course as cid, course.courseName as
courname,session.session as session,department.department as dept,level.level as
level,courseenrolls.enrollDate as edate ,semester.semester as sem from courseenrolls join course on
course.id=courseenrolls.course join session on session.id=courseenrolls.session join department on
department.id=courseenrolls.department join level on level.id=courseenrolls.level join semester on
semester.id=courseenrolls.semester where courseenrolls.studentRegno='".$_SESSION['login']."'");
$cnt=1;
while($row=mysqli_fetch_array($sql))
{
?>

<tr>
<td><?php echo $cnt;?></td>
<td><?php echo htmlentities($row['courname']);?></td>
<td><?php echo htmlentities($row['session']);?></td>
<td><?php echo htmlentities($row['dept']);?></td>
<td><?php echo htmlentities($row['level']);?></td>
<td><?php echo htmlentities($row['sem']);?></td>
<td><?php echo htmlentities($row['edate']);?></td>
<td>
<a href="print.php?id=<?php echo $row['cid']?>" target="_blank">
<button class="btn btn-primary"><i class="fa fa-print "></i> Print</button> </a>

</td>
</tr>
<?php
$cnt++;
} ?>

</tbody>
</table>
</div>
</div>
</div>
<!-- End Bordered Table -->
</div>
</div>
</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
</body>
</html>
<?php } ?>

CHECK AVAILABILITY
<?php
session_start();
require_once("includes/config.php");
if(!empty($_POST["cid"])) {
$cid= $_POST["cid"];
$regid=$_SESSION['login'];
$result =mysqli_query($con,"SELECT studentRegno FROM ​ courseenrolls WHERE
course='$cid' and studentRegno=' $regid'");
$count=mysqli_num_rows($result);
if($count>0)
{
echo "<span style='color:red'> Already Applied for this course.</span>";
echo "<script>$('#submit').prop('disabled',true);</script>";
}
}
if(!empty($_POST["cid"])) {
$cid= $_POST["cid"];

$result =mysqli_query($con,"SELECT * FROM courseenrolls WHERE course='$cid'");


$count=mysqli_num_rows($result);
$result1 =mysqli_query($con,"SELECT noofSeats FROM course WHERE id='$cid'");
$row=mysqli_fetch_array($result1);
$noofseat=$row['noofSeats'];
if($count>=$noofseat)
{
echo "<span style='color:red'> Seat not available for this course. All Seats Are full</span>";
echo "<script>$('#submit').prop('disabled',true);</script>";
}
}

?>

CHANGE PASSWORD

<?php
session_start();
include('includes/config.php');
error_reporting(0);
if(strlen($_SESSION['login'])==0)
{
header('location:index.php');
}
else{
date_default_timezone_set('Asia/Kolkata');// change according timezone
$currentTime = date( 'd-m-Y h:i:s A', time () );

if(isset($_POST['submit']))
{
$sql=mysqli_query($con,"SELECT password FROM students where
password='".md5($_POST['cpass'])."' && studentRegno='".$_SESSION['login']."'");
$num=mysqli_fetch_array($sql);
if($num>0)
{
$con=mysqli_query($con,"update students set password='".md5($_POST['newpass'])."',
updationDate='$currentTime' where studentRegno='".$_SESSION['login']."'");
$_SESSION['msg']="Password Changed Successfully !!";
}
else
{
$_SESSION['msg']="Current Password not match !!";
}
}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Admin | Student Password</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/style.css" rel="stylesheet" />
</head>
<script type="text/javascript">
function valid()
{
if(document.chngpwd.cpass.value=="")
{
alert("Current Password Filed is Empty !!");
document.chngpwd.cpass.focus();
return false;
}
else if(document.chngpwd.newpass.value=="")
{
alert("New Password Filed is Empty !!");
document.chngpwd.newpass.focus();
return false;
}
else if(document.chngpwd.cnfpass.value=="")
{
alert("Confirm Password Filed is Empty !!");
document.chngpwd.cnfpass.focus();
return false;
}
else if(document.chngpwd.newpass.value!= document.chngpwd.cnfpass.value)
{
alert("Password and Confirm Password Field do not match !!");
document.chngpwd.cnfpass.focus();
return false;
}
return true;
}
</script>
<body>
<?php include('includes/header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['login']!="")
{
include('includes/menubar.php');
}
?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Student Change Password </h1>
</div>
</div>
<div class="row" >
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Change Password
</div>
<font color="green" align="center"><?php echo htmlentities($_SESSION['msg']);?><?php echo
htmlentities($_SESSION['msg']="");?></font>

<div class="panel-body">
<form name="chngpwd" method="post" onSubmit="return valid();">
<div class="form-group">
<label for="exampleInputPassword1">Current Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" name="cpass"
placeholder="Password" />
</div>
<div class="form-group">
<label for="exampleInputPassword1">New Password</label>
<input type="password" class="form-control" id="exampleInputPassword2" name="newpass"
placeholder="Password" />
</div>
<div class="form-group">
<label for="exampleInputPassword1">Confirm Password</label>
<input type="password" class="form-control" id="exampleInputPassword3" name="cnfpass"
placeholder="Password" />
</div>

<button type="submit" name="submit" class="btn btn-default">Submit</button>


<hr />
</form>
</div>
</div>
</div>

</div>
</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
</body>
</html>
<?php } ?>

COURSE
<?php
session_start();
include('includes/config.php');
if(strlen($_SESSION['alogin'])==0)
{
header('location:index.php');
}
else{

if(isset($_POST['submit']))
{
$coursecode=$_POST['coursecode'];
$coursename=$_POST['coursename'];
$courseunit=$_POST['courseunit'];
$seatlimit=$_POST['seatlimit'];
$ret=mysqli_query($con,"insert into course(courseCode,courseName,courseUnit,noofSeats)
values('$coursecode','$coursename','$courseunit','$seatlimit')");
if($ret)
{
$_SESSION['msg']="Course Created Successfully !!";
}
else
{
$_SESSION['msg']="Error : Course not created";
}
}
if(isset($_GET['del']))
{
mysqli_query($con,"delete from course where id = '".$_GET['id']."'");
$_SESSION['delmsg']="Course deleted !!";
}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Admin | Course</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/style.css" rel="stylesheet" />
</head>

<body>
<?php include('includes/header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['alogin']!="")
{
include('includes/menubar.php');
}
?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Course </h1>
</div>
</div>
<div class="row" >
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Course
</div>
<font color="green" align="center"><?php echo htmlentities($_SESSION['msg']);?><?php echo
htmlentities($_SESSION['msg']="");?></font>

<div class="panel-body">
<form name="dept" method="post">
<div class="form-group">
<label for="coursecode">Course Code </label>
<input type="text" class="form-control" id="coursecode" name="coursecode" placeholder="Course
Code" required />
</div>

<div class="form-group">
<label for="coursename">Course Name </label>
<input type="text" class="form-control" id="coursename" name="coursename" placeholder="Course
Name" required />
</div>

<div class="form-group">
<label for="courseunit">Course unit </label>
<input type="text" class="form-control" id="courseunit" name="courseunit" placeholder="Course
Unit" required />
</div>

<div class="form-group">
<label for="seatlimit">Seat limit </label>
<input type="text" class="form-control" id="seatlimit" name="seatlimit" placeholder="Seat limit"
required />
</div>

<button type="submit" name="submit" class="btn btn-default">Submit</button>


</form>
</div>
</div>
</div>

</div>
<font color="red" align="center"><?php echo htmlentities($_SESSION['delmsg']);?><?php
echo htmlentities($_SESSION['delmsg']="");?></font>
<div class="col-md-12">
<!-- Bordered Table -->
<div class="panel panel-default">
<div class="panel-heading">
Manage Course
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="table-responsive table-bordered">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Course Code</th>
<th>Course Name </th>
<th>Course Unit</th>
<th>Seat limit</th>
<th>Creation Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$sql=mysqli_query($con,"select * from course");
$cnt=1;
while($row=mysqli_fetch_array($sql))
{
?>

<tr>
<td><?php echo $cnt;?></td>
<td><?php echo htmlentities($row['courseCode']);?></td>
<td><?php echo htmlentities($row['courseName']);?></td>
<td><?php echo htmlentities($row['courseUnit']);?></td>
<td><?php echo htmlentities($row['noofSeats']);?></td>
<td><?php echo htmlentities($row['creationDate']);?></td>
<td>
<a href="edit-course.php?id=<?php echo $row['id']?>">
<button class="btn btn-primary"><i class="fa fa-edit "></i> Edit</button> </a>
<a href="course.php?id=<?php echo $row['id']?>&del=delete" onClick="return confirm('Are you sure
you want to delete?')">
<button class="btn btn-danger">Delete</button>
</a>
</td>
</tr>
<?php
$cnt++;
} ?>

</tbody>
</table>
</div>
</div>
</div>
<!-- End Bordered Table -->
</div>
</div>

</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
</body>
</html>
<?php } ?>

EDIT COURSE
<?php
session_start();
include('includes/config.php');
if(strlen($_SESSION['alogin'])==0)
{
header('location:index.php');
}
else{
$id=intval($_GET['id']);
date_default_timezone_set('Asia/Kolkata');// change according timezone
$currentTime = date( 'd-m-Y h:i:s A', time () );
if(isset($_POST['submit']))
{
$coursecode=$_POST['coursecode'];
$coursename=$_POST['coursename'];
$courseunit=$_POST['courseunit'];
$seatlimit=$_POST['seatlimit'];
$ret=mysqli_query($con,"update course set
courseCode='$coursecode',courseName='$coursename',courseUnit='$courseunit',noofSeats='$seatlimit',u
pdationDate='$currentTime' where id='$id'");
if($ret)
{
$_SESSION['msg']="Course Updated Successfully !!";
}
else
{
$_SESSION['msg']="Error : Course not Updated";
}
}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Admin | Course</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/style.css" rel="stylesheet" />
</head>

<body>
<?php include('includes/header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['alogin']!="")
{
include('includes/menubar.php');
}
?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Course </h1>
</div>
</div>
<div class="row" >
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Course
</div>
<font color="green" align="center"><?php echo htmlentities($_SESSION['msg']);?><?php echo
htmlentities($_SESSION['msg']="");?></font>

<div class="panel-body">
<form name="dept" method="post">
<?php
$sql=mysqli_query($con,"select * from course where id='$id'");
$cnt=1;
while($row=mysqli_fetch_array($sql))
{
?>
<p><b>Last Updated at</b> :<?php echo htmlentities($row['updationDate']);?></p>
<div class="form-group">
<label for="coursecode">Course Code </label>
<input type="text" class="form-control" id="coursecode" name="coursecode" placeholder="Course
Code" value="<?php echo htmlentities($row['courseCode']);?>" required />
</div>

<div class="form-group">
<label for="coursename">Course Name </label>
<input type="text" class="form-control" id="coursename" name="coursename" placeholder="Course
Name" value="<?php echo htmlentities($row['courseName']);?>" required />
</div>

<div class="form-group">
<label for="courseunit">Course unit </label>
<input type="text" class="form-control" id="courseunit" name="courseunit" placeholder="Course
Unit" value="<?php echo htmlentities($row['courseUnit']);?>" required />
</div>

<div class="form-group">
<label for="seatlimit">Seat limit </label>
<input type="text" class="form-control" id="seatlimit" name="seatlimit" placeholder="Seat limit"
value="<?php echo htmlentities($row['noofSeats']);?>" required />
</div>

<?php } ?>
<button type="submit" name="submit" class="btn btn-default"><i class=" fa fa-refresh "></i>
Update</button>
</form>
</div>
</div>
</div>

</div>

</div>

</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
</body>
</html>
<?php } ?>

SEMESTER
<?php
session_start();
include('includes/config.php');
if(strlen($_SESSION['alogin'])==0)
{
header('location:index.php');
}
else{

if(isset($_POST['submit']))
{
$semester=$_POST['semester'];
$ret=mysqli_query($con,"insert into semester(semester) values('$semester')");
if($ret)
{
$_SESSION['msg']="Semester Created Successfully !!";
}
else
{
$_SESSION['msg']="Error : Semester not created";
}
}
if(isset($_GET['del']))
{
mysqli_query($con,"delete from semester where id = '".$_GET['id']."'");
$_SESSION['delmsg']="semester deleted !!";
}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Admin | Semester</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/style.css" rel="stylesheet" />
</head>

<body>
<?php include('includes/header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['alogin']!="")
{
include('includes/menubar.php');
}
?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Semester </h1>
</div>
</div>
<div class="row" >
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Semester
</div>
<font color="green" align="center"><?php echo htmlentities($_SESSION['msg']);?><?php echo
htmlentities($_SESSION['msg']="");?></font>

<div class="panel-body">
<form name="semester" method="post">
<div class="form-group">
<label for="semester">Add Semester </label>
<input type="text" class="form-control" id="semester" name="semester" placeholder="semester"
required />
</div>
<button type="submit" name="submit" class="btn btn-default">Submit</button>
</form>
</div>
</div>
</div>

</div>
<font color="red" align="center"><?php echo htmlentities($_SESSION['delmsg']);?><?php
echo htmlentities($_SESSION['delmsg']="");?></font>
<div class="col-md-12">
<!-- Bordered Table -->
<div class="panel panel-default">
<div class="panel-heading">
Manage Semester
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="table-responsive table-bordered">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Semester</th>
<th>Creation Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$sql=mysqli_query($con,"select * from semester");
$cnt=1;
while($row=mysqli_fetch_array($sql))
{
?>

<tr>
<td><?php echo $cnt;?></td>
<td><?php echo htmlentities($row['semester']);?></td>
<td><?php echo htmlentities($row['creationDate']);?></td>
<td>
<a href="semester.php?id=<?php echo $row['id']?>&del=delete" onClick="return confirm('Are you sure
you want to delete?')">
<button class="btn btn-danger">Delete</button>
</a>
</td>
</tr>
<?php
$cnt++;
} ?>

</tbody>
</table>
</div>
</div>
</div>
<!-- End Bordered Table -->
</div>
</div>
</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.js"></script>
</body>
</html>
<?php } ?>

NEWS
<?php
session_start();
include('includes/config.php');
if(strlen($_SESSION['alogin'])==0)
{
header('location:index.php');
}else{

// Code for News Insertion


if(isset($_POST['submit']))
{
$ntitle=$_POST['newstitle'];
$ndescription=$_POST['description'];
$ret=mysqli_query($con,"insert into news(newstitle,newsDescription) values('$ntitle','$ndescription')");
if($ret)
{
echo '<script>alert("News added successfully")</script>';
echo "<script>window.location.href='news.php'</script>";
}else {
echo '<script>alert("Something went wrong. Please try again.")</script>';
echo "<script>window.location.href='news.php'</script>";
}
}

//Code Deletion
if(isset($_GET['del']))
{
$nid=$_GET['id'];
mysqli_query($con,"delete from news where id ='$nid'");
echo '<script>alert("News deleted succesfully.")</script>';
echo '<script>window.location.href=news.php</script>';
}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Admin | News</title>
<link href="../assets/css/bootstrap.css" rel="stylesheet" />
<link href="../assets/css/font-awesome.css" rel="stylesheet" />
<link href="../assets/css/style.css" rel="stylesheet" />
</head>

<body>
<?php include('includes/header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['alogin']!="")
{
include('includes/menubar.php');
}
?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">News </h1>
</div>
</div>
<div class="row" >
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
News
</div>
<div class="panel-body">
<form name="dept" method="post">
<div class="form-group">
<label for="department">News Title </label>
<input type="text" class="form-control" id="newstitle" name="newstitle" placeholder="News Title"
required />
</div>

<div class="form-group">
<label for="department">News description </label>
<textarea class="form-control" id="description" name="description" placeholder="News Description"
required></textarea>
</div>
<button type="submit" name="submit" class="btn btn-default">Submit</button>
</form>
</div>
</div>
</div>

</div>
<div class="col-md-12">
<!-- Bordered Table -->
<div class="panel panel-default">
<div class="panel-heading">
Manage Session
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="table-responsive table-bordered">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>News Title</th>
<th>News Description</th>
<th>Creation Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$sql=mysqli_query($con,"select * from news");
$cnt=1;
while($row=mysqli_fetch_array($sql))
{
?>

<tr>
<td><?php echo $cnt;?></td>
<td><?php echo htmlentities($row['newstitle']);?></td>
<td><?php echo htmlentities($row['newsDescription']);?></td>
<td><?php echo htmlentities($row['postingDate']);?></td>
<td>
<a href="news.php?id=<?php echo $row['id']?>&del=delete" onClick="return confirm('Are you sure
you want to delete?')">
<button class="btn btn-danger">Delete</button>
</a>
</td>
</tr>
<?php
$cnt++;
} ?>

</tbody>
</table>
</div>
</div>
</div>
<!-- End Bordered Table -->
</div>
</div>

</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('../includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="../assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="../assets/js/bootstrap.js"></script>
</body>
</html>
<?php } ?>

SESSION

<?php
session_start();
include('includes/config.php');
if(strlen($_SESSION['alogin'])==0)
{
header('location:index.php');
}
else{

// Code for Insertion


if(isset($_POST['submit']))
{
$sesssion=$_POST['sesssion'];
$ret=mysqli_query($con,"insert into session(session) values('$sesssion')");
if($ret)
{
echo '<script>alert("Session Created Successfully !!")</script>';
echo '<script>window.location.href=session.php</script>';
}else{
echo '<script>alert("Error : Session not created")</script>';
echo '<script>window.location.href=session.php</script>';
}
}

// Code for Deletion


if(isset($_GET['del']))
{
mysqli_query($con,"delete from session where id = '".$_GET['id']."'");
echo '<script>alert("Session Deleted")</script>';
echo '<script>window.location.href=session.php</script>';
}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Admin | Session</title>
<link href="../assets/css/bootstrap.css" rel="stylesheet" />
<link href="../assets/css/font-awesome.css" rel="stylesheet" />
<link href="../assets/css/style.css" rel="stylesheet" />
</head>

<body>
<?php include('includes/header.php');?>
<!-- LOGO HEADER END-->
<?php if($_SESSION['alogin']!="")
{
include('includes/menubar.php');
}
?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Add session </h1>
</div>
</div>
<div class="row" >
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Session
</div>
<font color="green" align="center"><?php echo htmlentities($_SESSION['msg']);?><?php echo
htmlentities($_SESSION['msg']="");?></font>

<div class="panel-body">
<form name="session" method="post">
<div class="form-group">
<label for="session">Create Session </label>
<input type="text" class="form-control" id="sesssion" name="sesssion" placeholder="Session" />
</div>
<button type="submit" name="submit" class="btn btn-default">Submit</button>
</form>
</div>
</div>
</div>

</div>
<font color="red" align="center"><?php echo htmlentities($_SESSION['delmsg']);?><?php
echo htmlentities($_SESSION['delmsg']="");?></font>
<div class="col-md-12">
<!-- Bordered Table -->
<div class="panel panel-default">
<div class="panel-heading">
Manage Session
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="table-responsive table-bordered">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Session</th>
<th>Creation Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$sql=mysqli_query($con,"select * from session");
$cnt=1;
while($row=mysqli_fetch_array($sql))
{
?>

<tr>
<td><?php echo $cnt;?></td>
<td><?php echo htmlentities($row['session']);?></td>
<td><?php echo htmlentities($row['creationDate']);?></td>
<td>
<a href="session.php?id=<?php echo $row['id']?>&del=delete" onClick="return confirm('Are you sure
you want to delete?')">
<button class="btn btn-danger">Delete</button>
</a>
</td>
</tr>
<?php
$cnt++;
} ?>

</tbody>
</table>
</div>
</div>
</div>
<!-- End Bordered Table -->
</div>
</div>

</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php');?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY SCRIPTS -->
<script src="../assets/js/jquery-1.11.1.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="../assets/js/bootstrap.js"></script>
</body>
</html>
<?php } ?>

You might also like