Maharishi University of Information Technology LUCKNOW (UP) - 226013

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 77

MAHARISHI UNIVERSITY OF INFORMATION TECHNOLOGY

LUCKNOW (UP) -226013

A PROJECT REPORT

ON

“HOSTEL MANAGEMENT SYSTEM”

A disseration work with used in partial Fulfillment of the award of the


Degree of

BACHELOR OF COMPUTER SCIENCE

Submitted By:
Aniket Rawat
Roll No. 1601034202002
Bachelor of Computer Science

Under The Guidance of


Dr. Shweta Dwivedi
Assistant Professor

MAHARISHI UNIVERSITY OF INFORMATION TECHNOLOGY


LUCKNOW (UP) -226013
MAHARISHI UNIVERSITY OF INFORMATION TECHNOLOGY
LUCKNOW (UP) -226013

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CERTIFICATE

This is to certify that thesis entitled "HOSTEL MANAGEMENT SYSTEM” submitted by Aniket
Rawat in partial fulfillment of the requirement for the award of Bachelor of Computer Science
Speciualization during session 2018-2019 in Computer Science Maharishi University of
Information Technology is a record of student's own carried under my supervision and guidance.
The projet report embodies of original work under my supevision and guidance. The Project report
embodies result of original wotk and srudies cattied out by student and the content does not from the
basis for the award of any other degree of candidate or to anybody else.

Date: SIGNATURE OF GUIDE


Dr. Shweta Dwivedi
Assistant Professor
DECLARATION

We hereby declare that the project entitled “HOSTEL MANAGEMENT SYSTEM” submitted by

us in the partial fulfilment of the requirements for the award of the degree of Bachelor of Computer

Science of Maharishi University of Information Technology Lucknow (UP) -226013 is record of

our own work carried under the Guide of Dr. Shweta Dwivedi (Assistant Professor).

To the best of our knowledge this project has not been submitted to Bachelor of Computer Science

of Maharishi University of Information Technology Lucknow (UP) -226013 or any other

University or Institute For the award of any degree.

Aniket Rawat
Roll No. 1601034202002
Bachelor of Computer Science
ACKNOWLEDGEMENT

It gives a great pleasure to present the report of the “HOSTEL MANAGEMENT SYSTEM”

Project undertaken during BSC (CS) final year. We owe special debt of gratitude to Dr. Shweta

Dwivedi

Assistant Professor, Department of Bachelor of Computer Science Maharishi University of

Information Technology Lucknow (UP) -226013 for her constant support guidance throughout the

course of our work.

We also take the opportunity to acknowledge the contribution of Dr. Shweta Dwivedi Assistant

Professor, Head of Department Bachelor of Computer Science Maharishi University of Information

Technology Lucknow (UP) -226013, for his full support and assistance during the development of the

project.

We also do not like to miss the opportunity to acknowledge the contribution of all faculty members of

their department for their kind assistance and cooperation during the development of the project. Last

but not least, we acknowledge our friends for their

contribution in the completion of the project.


ABSTRACT

“HOSTEL MANAGEMENT SYSTEM” is software developed for managing various activities in the

hostel. For the past few years the numbers of educational institutions are increasing rapidly. Thereby

the numbers of hostels are also increasing for the accommodation of the students studying in this

institution. And hence there is a lot of strain on the person who are running the hostel and software’s

are not usually used in this context. This particular project deals with the problems on managing a

hostel and avoids the problems which occur when carried manually. Identification of the drawbacks

of the existing system leads to the designing of computerized system that will be compatible to the

existing system with the system which is more users friendly and more GUI oriented.
TABLE OF CONTENTS

1. INTRODUCTION

1.1 PROBLEM DEFINITION

1.2 OBJECTIVES OF PROJECT

2. SYSTEM ENVIRONMENT

2.1 HARDWARE CONFIGURATION

2.2 SOFTWARE CONFIGURATION

3. SYSTEM ANALYSIS

3.1 EXISTING SYSTEM

3.2 PROPOSED SYSTEM

3.3 SOFTWARE TOOL USED

4. SYSTEM DESIGN

4.1 TABLE DESIGN

4.2 DATA FLOW DIAGRAM’S

5. SYSTEM IMPLEMENTATION

5.1 SCREEN SHOTS & CODING

6. SYSTEM TESTING

6.1 UNIT TESTING

6.2 INTEGRATION TESTING

7. CONCLUSION

8. BIBILIOGRAPHY
INTRODUCTION

PROBLEM DEFINITION-This system is designed in favor of the hostel management which helps

them to save the records of the students about their rooms and other things. It helps them from the

manual work from which it is very difficult to find the record of the students and the mess bills of the

students, and the information of about the those ones who had left the hostel. All the hostels at

present are managed manually by the hostel office. The Registration form verification to the different

data processing is done manually. Thus there are a lot of repetitions which can be easily avoided. And

hence there is a lot of strain on the person who are running the hostel and software’s are not usually

used in this context. This particular project deals with the problems on managing a hostel and avoids

the problems which occur when carried manually Identification of the drawbacks of the existing

system leads to the designing of computerized system that will be compatible to the existing system

with the system which is more user friendly. We can improve the efficiency of the system, thus

overcome the drawbacks of the existing system. We design this system of the hostel management

especially for the college hostel, through this they cannot require so efficient person to handle and

calculate the things. This system automatically calculates all the bills and issued the notifications for

those students who are against some rules.


OBJECTIVES OF PROJECT- This software product the hostel management to improve their

services for all the students of the hostel. This also reduce the manual work of the persons in admin

penal and the bundle of registers that were search when to find the information of a previous student,

because through this system you can store the data of those students who had left the hostel . Through

this you can check the personal profile of all the current students within few minutes the data base of

the system will help you to check a particular one. The system will help you to check the mess bills of

every student and the student’s hostel dues. The students of the hostel will be recognized from the ID

number allocated at the room rental time. In the last this system will improve the management work

in the hostel.

 To automate each and every activity of the manual system, which increases its throughput.

 To provide a quick response with very accurate information as and when required.

 To make the present manual system more interactive, speedy and user friendly.

 To avail any information, whatever and whenever needed.

 Reduce the cost of maintenance.


SYSTEM ENVIRONMENT

HARDWARE CONFIGURATION

Processor : Dual Core Processor

RAM : 512MB

Hard Disk : 500GB

Monitor : 15” Color Monitor

Mouse

Keyboard

SOFTWARE CONFIGURATION

Language : PHP

Database : MYSQL

Server : Apache

SYSTEM ANALYSIS

EXISTING SYSTEM- For the past few years the numbers of educational institutions are increasing

rapidly. Thereby the numbers of hostels are also increasing for the accommodation of the students

studying in this institution. And hence there is a lot of strain on the person who are running the hostel

and software’s are not usually used in this context. This particular project deals with the problems on

managing a hostel and avoids the problems which occur when carried manually Identification of the

drawbacks of the existing system leads to the designing of computerized system that will be

compatible to the existing system with the system which is more user friendly and more GUI

oriented. We can improve the efficiency of the system, thus overcome the following drawbacks of the

existing system.
· More human error.

· More strength and strain of manual labor needed.

· Repetition of the same procedures.

· Low security

· Data redundancy

. Difficult to handle

· Difficult to update data

· Record keeping is difficult

· Backup data can be easily generated

PROPOSED SYSTEM- The drawback of the existing system is that it is very difficult to retrieve

data from records. It is difficult to handle the whole system manually and it is less accurate and to

keep the data in records for future reference because it may get destroyed. Moreover it is very

difficult to retrieve data. Redundancy of data may occur and this may lead to the inconsistency. The

manual system is so time-consuming. The proposed system is very easy to operate. Speed and

accuracy are the main advantages of proposed system. There is no redundancy of data. The data are

stored in the computer secondary memories like hard disk, etc. it can be easily receive and used at any

time. The proposed system will easily handle all the data and the work done by the existing systems.

The proposed systems eliminate the drawbacks of the existing system to a great extent and it provides

tight security to data.


SOFTWARE TOOL USED- The whole Project is divided in two parts the front end and the back

end. Front end The front end is designed using of Php, CSS, Java script.

PHP-PHPis a server-side scripting language designed for web development but also used as a

general-purpose programming language. PHP is now installed on more than 244 million websites and

2.1 million web servers. Originally created by Rasmus Lerdorf in 1995, the reference implementation

of PHP is now produced by The PHP Group. While PHP originally stood for Personal Home Page, it

now stands for PHP: Hypertext Preprocessor, a recursive backronym.PHP code is interpreted by a

web server with a PHP processor module, which generates the resulting web page: PHP commands

can be embedded directly into an HTML source document rather than calling an external file to

process data. It has also evolved to include a command-line interface capability and can be used in

standalone graphical applications. PHP is free software released under the PHP License. PHP can be

deployed on most web servers and also as a standalone shell on almost every operating system and

platform, free of charge.

CSS- CSS Stands for "Cascading Style Sheet." Cascading style sheets are used to format the layout

of Web pages. They can be used to define text styles, table sizes, and other aspects of Web pages that

previously could only be defined in a page's HTML. The basic purpose of CSS is to separate the

content of a web document (written in any markup language)from its presentation (that is written

using Cascading Style Sheets). There are lots of benefits that one can extract through CSS like

improved content accessibility, better flexibility and moreover, CSS gives a level of control over

various presentation characteristics of the document. It also helps in reducing the complexity and
helps in saving overall presentation time. CSS gives the option of selecting various style schemes and

rules according to the requirements and it also allows the same HTML document to be presented in

more than one varying style.

JAVA SCRIPT-JavaScript is considered to be one of the most famous scripting languages of all

time. JavaScript, by definition, is a Scripting Language of the World Wide Web. The main usage of

JavaScript is to add various Web functionalities, Web form validations, browser detections, creation

of cookies and so on. JavaScript is one of the most popular scripting languages and that is why it is

supported by almost all web browsers available today like Firefox, We used the browser Opera or

Internet Explorer. JavaScript is considered to be one of the most powerful scripting languages in use

today. It is often used for the development of client-side web development. JavaScript is used to

make web pages more interactive and dynamic. JavaScript is a light weight programming language

and it is embedded directly into the HTML code. JavaScript, as the name suggests, was influenced by

many languages, especially Java. 3.3.2

BACK END-The back end is designed using mysql which is used to design the databases

MYSQL- MySQL ("My S-Q-L", officially, but also called "My Sequel") is (as of July 2013) the

world's second most widely used open-source relational database management system (RDBMS). It is

named after co-founder Michael Widenius daughter, My. The SQL phrase stands for Structured

Query Language. The MySQL development project has made its source code available under the

terms of the GNU General Public License, as well as under a variety of proprietary agreements.

MySQL was owned and sponsored by a single for-profit firm, the Swedish company MySQL AB,
now owned by Oracle Corporation .MySQL is a popular choice of database for use in web

applications, and is central components of the widely used LAMP open source web application

software stack (and other 'AMP' stacks). LAMP is an acronym for "Linux, Apache, MySQL,

Perl/PHP/Python." Free-software-open source projects that require a full-featured database

management system often use MySQL. For commercial use, several paid editions are available, and

offer additional functionality.

SYSTEM DESIGN(TABLES)

TABLE DESIGN -The following are the tables that are involved in the proposed system.

USER LOGIN-
ADMIN-
ADMIN LOGS-
USER REGISTRATION-

ROOMS-
COURSES-

STATES-
REGISTRATION-

SYSTEM IMPLEMENTATION-SCREENSHOTS
USERLOGIN

USER DASHBOARD
ADMIN LOGIN

ADMIN DASHBOARD
BOOK HOTEL
USER REGISTRATION
ROOMS
COURSES

MY PROFILE
CHANGE PASSWORD

ACCESS LOG(USER)
ACCESS LOG(ADMIN)
DATA FLOW DIAGRAM’S

LEVEL 0

LEVEL1

LEVEL 2
CODING
ADMIN MODULE
Dashboard.php-

<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();

?>
<!doctype html>
<html lang="en" class="no-js">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">

<title>DashBoard</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">

</head>

<body>
<?php include("includes/header.php");?>

<div class="ts-main-content">
<?php include("includes/sidebar.php");?>
<div class="content-wrapper">
<div class="container-fluid">

<div class="row">
<div class="col-md-12">

<h2 class="page-title">Dashboard</h2>

<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-body bk-
primary text-light">
<div class="stat-
panel text-center">

<?php
$result ="SELECT count(*) FROM registration ";
$stmt = $mysqli->prepare($result);
$stmt->execute();
$stmt->bind_result($count);
$stmt->fetch();
$stmt->close();
?>

<div
class="stat-panel-number h1 "><?php echo $count;?></div>
<div
class="stat-panel-title text-uppercase"> Students</div>
</div>
</div>
<a href="manage-
students.php" class="block-anchor panel-footer">Full Detail <i class="fa fa-arrow-right"></i></a>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-body bk-
success text-light">
<div class="stat-
panel text-center">
<?php
$result1 ="SELECT count(*) FROM rooms ";
$stmt1 = $mysqli->prepare($result1);
$stmt1->execute();
$stmt1->bind_result($count1);
$stmt1->fetch();
$stmt1->close();
?>
<div
class="stat-panel-number h1 "><?php echo $count1;?></div>
<div
class="stat-panel-title text-uppercase">Total Rooms </div>
</div>
</div>
<a href="manage-
rooms.php" class="block-anchor panel-footer text-center">See All &nbsp; <i class="fa fa-arrow-right"></i></a>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-body bk-
info text-light">
<div class="stat-
panel text-center">
<?php
$result2 ="SELECT count(*) FROM courses ";
$stmt2 = $mysqli->prepare($result2);
$stmt2->execute();
$stmt2->bind_result($count2);
$stmt2->fetch();
$stmt2->close();
?>
<div
class="stat-panel-number h1 "><?php echo $count2;?></div>
<div
class="stat-panel-title text-uppercase">Total Courses</div>
</div>
</div>
<a href="manage-
courses.php" class="block-anchor panel-footer text-center">See All &nbsp; <i class="fa fa-arrow-right"></i></a>
</div>
</div>

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

</div>
</div>

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

<!-- Loading Scripts -->


<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>
<script>

window.onload = function(){

// Line chart from swirlData for dashReport


var ctx = document.getElementById("dashReport").getContext("2d");
window.myLine = new Chart(ctx).Line(swirlData, {
responsive: true,
scaleShowVerticalLines: false,
scaleBeginAtZero : true,
multiTooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>",
});

// Pie Chart from doughutData


var doctx = document.getElementById("chart-area3").getContext("2d");
window.myDoughnut = new Chart(doctx).Pie(doughnutData, {responsive : true});

// Dougnut Chart from doughnutData


var doctx = document.getElementById("chart-area4").getContext("2d");
window.myDoughnut = new Chart(doctx).Doughnut(doughnutData, {responsive : true});

}
</script>

</body>

</html>

Edit-Course.php-
<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();
//code for add courses
if($_POST['submit'])
{
$coursecode=$_POST['cc'];
$coursesn=$_POST['cns'];
$coursefn=$_POST['cnf'];
$id=$_GET['id'];
$query="update courses set course_code=?,course_sn=?,course_fn=? where id=?";
$stmt = $mysqli->prepare($query);
$rc=$stmt->bind_param('sssi',$coursecode,$coursesn,$coursefn,$id);
$stmt->execute();
echo"<script>alert('Course has been Updated successfully');</script>";
}

?>
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Edit Course</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">>
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.11.3-jquery.min.js"></script>
<script type="text/javascript" src="js/validation.min.js"></script>
</head>
<body>
<?php include('includes/header.php');?>
<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">

<h2 class="page-title">Edit Course </h2>

<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">Edit courses</div>
<div class="panel-body">
<form method="post" class="form-
horizontal">
<?php
$id=$_GET['id'];
$ret="select * from courses where id=?";
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('i',$id);
$stmt->execute() ;//ok
$res=$stmt->get_result();
//$cnt=1;
while($row=$res->fetch_object())
{
?>
<div class="hr-dashed"></div>
<div class="form-group">
<label class="col-sm-2 control-label">Course Code </label>
<div class="col-sm-8">
<input type="text" name="cc" value="<?php echo $row->course_code;?>" class="form-
control"></div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Course Name (Short)</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="cns" id="cns" value="<?php echo $row->course_sn;?>" required="required">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Course
Name(Full)</label>
<div class="col-sm-8">
<input type="text" class="form-control"
name="cnf" value="<?php echo $row->course_fn;?>" >
</div>
</div>

<?php } ?>
<div class="col-
sm-8 col-sm-offset-2">

<input
class="btn btn-primary" type="submit" name="submit" value="Update Course">
</div>
</div>

</form>

</div>
</div>

</div>

</div>
</div>

</div>
</div>

</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>

</script>
</body>

</html>

Edit-room.php-
<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();
//code for add courses
if($_POST['submit'])
{
$seater=$_POST['seater'];
$fees=$_POST['fees'];
$id=$_GET['id'];
$query="update rooms set seater=?,fees=? where id=?";
$stmt = $mysqli->prepare($query);
$rc=$stmt->bind_param('iii',$seater,$fees,$id);
$stmt->execute();
echo"<script>alert('Room Details has been Updated successfully');</script>";
}

?>
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Edit Room Details</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">>
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.11.3-jquery.min.js"></script>
<script type="text/javascript" src="js/validation.min.js"></script>
</head>
<body>
<?php include('includes/header.php');?>
<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">

<div class="row">
<div class="col-md-12">

<h2 class="page-title">Edit Room Details </h2>

<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">Edit Room
Details</div>
<div class="panel-body">
<form method="post" class="form-
horizontal">
<?php
$id=$_GET['id'];
$ret="select * from rooms where id=?";
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('i',$id);
$stmt->execute() ;//ok
$res=$stmt->get_result();
//$cnt=1;
while($row=$res->fetch_object())
{
?>
<div class="hr-dashed"></div>
<div class="form-group">
<label class="col-sm-2 control-label">Seater </label>
<div class="col-sm-8">
<input type="text" name="seater" value="<?php echo $row->seater;?>" class="form-
control"></div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Room no </label>
<div class="col-sm-8">
<input type="text" class="form-control" name="rmno" id="rmno" value="<?php echo $row->room_no;?>" disabled>
<span class="help-block m-b-none">
Room
no can't be changed.</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Fees (PM)
</label>
<div class="col-sm-8">
<input type="text" class="form-control"
name="fees" value="<?php echo $row->fees;?>" >
</div>
</div>

<?php } ?>
<div class="col-
sm-8 col-sm-offset-2">

<input
class="btn btn-primary" type="submit" name="submit" value="Update Room Details ">
</div>
</div>

</form>

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>

</script>
</body>

</html>

Full-profile.php-
<?php
session_start();
include("includes/config.php");
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "hostel";
$prefix = "";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
mysql_select_db($mysql_database, $bd) or die("Could not select database");
?>
<script language="javascript" type="text/javascript">
function f2()
{
window.close();
}
function f3()
{
window.print();
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Student Information</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="hostel.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="100%" border="0">
<?php
$ret= mysql_query("SELECT * FROM registration where id = '".$_GET['id']."'");
while($row=mysql_fetch_array($ret))
{
?>
<tr>
<td colspan="2" align="center" class="font1">&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="center" class="font1">&nbsp;</td>
</tr>

<tr>
<td colspan="2" class="font"><?php echo ucfirst($row['firstName']);?><?php echo ucfirst($row['lastName']);?>'S
<span class="font1"> information &raquo;</span></td>
</tr>
<tr>
<td colspan="2"
class="font">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<div align="right">Reg Date : <span class="comb-value"><?php echo $row['postingDate'];?></span></div></td>
</tr>
<tr>
<td colspan="2" class="heading" style="color: red;">Room Related Info &raquo; </td>
</tr>
<tr>
<td colspan="2" class="font1"><table width="100%" border="0">
<tr>
<td width="32%" valign="top" class="heading">Room no : </td>

<td class="comb-value1"><span class="comb-value"><?php echo $row['roomno'];?></span></td>


</tr>
<tr>
<td width="22%" valign="top" class="heading">Seater : </td>

<td class="comb-value1"><span class="comb-value"><?php echo $row['seater'];?></span></td>


</tr>

<tr>
<td width="12%" valign="top" class="heading">Fees PM : </td>
<td class="comb-value1"><?php echo $fpm=$row['feespm'];?></td>
</tr>
<tr>
<td width="12%" valign="top" class="heading">Food Status: </td>
<td class="comb-value1"><?php if($row['foodstatus']==0)
{
echo "Without Food";
}
else
{
echo "With Food";
}
;?></td>
</tr>
<tr>
<td width="12%" valign="top" class="heading">Staying From: </td>
<td class="comb-value1"><?php echo $row['stayfrom'];?></td>
</tr>
<tr>
<td width="12%" valign="top" class="heading">Duration: </td>
<td class="comb-value1"><?php echo $dr=$row['duration'];?></td>
</tr>
<tr>
<td width="12%" valign="top" class="heading">Total Fee: </td>
<td class="comb-value1">
<?php if($row['foodstatus']==1)
{
$fd=2000;
echo (($dr*$fpm)+$fd);
}
else
{
echo $dr*$fpm;
}
?></td>
</tr>
<tr>
<td colspan="2" align="left" class="heading" style="color: red;">Personal Info &raquo; </td>
</tr>
<tr>
<td width="12%" valign="top" class="heading">Course: </td>
<td class="comb-value1"><?php echo $row['course'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Reg no: </td>
<td class="comb-value1"><?php echo $row['regno'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">First Name: </td>
<td class="comb-value1"><?php echo $row['firstName'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Middle name: </td>
<td class="comb-value1"><?php echo $row['middleName'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Last: </td>
<td class="comb-value1"><?php echo $row['lastName'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Gender: </td>
<td class="comb-value1"><?php echo $row['gender'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Contact No: </td>
<td class="comb-value1"><?php echo $row['contactno'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Email id: </td>
<td class="comb-value1"><?php echo $row['emailid'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Emergency Contact: </td>
<td class="comb-value1"><?php echo $row['egycontactno'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Guardian Name: </td>
<td class="comb-value1"><?php echo $row['guardianName'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Guardian Relation: </td>
<td class="comb-value1"><?php echo $row['guardianRelation'];?></td>
</tr>
<tr>
<td width="12%" valign="top" class="heading">Guardian Contact: </td>
<td class="comb-value1"><?php echo $row['guardianContactno'];?></td>
</tr>
<tr>
<td colspan="2" class="heading" style="color: red;">Correspondence Address &raquo; </td>
</tr>
<tr>
<td width="12%" valign="top" class="heading">Address: </td>
<td class="comb-value1"><?php echo $row['corresAddress'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">City: </td>
<td class="comb-value1"><?php echo $row['corresCIty'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">State: </td>
<td class="comb-value1"><?php echo $row['corresState'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Pincode: </td>
<td class="comb-value1"><?php echo $row['corresPincode'];?></td>
</tr>
<tr>
<td colspan="2" class="heading" style="color: red;">Permanent Address &raquo; </td>
</tr>
<tr>
<td width="12%" valign="top" class="heading">Address: </td>
<td class="comb-value1"><?php echo $row['pmntAddress'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">City: </td>
<td class="comb-value1"><?php echo $row['pmntCity'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">State: </td>
<td class="comb-value1"><?php echo $row['pmnatetState'];?></td>
</tr>

<tr>
<td width="12%" valign="top" class="heading">Pincode: </td>
<td class="comb-value1"><?php echo $row['pmntPincode'];?></td>
</tr>
<tr>
<td width="12%" valign="top" class="heading">State: </td>
<td class="comb-value1"><?php echo $row['pmnatetState'];?></td>
</tr>
<?php } ?>

</table></td>
</tr>

</table></td>
</tr>
</table></td>
</tr>

</table></td>
</tr>

<tr>
<td colspan="2" align="right" ><form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="14%">&nbsp;</td>
<td width="35%" class="comb-value"><label>
<input name="Submit" type="submit" class="txtbox4" value="Prints this Document " onClick="return f3();" />
</label></td>
<td width="3%">&nbsp;</td>
<td width="26%"><label>
<input name="Submit2" type="submit" class="txtbox4" value="Close this document " onClick="return f2();" />
</label></td>
<td width="8%">&nbsp;</td>
<td width="14%">&nbsp;</td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</table>
</body>
</html>

Get_seater.php-
<?php
include('includes/pdoconfig.php');
if(!empty($_POST["roomid"]))
{
$id=$_POST['roomid'];
$stmt = $DB_con->prepare("SELECT * FROM rooms WHERE room_no = :id");
$stmt->execute(array(':id' => $id));
?>
<?php
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<?php echo htmlentities($row['seater']); ?>
<?php
}
}

if(!empty($_POST["rid"]))
{
$id=$_POST['rid'];
$stmt = $DB_con->prepare("SELECT * FROM rooms WHERE room_no = :id");
$stmt->execute(array(':id' => $id));
?>
<?php
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<?php echo htmlentities($row['fees']); ?>
<?php
}
}

?>

Index.php-
<?php
session_start();
include('includes/config.php');
if(isset($_POST['login']))
{
$username=$_POST['username'];
$password=$_POST['password'];
$stmt=$mysqli->prepare("SELECT username,email,password,id FROM admin WHERE (userName=?|| email=?) and password=? ");
$stmt->bind_param('sss',$username,$username,$password);
$stmt->execute();
$stmt -> bind_result($username,$username,$password,$id);
$rs=$stmt->fetch();
$_SESSION['id']=$id;
$uip=$_SERVER['REMOTE_ADDR'];
$ldate=date('d/m/Y h:i:s', time());
if($rs)
{
// $insert="INSERT into admin(adminid,ip)VALUES(?,?)";
// $stmtins = $mysqli->prepare($insert);
// $stmtins->bind_param('sH',$id,$uip);
//$res=$stmtins->execute();
header("location:admin-profile.php");
}

else
{
echo "<script>alert('Invalid Username/Email or password');</script>";
}
}
?>

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>Admin login</title>

<link rel="stylesheet" href="css/font-awesome.min.css">


<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
</head
<body>

<div class="login-page bk-img" style="background-image: url(img/login-bg.jpg);">


<div class="form-content">
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1 class="text-center text-bold text-light mt-4x">Hostel Management System</h1>
<div class="well row pt-2x pb-3x bk-light">
<div class="col-md-8 col-md-offset-2">

<form action="" class="mt" method="post">


<label for="" class="text-uppercase text-sm">Your
Username or Email</label>
<input type="text" placeholder="Username"
name="username" class="form-control mb">
<label for="" class="text-uppercase text-
sm">Password</label>
<input type="password" placeholder="Password"
name="password" class="form-control mb">

<input type="submit" name="login" class="btn


btn-primary btn-block" value="login" >
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>
</body>
</html>

Logout.php-
<?php
session_start();
unset($_SESSION['id']);
session_destroy();
header('Location:../index.php');
?>

Manage-courses.php-
<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();

if(isset($_GET['del']))
{
$id=intval($_GET['del']);
$adn="delete from courses where id=?";
$stmt= $mysqli->prepare($adn);
$stmt->bind_param('i',$id);
$stmt->execute();
$stmt->close();
echo "<script>alert('Data Deleted');</script>" ;
}
?>
<!doctype html>
<html lang="en" class="no-js">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Manage Courses</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
</head>

<body>
<?php include('includes/header.php');?>

<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2 class="page-title">Manage Course</h2>
<div class="panel panel-default">
<div class="panel-heading">All Courses Details</div>
<div class="panel-body">
<table id="zctb" class="display table table-striped table-
bordered table-hover" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sno.</th>
<th>Course Code</th>
<th>Course
Name(Short)</th>
<th>Course
Name(Full)</th>
<th>Reg Date </th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Sl No</th>
<th>Course Code</th>
<th>Course
Name(Short)</th>
<th>Course
Name(Full)</th>
<th>Regd Date</th>
<th>Action</th>
</tr>
</tfoot>
<tbody>
<?php
$aid=$_SESSION['id'];
$ret="select * from courses";
$stmt= $mysqli->prepare($ret) ;
//$stmt->bind_param('i',$aid);
$stmt->execute() ;//ok
$res=$stmt->get_result();
$cnt=1;
while($row=$res->fetch_object())
{
?>
<tr><td><?php echo $cnt;;?></td>
<td><?php echo $row->course_code;?></td>
<td><?php echo $row->course_sn;?></td>
<td><?php echo $row->course_fn;?></td>
<td><?php echo $row->posting_date;?></td>
<td><a href="edit-course.php?id=<?php echo $row->id;?>"><i class="fa fa-edit"></i></a>&nbsp;&nbsp;
<a href="manage-courses.php?del=<?php echo $row->id;?>" onclick="return confirm("Do you want to delete");"><i class="fa fa-close"></i></a></td>
</tr>
<?php
$cnt=$cnt+1;
} ?>

</tbody>
</table>

</div>
</div>

</div>
</div>

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

<!-- Loading Scripts -->


<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>

</body>

</html>

Manage-rooms.php-
<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();

if(isset($_GET['del']))
{
$id=intval($_GET['del']);
$adn="delete from rooms where id=?";
$stmt= $mysqli->prepare($adn);
$stmt->bind_param('i',$id);
$stmt->execute();
$stmt->close();
echo "<script>alert('Data Deleted');</script>" ;
}
?>
<!doctype html>
<html lang="en" class="no-js">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Manage Rooms</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
</head>

<body>
<?php include('includes/header.php');?>

<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2 class="page-title">Manage Rooms</h2>
<div class="panel panel-default">
<div class="panel-heading">All Room Details</div>
<div class="panel-body">
<table id="zctb" class="display table table-striped table-
bordered table-hover" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sno.</th>

<th>Seater</th>
<th>Room No.</th>
<th>Fees (PM) </th>

<th>Posting Date </th>


<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Sno.</th>
<th>Seater</th>
<th>Room No.</th>

<th>Fees (PM) </th>


<th>Posting Date </th>
<th>Action</th>
</tr>
</tfoot>
<tbody>
<?php
$aid=$_SESSION['id'];
$ret="select * from rooms";
$stmt= $mysqli->prepare($ret) ;
//$stmt->bind_param('i',$aid);
$stmt->execute() ;//ok
$res=$stmt->get_result();
$cnt=1;
while($row=$res->fetch_object())
{
?>
<tr><td><?php echo $cnt;;?></td>
<td><?php echo $row->seater;?></td>
<td><?php echo $row->room_no;?></td>
<td><?php echo $row->fees;?></td>
<td><?php echo $row->posting_date;?></td>
<td><a href="edit-room.php?id=<?php echo $row->id;?>"><i class="fa fa-edit"></i></a>&nbsp;&nbsp;
<a href="manage-rooms.php?del=<?php echo $row->id;?>" onclick="return confirm("Do you want to delete");"><i class="fa fa-close"></i></a></td>
</tr>
<?php
$cnt=$cnt+1;
} ?>

</tbody>
</table>

</div>
</div>

</div>
</div>

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

<!-- Loading Scripts -->


<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>

</body>

</html>

Manage-students.php-
<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();

if(isset($_GET['del']))
{
$id=intval($_GET['del']);
$adn="delete from registration where id=?";
$stmt= $mysqli->prepare($adn);
$stmt->bind_param('i',$id);
$stmt->execute();
$stmt->close();
echo "<script>alert('Data Deleted');</script>" ;
}
?>
<!doctype html>
<html lang="en" class="no-js">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Manage Rooms</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
<script language="javascript" type="text/javascript">
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
if(popUpWin)
{
if(!popUpWin.closed) popUpWin.close();
}
popUpWin = open(URLStr,'popUpWin',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+510+',height='+430+',left='+left+',
top='+top+',screenX='+left+',screenY='+top+'');
}
</script>

</head>

<body>
<?php include('includes/header.php');?>

<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2 class="page-title">Manage Rooms</h2>
<div class="panel panel-default">
<div class="panel-heading">All Room Details</div>
<div class="panel-body">
<table id="zctb" class="display table table-striped table-
bordered table-hover" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sno.</th>
<th>Student Name</th>
<th>Reg no</th>
<th>Contact no </th>
<th>room no </th>
<th>Seater </th>
<th>Staying From </th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Sno.</th>
<th>Student Name</th>
<th>Reg no</th>
<th>Contact no </th>
<th>Room no </th>
<th>Seater </th>
<th>Staying From </th>
<th>Action</th>
</tr>
</tfoot>
<tbody>
<?php
$aid=$_SESSION['id'];
$ret="select * from registration";
$stmt= $mysqli->prepare($ret) ;
//$stmt->bind_param('i',$aid);
$stmt->execute() ;//ok
$res=$stmt->get_result();
$cnt=1;
while($row=$res->fetch_object())
{
?>
<tr><td><?php echo $cnt;;?></td>
<td><?php echo $row->firstName;?><?php echo $row->middleName;?><?php echo $row->lastName;?></td>
<td><?php echo $row->regno;?></td>
<td><?php echo $row->contactno;?></td>
<td><?php echo $row->roomno;?></td>
<td><?php echo $row->seater;?></td>
<td><?php echo $row->stayfrom;?></td>
<td>
<a href="javascript:void(0);" onClick="popUpWindow('http://localhost/hostel/admin/full-profile.php?id=<?php echo $row->id;?>');" title="View Full
Details"><i class="fa fa-desktop"></i></a>&nbsp;&nbsp;
<a href="manage-students.php?del=<?php echo $row->id;?>" title="Delete Record" onclick="return confirm("Do you want to delete");"><i class="fa
fa-close"></i></a></td>
</tr>
<?php
$cnt=$cnt+1;
} ?>

</tbody>
</table>

</div>
</div>

</div>
</div>

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

<!-- Loading Scripts -->


<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>

</body>

</html>

Registration.php-
<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();
//code for registration
if($_POST['submit'])
{
$roomno=$_POST['room'];
$seater=$_POST['seater'];
$feespm=$_POST['fpm'];
$foodstatus=$_POST['foodstatus'];
$stayfrom=$_POST['stayf'];
$duration=$_POST['duration'];
$course=$_POST['course'];
$regno=$_POST['regno'];
$fname=$_POST['fname'];
$mname=$_POST['mname'];
$lname=$_POST['lname'];
$gender=$_POST['gender'];
$contactno=$_POST['contact'];
$emailid=$_POST['email'];
$emcntno=$_POST['econtact'];
$gurname=$_POST['gname'];
$gurrelation=$_POST['grelation'];
$gurcntno=$_POST['gcontact'];
$caddress=$_POST['address'];
$ccity=$_POST['city'];
$cstate=$_POST['state'];
$cpincode=$_POST['pincode'];
$paddress=$_POST['paddress'];
$pcity=$_POST['pcity'];
$pstate=$_POST['pstate'];
$ppincode=$_POST['ppincode'];
$query="insert into
registration(roomno,seater,feespm,foodstatus,stayfrom,duration,course,regno,firstName,middleName,lastName,gender,contactno,emailid,egycontactno,g
uardianName,guardianRelation,guardianContactno,corresAddress,corresCIty,corresState,corresPincode,pmntAddress,pmntCity,pmnatetState,pmntPinco
de) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $mysqli->prepare($query);
$rc=$stmt-
>bind_param('iiiisisissssisississsisssi',$roomno,$seater,$feespm,$foodstatus,$stayfrom,$duration,$course,$regno,$fname,$mname,$lname,$gender,$cont
actno,$emailid,$emcntno,$gurname,$gurrelation,$gurcntno,$caddress,$ccity,$cstate,$cpincode,$paddress,$pcity,$pstate,$ppincode);
$stmt->execute();
$stmt->close();

$query1="insert into userregistration(regNo,firstName,middleName,lastName,gender,contactNo,email,password) values(?,?,?,?,?,?,?,?)";


$stmt1= $mysqli->prepare($query1);
$stmt1->bind_param('sssssiss',$regno,$fname,$mname,$lname,$gender,$contactno,$emailid,$contactno);
$stmt1->execute();
echo"<script>alert('Student Succssfully register');</script>";
}
?>

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Student Hostel Registration</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">>
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.11.3-jquery.min.js"></script>
<script type="text/javascript" src="js/validation.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script>
function getSeater(val) {
$.ajax({
type: "POST",
url: "get_seater.php",
data:'roomid='+val,
success: function(data){
//alert(data);
$('#seater').val(data);
}
});

$.ajax({
type: "POST",
url: "get_seater.php",
data:'rid='+val,
success: function(data){
//alert(data);
$('#fpm').val(data);
}
});
}
</script>

</head>
<body>
<?php include('includes/header.php');?>
<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">

<div class="row">
<div class="col-md-12">

<h2 class="page-title">Registration </h2>

<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">Fill all Info</div>
<div class="panel-body">
<form method="post" action=""
class="form-horizontal">

<div class="form-group">
<label class="col-sm-4 control-label"><h4 style="color: green" align="left">Room Related info </h4></label>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Room no. </label>
<div class="col-sm-8">
<select name="room" id="room"class="form-control" onChange="getSeater(this.value);" onBlur="checkAvailability()" required>
<option value="">Select Room</option>
<?php $query ="SELECT * FROM rooms";
$stmt2 = $mysqli->prepare($query);
$stmt2->execute();
$res=$stmt2->get_result();
while($row=$res->fetch_object())
{
?>
<option value="<?php echo $row->room_no;?>"><?php echo $row->room_no;?></option>
<?php } ?>
</select>
<span id="room-availability-status" style="font-size:12px;"></span>

</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Seater</label>
<div class="col-sm-8">
<input type="text" name="seater" id="seater" class="form-control" >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Fees Per Month</label>
<div class="col-sm-8">
<input type="text" name="fpm" id="fpm" class="form-control" >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Food Status</label>
<div class="col-sm-8">
<input type="radio" value="0" name="foodstatus" checked="checked"> Without Food
<input type="radio" value="1" name="foodstatus"> With Food(Rs 2000.00 Per Month Extra)
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Stay From</label>
<div class="col-sm-8">
<input type="date" name="stayf" id="stayf" class="form-control" >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Duration</label>
<div class="col-sm-8">
<select name="duration" id="duration" class="form-control">
<option value="">Select Duration in Month</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label"><h4 style="color: green" align="left">Personal info </h4></label>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">course </label>
<div class="col-sm-8">
<select name="course" id="course" class="form-control" required>
<option value="">Select Course</option>
<?php $query ="SELECT * FROM courses";
$stmt2 = $mysqli->prepare($query);
$stmt2->execute();
$res=$stmt2->get_result();
while($row=$res->fetch_object())
{
?>
<option value="<?php echo $row->course_fn;?>"><?php echo $row->course_fn;?>&nbsp;&nbsp;(<?php echo $row->course_sn;?>)</option>
<?php } ?>
</select></div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Registration No : </label>
<div class="col-sm-8">
<input type="text" name="regno" id="regno" class="form-control" required="required" >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">First Name : </label>
<div class="col-sm-8">
<input type="text" name="fname" id="fname" class="form-control" required="required" >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Middle Name : </label>
<div class="col-sm-8">
<input type="text" name="mname" id="mname" class="form-control">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Last Name : </label>
<div class="col-sm-8">
<input type="text" name="lname" id="lname" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Gender : </label>
<div class="col-sm-8">
<select name="gender" class="form-control" required="required">
<option value="">Select Gender</option>
<option value="male">Male</option>
<option value="female">Female</option>
<option value="others">Others</option>
</select>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Contact No : </label>
<div class="col-sm-8">
<input type="text" name="contact" id="contact" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Email id : </label>
<div class="col-sm-8">
<input type="email" name="email" id="email" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Emergency Contact: </label>
<div class="col-sm-8">
<input type="text" name="econtact" id="econtact" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Guardian Name : </label>
<div class="col-sm-8">
<input type="text" name="gname" id="gname" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Guardian Relation : </label>
<div class="col-sm-8">
<input type="text" name="grelation" id="grelation" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Guardian Contact no : </label>
<div class="col-sm-8">
<input type="text" name="gcontact" id="gcontact" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-3 control-label"><h4 style="color: green" align="left">Correspondense Address </h4></label>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Address : </label>
<div class="col-sm-8">
<textarea rows="5" name="address" id="address" class="form-control" required="required"></textarea>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">City : </label>
<div class="col-sm-8">
<input type="text" name="city" id="city" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">State </label>
<div class="col-sm-8">
<select name="state" id="state"class="form-control" required>
<option value="">Select State</option>
<?php $query ="SELECT * FROM states";
$stmt2 = $mysqli->prepare($query);
$stmt2->execute();
$res=$stmt2->get_result();
while($row=$res->fetch_object())
{
?>
<option value="<?php echo $row->State;?>"><?php echo $row->State;?></option>
<?php } ?>
</select></div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Pincode : </label>
<div class="col-sm-8">
<input type="text" name="pincode" id="pincode" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-3 control-label"><h4 style="color: green" align="left">Permanent Address </h4></label>
</div>

<div class="form-group">
<label class="col-sm-5 control-label">Permanent Address same as Correspondense address : </label>
<div class="col-sm-4">
<input type="checkbox" name="adcheck" value="1"/>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Address : </label>
<div class="col-sm-8">
<textarea rows="5" name="paddress" id="paddress" class="form-control" required="required"></textarea>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">City : </label>
<div class="col-sm-8">
<input type="text" name="pcity" id="pcity" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">State </label>
<div class="col-sm-8">
<select name="pstate" id="pstate"class="form-control" required>
<option value="">Select State</option>
<?php $query ="SELECT * FROM states";
$stmt2 = $mysqli->prepare($query);
$stmt2->execute();
$res=$stmt2->get_result();
while($row=$res->fetch_object())
{
?>
<option value="<?php echo $row->State;?>"><?php echo $row->State;?></option>
<?php } ?>
</select></div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Pincode : </label>
<div class="col-sm-8">
<input type="text" name="ppincode" id="ppincode" class="form-control" required="required">
</div>
</div>

<div class="col-sm-6 col-sm-offset-4">


<button class="btn btn-default" type="submit">Cancel</button>
<input type="submit" name="submit" Value="Register" class="btn btn-primary">
</div>
</form>

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>
</body>
<script type="text/javascript">
$(document).ready(function(){
$('input[type="checkbox"]').click(function(){
if($(this).prop("checked") == true){
$('#paddress').val( $('#address').val() );
$('#pcity').val( $('#city').val() );
$('#pstate').val( $('#state').val() );
$('#ppincode').val( $('#pincode').val() );
}

});
});
</script>
<script>
function checkAvailability() {
$("#loaderIcon").show();
jQuery.ajax({
url: "check_availability.php",
data:'roomno='+$("#room").val(),
type: "POST",
success:function(data){
$("#room-availability-status").html(data);
$("#loaderIcon").hide();
},
error:function (){}
});
}
</script>

</html>

Access-log.php-
<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();
?>
<!doctype html>
<html lang="en" class="no-js">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Access Log</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
</head>

<body>
<?php include('includes/header.php');?>

<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2 class="page-title">Access Log</h2>
<div class="panel panel-default">
<div class="panel-heading">All Courses Details</div>
<div class="panel-body">
<table id="zctb" class="display table table-striped table-
bordered table-hover" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sno.</th>
<th>User Id</th>
<th>User Email</th>
<th>IP</th>
<th>City</th>
<th>Country</th>
</div>

<div class="col-sm-8 col-sm-offset-2">


<input class="btn btn-primary" type="submit" name="submit" value="Create Room ">
</div>
</div>

</form>

</div>
</div>

</div>

</div>
</div>

</div>
</div>

</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>
</script>
</body>

</html>

Checklogin.php-
<?php
function check_login()
{
if(strlen($_SESSION['id'])==0)
{
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra="index.php";
$_SESSION["id"]="";
header("Location: http://$host$uri/$extra");
}
}
?>

Config.php-
<?php
$dbuser="root";
$dbpass="";
$host="localhost";
$db="hostel";
$mysqli =new mysqli($host,$dbuser, $dbpass, $db);
?>

Dbcontroller.php-
<?php
$DB_host = "localhost";
$DB_user = "root";
$DB_pass = "";
$DB_name = "hostel";
try
{
$DB_con = new PDO("mysql:host={$DB_host};dbname={$DB_name}",$DB_user,$DB_pass);
$DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
$e->getMessage();
}
?>

Header.php-
<div class="brand clearfix">
<a href="#" class="logo" style="font-size:16px;">Hostel Management System</a>
<span class="menu-btn"><i class="fa fa-bars"></i></span>
<ul class="ts-profile-nav">
<li class="ts-account">
<a href="#"><img src="img/ts-avatar.jpg" class="ts-avatar hidden-side" alt=""> Account <i class="fa fa-
angle-down hidden-side"></i></a>
<ul>
<li><a href="admin-profile.php">My Account</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</li>
</ul>
</div>

Pdoconfig.php-
<?php
$DB_host = "localhost";
$DB_user = "root";
$DB_pass = "";
$DB_name = "hostel";
try
{
$DB_con = new PDO("mysql:host={$DB_host};dbname={$DB_name}",$DB_user,$DB_pass);
$DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
$e->getMessage();
}
?>

Sidebar.php-
<nav class="ts-sidebar">
<ul class="ts-sidebar-menu">

<li class="ts-label">Main</li>
<li><a href="dashboard.php"><i class="fa fa-dashboard"></i> Dashboard</a></li>
<li><a href="#"><i class="fa fa-files-o"></i> Courses</a>
<ul>
<li><a href="add-courses.php">Add Courses</a></li>
<li><a href="manage-courses.php">Manage Courses</a></li>
</ul>
</li>
<li><a href="#"><i class="fa fa-desktop"></i> Rooms</a>
<ul>
<li><a href="create-room.php">Add a Room</a></li>
<li><a href="manage-rooms.php">Manage Rooms</a></li>
</ul>
</li>

<li><a href="registration.php"><i class="fa fa-user"></i>Student Registration</a></li>


<li><a href="manage-students.php"><i class="fa fa-users"></i>Manage Students</a></li>
<li><a href="access-log.php"><i class="fa fa-file"></i>User Access logs</a></li>

</nav>
USER-MODULE-

Index.php-
<?php
session_start();
include('includes/config.php');
if(isset($_POST['login']))
{
$email=$_POST['email'];
$password=$_POST['password'];
$stmt=$mysqli->prepare("SELECT email,password,id FROM userregistration WHERE email=? and password=? ");
$stmt->bind_param('ss',$email,$password);
$stmt->execute();
$stmt -> bind_result($email,$password,$id);
$rs=$stmt->fetch();
$stmt->close();
$_SESSION['id']=$id;
$_SESSION['login']=$email;
$uip=$_SERVER['REMOTE_ADDR'];
$ldate=date('d/m/Y h:i:s', time());
if($rs)
{
$uid=$_SESSION['id'];
$uemail=$_SESSION['login'];
$ip=$_SERVER['REMOTE_ADDR'];
$geopluginURL='http://www.geoplugin.net/php.gp?ip='.$ip;
$addrDetailsArr = unserialize(file_get_contents($geopluginURL));
$city = $addrDetailsArr['geoplugin_city'];
$country = $addrDetailsArr['geoplugin_countryName'];
$log="insert into userLog(userId,userEmail,userIp,city,country) values('$uid','$uemail','$ip','$city','$country')";
$mysqli->query($log);
if($log)
{
header("location:dashboard.php");
}
}
else
{
echo "<script>alert('Invalid Username/Email or password');</script>";
}
}
?>

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Student Hostel Registration</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">>
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.11.3-jquery.min.js"></script>
<script type="text/javascript" src="js/validation.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
function valid()
{
if(document.registration.password.value!= document.registration.cpassword.value)
{
alert("Password and Re-Type Password Field do not match !!");
document.registration.cpassword.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<?php include('includes/header.php');?>
<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">

<div class="row">
<div class="col-md-12">

<h2 class="page-title">User Login </h2>

<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="well row pt-2x pb-3x bk-light">
<div class="col-md-8 col-md-offset-2">

<form action="" class="mt" method="post">


<label for="" class="text-uppercase text-
sm">Email</label>
<input type="text" placeholder="Email"
name="email" class="form-control mb">
<label for="" class="text-uppercase text-
sm">Password</label>
<input type="password" placeholder="Password"
name="password" class="form-control mb">

<input type="submit" name="login" class="btn


btn-primary btn-block" value="login" >
</form>
</div>
</div>
<div class="text-center text-light" style="color:black;">
<a href="forgot-password.php" style="color:black;">Forgot
password?</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>
</body>

</html>

Access-log.php-
<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();
?>
<!doctype html>
<html lang="en" class="no-js">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Access Log</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
</head>

<body>
<?php include('includes/header.php');?>

<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2 class="page-title">Access Log</h2>
<div class="panel panel-default">
<div class="panel-heading">All Courses Details</div>
<div class="panel-body">
<table id="zctb" class="display table table-striped table-
bordered table-hover" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sno.</th>
<th>User Id</th>
<th>User Email</th>
<th>IP</th>
<th>City</th>
<th>Country</th>
<th>Login Time</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Sno.</th>
<th>User Id</th>
<th>User Email</th>
<th>IP</th>
<th>City</th>
<th>Country</th>
<th>Login Time</th>
</tr>
</tfoot>
<tbody>
<?php
$aid=$_SESSION['id'];
$ret="select * from userlog where userId=?";
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('i',$aid);
$stmt->execute() ;
$res=$stmt->get_result();
$cnt=1;
while($row=$res->fetch_object())
{
?>
<tr><td><?php echo $cnt;;?></td>
<td><?php echo $row->userId;?></td>
<td><?php echo $row->userEmail;?></td>
<td><?php echo $row->userIp;?></td>
<td><?php echo $row->city;?></td>
<td><?php echo $row->country;?></td>
<td><?php echo $row->loginTime;?></td>
</tr>
<?php
$cnt=$cnt+1;
} ?>

</tbody>
</table>
</div>
</div>

</div>
</div>

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

<!-- Loading Scripts -->


<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>

</body>

</html>

Book-hostel.php-
<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();
//code for registration
if(isset($_POST['submit']))
{
$roomno=$_POST['room'];
$seater=$_POST['seater'];
$feespm=$_POST['fpm'];
$foodstatus=$_POST['foodstatus'];
$stayfrom=$_POST['stayf'];
$duration=$_POST['duration'];
$course=$_POST['course'];
$regno=$_POST['regno'];
$fname=$_POST['fname'];
$mname=$_POST['mname'];
$lname=$_POST['lname'];
$gender=$_POST['gender'];
$contactno=$_POST['contact'];
$emailid=$_POST['email'];
$emcntno=$_POST['econtact'];
$gurname=$_POST['gname'];
$gurrelation=$_POST['grelation'];
$gurcntno=$_POST['gcontact'];
$caddress=$_POST['address'];
$ccity=$_POST['city'];
$cstate=$_POST['state'];
$cpincode=$_POST['pincode'];
$paddress=$_POST['paddress'];
$pcity=$_POST['pcity'];
$pstate=$_POST['pstate'];
$ppincode=$_POST['ppincode'];
$query="insert into
registration(roomno,seater,feespm,foodstatus,stayfrom,duration,course,regno,firstName,middleName,lastName,gender,contactno,emailid,egycontactno,g
uardianName,guardianRelation,guardianContactno,corresAddress,corresCIty,corresState,corresPincode,pmntAddress,pmntCity,pmnatetState,pmntPinco
de) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $mysqli->prepare($query);
$rc=$stmt-
>bind_param('iiiisisissssisississsisssi',$roomno,$seater,$feespm,$foodstatus,$stayfrom,$duration,$course,$regno,$fname,$mname,$lname,$gender,$cont
actno,$emailid,$emcntno,$gurname,$gurrelation,$gurcntno,$caddress,$ccity,$cstate,$cpincode,$paddress,$pcity,$pstate,$ppincode);
$stmt->execute();
echo"<script>alert('Student Succssfully register');</script>";
}
?>
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Student Hostel Registration</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">>
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.11.3-jquery.min.js"></script>
<script type="text/javascript" src="js/validation.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script>
function getSeater(val) {
$.ajax({
type: "POST",
url: "get_seater.php",
data:'roomid='+val,
success: function(data){
//alert(data);
$('#seater').val(data);
}
});

$.ajax({
type: "POST",
url: "get_seater.php",
data:'rid='+val,
success: function(data){
//alert(data);
$('#fpm').val(data);
}
});
}
</script>

</head>
<body>
<?php include('includes/header.php');?>
<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">

<div class="row">
<div class="col-md-12">

<h2 class="page-title">Registration </h2>

<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">Fill all Info</div>
<div class="panel-body">
<form method="post" action=""
class="form-horizontal">
<?php
$uid=$_SESSION['login'];
$stmt=$mysqli->prepare("SELECT emailid FROM registration WHERE
emailid=? ");
$stmt->bind_param('s',$uid);
$stmt->execute();
$stmt -> bind_result($email);
$rs=$stmt->fetch();
$stmt->close();
if($rs)
{ ?>
<h3 style="color: red" align="left">Hostel already booked by you</h3>
<?php }
else{
echo "";
}
?>
<div class="form-group">
<label class="col-sm-4 control-label"><h4 style="color: green" align="left">Room Related info </h4></label>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Room no. </label>
<div class="col-sm-8">
<select name="room" id="room"class="form-control" onChange="getSeater(this.value);" onBlur="checkAvailability()" required>
<option value="">Select Room</option>
<?php $query ="SELECT * FROM rooms";
$stmt2 = $mysqli->prepare($query);
$stmt2->execute();
$res=$stmt2->get_result();
while($row=$res->fetch_object())
{
?>
<option value="<?php echo $row->room_no;?>"><?php echo $row->room_no;?></option>
<?php } ?>
</select>
<span id="room-availability-status" style="font-size:12px;"></span>

</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Seater</label>
<div class="col-sm-8">
<input type="text" name="seater" id="seater" class="form-control" >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Fees Per Month</label>
<div class="col-sm-8">
<input type="text" name="fpm" id="fpm" class="form-control" >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Food Status</label>
<div class="col-sm-8">
<input type="radio" value="0" name="foodstatus" checked="checked"> Without Food
<input type="radio" value="1" name="foodstatus"> With Food(Rs 2000.00 Per Month Extra)
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Stay From</label>
<div class="col-sm-8">
<input type="date" name="stayf" id="stayf" class="form-control" >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Duration</label>
<div class="col-sm-8">
<select name="duration" id="duration" class="form-control">
<option value="">Select Duration in Month</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Total Amount</label>
<div class="col-sm-8">
<input type="text" name="ta" id="ta" class="result form-control" >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label"><h4 style="color: green" align="left">Personal info </h4></label>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">course </label>
<div class="col-sm-8">
<select name="course" id="course" class="form-control" required>
<option value="">Select Course</option>
<?php $query ="SELECT * FROM courses";
$stmt2 = $mysqli->prepare($query);
$stmt2->execute();
$res=$stmt2->get_result();
while($row=$res->fetch_object())
{
?>
<option value="<?php echo $row->course_fn;?>"><?php echo $row->course_fn;?>&nbsp;&nbsp;(<?php echo $row->course_sn;?>)</option>
<?php } ?>
</select></div>
</div>

<?php
$aid=$_SESSION['id'];
$ret="select * from userregistration where id=?";
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('i',$aid);
$stmt->execute() ;//ok
$res=$stmt->get_result();
//$cnt=1;
while($row=$res->fetch_object())
{
?>

<div class="form-group">
<label class="col-sm-2 control-label">Registration No : </label>
<div class="col-sm-8">
<input type="text" name="regno" id="regno" class="form-control" value="<?php echo $row->regNo;?>" readonly >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">First Name : </label>
<div class="col-sm-8">
<input type="text" name="fname" id="fname" class="form-control" value="<?php echo $row->firstName;?>" readonly>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Middle Name : </label>
<div class="col-sm-8">
<input type="text" name="mname" id="mname" class="form-control" value="<?php echo $row->middleName;?>" readonly>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Last Name : </label>
<div class="col-sm-8">
<input type="text" name="lname" id="lname" class="form-control" value="<?php echo $row->lastName;?>" readonly>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Gender : </label>
<div class="col-sm-8">
<input type="text" name="gender" value="<?php echo $row->gender;?>" class="form-control" readonly>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Contact No : </label>
<div class="col-sm-8">
<input type="text" name="contact" id="contact" value="<?php echo $row->contactNo;?>" class="form-control" readonly>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Email id : </label>
<div class="col-sm-8">
<input type="email" name="email" id="email" class="form-control" value="<?php echo $row->email;?>" readonly>
</div>
</div>
<?php } ?>
<div class="form-group">
<label class="col-sm-2 control-label">Emergency Contact: </label>
<div class="col-sm-8">
<input type="text" name="econtact" id="econtact" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Guardian Name : </label>
<div class="col-sm-8">
<input type="text" name="gname" id="gname" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Guardian Relation : </label>
<div class="col-sm-8">
<input type="text" name="grelation" id="grelation" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Guardian Contact no : </label>
<div class="col-sm-8">
<input type="text" name="gcontact" id="gcontact" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-3 control-label"><h4 style="color: green" align="left">Correspondense Address </h4></label>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Address : </label>
<div class="col-sm-8">
<textarea rows="5" name="address" id="address" class="form-control" required="required"></textarea>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">City : </label>
<div class="col-sm-8">
<input type="text" name="city" id="city" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">State </label>
<div class="col-sm-8">
<select name="state" id="state"class="form-control" required>
<option value="">Select State</option>
<?php $query ="SELECT * FROM states";
$stmt2 = $mysqli->prepare($query);
$stmt2->execute();
$res=$stmt2->get_result();
while($row=$res->fetch_object())
{
?>
<option value="<?php echo $row->State;?>"><?php echo $row->State;?></option>
<?php } ?>
</select></div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Pincode : </label>
<div class="col-sm-8">
<input type="text" name="pincode" id="pincode" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-3 control-label"><h4 style="color: green" align="left">Permanent Address </h4></label>
</div>

<div class="form-group">
<label class="col-sm-5 control-label">Permanent Address same as Correspondense address : </label>
<div class="col-sm-4">
<input type="checkbox" name="adcheck" value="1"/>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Address : </label>
<div class="col-sm-8">
<textarea rows="5" name="paddress" id="paddress" class="form-control" required="required"></textarea>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">City : </label>
<div class="col-sm-8">
<input type="text" name="pcity" id="pcity" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">State </label>
<div class="col-sm-8">
<select name="pstate" id="pstate"class="form-control" required>
<option value="">Select State</option>
<?php $query ="SELECT * FROM states";
$stmt2 = $mysqli->prepare($query);
$stmt2->execute();
$res=$stmt2->get_result();
while($row=$res->fetch_object())
{
?>
<option value="<?php echo $row->State;?>"><?php echo $row->State;?></option>
<?php } ?>
</select></div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Pincode : </label>
<div class="col-sm-8">
<input type="text" name="ppincode" id="ppincode" class="form-control" required="required">
</div>
</div>

<div class="col-sm-6 col-sm-offset-4">


<button class="btn btn-default" type="submit">Cancel</button>
<input type="submit" name="submit" Value="Register" class="btn btn-primary">
</div>
</form>

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>
</body>
<script type="text/javascript">
$(document).ready(function(){
$('input[type="checkbox"]').click(function(){
if($(this).prop("checked") == true){
$('#paddress').val( $('#address').val() );
$('#pcity').val( $('#city').val() );
$('#pstate').val( $('#state').val() );
$('#ppincode').val( $('#pincode').val() );
}

});
});
</script>
<script>
function checkAvailability() {
$("#loaderIcon").show();
jQuery.ajax({
url: "check_availability.php",
data:'roomno='+$("#room").val(),
type: "POST",
success:function(data){
$("#room-availability-status").html(data);
$("#loaderIcon").hide();
},
error:function (){}
});
}
</script>

<script type="text/javascript">

$(document).ready(function() {
$('#duration').keyup(function(){
var fetch_dbid = $(this).val();
$.ajax({
type:'POST',
url :"ins-amt.php?action=userid",
data :{userinfo:fetch_dbid},
success:function(data){
$('.result').val(data);
}
});

})});
</script>

</html>

Change-password.php-
<?php
session_start();
include('includes/config.php');
date_default_timezone_set('Asia/Kolkata');
include('includes/checklogin.php');
check_login();
$ai=$_SESSION['id'];
// code for change password
if(isset($_POST['changepwd']))
{
$op=$_POST['oldpassword'];
$np=$_POST['newpassword'];
$udate=date('d-m-Y h:i:s', time());;
$sql="SELECT password FROM userregistration where password=?";
$chngpwd = $mysqli->prepare($sql);
$chngpwd->bind_param('s',$op);
$chngpwd->execute();
$chngpwd->store_result();
$row_cnt=$chngpwd->num_rows;;
if($row_cnt>0)
{
$con="update userregistration set password=?,passUdateDate=? where id=?";
$chngpwd1 = $mysqli->prepare($con);
$chngpwd1->bind_param('ssi',$np,$udate,$ai);
$chngpwd1->execute();
$_SESSION['msg']="Password Changed Successfully !!";
}
else
{
$_SESSION['msg']="Old Password not match !!";
}

}
?>
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Change Password</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">>
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.11.3-jquery.min.js"></script>
<script type="text/javascript" src="js/validation.min.js"></script>
<script type="text/javascript">
function valid()
{

if(document.changepwd.newpassword.value!= document.changepwd.cpassword.value)
{
alert("Password and Re-Type Password Field do not match !!");
document.changepwd.cpassword.focus();
return false;
}
return true;
}
</script>

</head>
<body>
<?php include('includes/header.php');?>
<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">

<div class="row">
<div class="col-md-12">

<h2 class="page-title">Change Password </h2>

<div class="row">

<div class="col-md-10">
<div class="panel panel-default">
<div class="panel-heading">
<?php $result ="SELECT passUdateDate FROM userregistration WHERE id=?";
$stmt = $mysqli->prepare($result);
$stmt->bind_param('i',$ai);
$stmt->execute();
$stmt -> bind_result($result);
$stmt -> fetch(); ?>

Last Updation Date:&nbsp;<?php echo $result;


?></div>
<div class="panel-body">
<form method="post" class="form-horizontal" name="changepwd" id="change-pwd" onSubmit="return
valid();">
<?php if(isset($_POST['changepwd']))
{ ?>
<p style="color: red"><?php
echo htmlentities($_SESSION['msg']); ?><?php echo htmlentities($_SESSION['msg']=""); ?></p>
<?php } ?>
<div class="hr-
dashed"></div>
<div class="form-group">
<label class="col-
sm-4 control-label">old Password </label>
<div class="col-
sm-8">
<input type="password" value="" name="oldpassword" id="oldpassword" class="form-control"
onBlur="checkpass()" required="required">
<span id="password-availability-status"
class="help-block m-b-none" style="font-size:12px;"></span></div>
</div>
<div class="form-group">
<label class="col-
sm-4 control-label">New Password</label>
<div class="col-
sm-8">
<input type="password"
class="form-control" name="newpassword" id="newpassword" value="" required="required">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Confirm
Password</label>
<div class="col-sm-8">
<input type="password" class="form-control" value="" required="required" id="cpassword"
name="cpassword" >
</div>
</div>

<div class="col-
sm-6 col-sm-offset-4">

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


<input
type="submit" name="changepwd" Value="Change Password" class="btn btn-primary">
</div>

</form>

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

</div>
</div>

</div>
</div>

</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>

<script>
function checkpass() {
$("#loaderIcon").show();
jQuery.ajax({
url: "check_availability.php",
data:'oldpassword='+$("#oldpassword").val(),
type: "POST",
success:function(data){
$("#password-availability-status").html(data);
$("#loaderIcon").hide();
},
error:function (){}
});
}
</script>
</body>

</html>

Check-availability.php-
<?php
require_once("includes/config.php");
if(!empty($_POST["emailid"])) {
$email= $_POST["emailid"];
if (filter_var($email, FILTER_VALIDATE_EMAIL)===false) {

echo "error : You did not enter a valid email.";


}
else {
$result ="SELECT count(*) FROM userRegistration WHERE email=?";
$stmt = $mysqli->prepare($result);
$stmt->bind_param('s',$email);
$stmt->execute();
$stmt->bind_result($count);
$stmt->fetch();
$stmt->close();
if($count>0)
{
echo "<span style='color:red'> Email already exist .</span>";
}
else{
echo "<span style='color:green'> Email available for registration .</span>";
}
}
}

if(!empty($_POST["oldpassword"]))
{
$pass=$_POST["oldpassword"];
$result ="SELECT password FROM userregistration WHERE password=?";
$stmt = $mysqli->prepare($result);
$stmt->bind_param('s',$pass);
$stmt->execute();
$stmt -> bind_result($result);
$stmt -> fetch();
$opass=$result;
if($opass==$pass)
echo "<span style='color:green'> Password matched .</span>";
else echo "<span style='color:red'> Password Not matched</span>";
}

if(!empty($_POST["roomno"]))
{
$roomno=$_POST["roomno"];
$result ="SELECT count(*) FROM registration WHERE roomno=?";
$stmt = $mysqli->prepare($result);
$stmt->bind_param('i',$roomno);
$stmt->execute();
$stmt->bind_result($count);
$stmt->fetch();
$stmt->close();
if($count>0)
echo "<span style='color:red'>$count. Seats already full.</span>";
else
echo "<span style='color:red'>All Seats are Available</span>";
}
?>

Dashboard.php-
<td colspan="2" align="right" ><form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="14%">&nbsp;</td>
<td width="35%" class="comb-value"><label>
<input name="Submit" type="submit" class="txtbox4" value="Prints this Document " onClick="return f3();" />
</label></td>
<td width="3%">&nbsp;</td>
<td width="26%"><label>
<input name="Submit2" type="submit" class="txtbox4" value="Close this document " onClick="return f2();" />
</label></td>
<td width="8%">&nbsp;</td>
<td width="14%">&nbsp;</td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</table>
</body>
</html>

Get-seater.php-
<?php
include('includes/pdoconfig.php');
if(!empty($_POST["roomid"]))
{
$id=$_POST['roomid'];
$stmt = $DB_con->prepare("SELECT * FROM rooms WHERE room_no = :id");
$stmt->execute(array(':id' => $id));
?>
<?php
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<?php echo htmlentities($row['seater']); ?>
<?php
}
}

if(!empty($_POST["rid"]))
{
$id=$_POST['rid'];
$stmt = $DB_con->prepare("SELECT * FROM rooms WHERE room_no = :id");
$stmt->execute(array(':id' => $id));
?>
<?php
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<?php echo htmlentities($row['fees']); ?>
<?php
}
}

?>

Login.php-
<?php
session_start();
include('includes/config.php');
if(isset($_POST['login']))
{
$email=$_POST['email'];
$password=$_POST['password'];
$stmt=$mysqli->prepare("SELECT email,password,id FROM userregistration WHERE email=? and password=? ");
$stmt->bind_param('ss',$email,$password);
$stmt->execute();
$stmt -> bind_result($email,$password,$id);
$rs=$stmt->fetch();
$stmt->close();
$_SESSION['id']=$id;
$_SESSION['login']=$email;
$uip=$_SERVER['REMOTE_ADDR'];
$ldate=date('d/m/Y h:i:s', time());
if($rs)
{
$uid=$_SESSION['id'];
$uemail=$_SESSION['login'];
$ip=$_SERVER['REMOTE_ADDR'];
$geopluginURL='http://www.geoplugin.net/php.gp?ip='.$ip;
$addrDetailsArr = unserialize(file_get_contents($geopluginURL));
$city = $addrDetailsArr['geoplugin_city'];
$country = $addrDetailsArr['geoplugin_countryName'];
$log="insert into userLog(userId,userEmail,userIp,city,country) values('$uid','$uemail','$ip','$city','$country')";
$mysqli->query($log);
if($log)
{
header("location:dashboard.php");
}
}
else
{
echo "<script>alert('Invalid Username/Email or password');</script>";
}
}
?>

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Student Hostel Registration</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">>
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.11.3-jquery.min.js"></script>
<script type="text/javascript" src="js/validation.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
function valid()
{
if(document.registration.password.value!= document.registration.cpassword.value)
{
alert("Password and Re-Type Password Field do not match !!");
document.registration.cpassword.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<?php include('includes/header.php');?>
<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">

<div class="row">
<div class="col-md-12">

<h2 class="page-title">User Login </h2>

<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="well row pt-2x pb-3x bk-light">
<div class="col-md-8 col-md-offset-2">

<form action="" class="mt" method="post">


<label for="" class="text-uppercase text-
sm">Email</label>
<input type="text" placeholder="Email"
name="email" class="form-control mb">
<label for="" class="text-uppercase text-
sm">Password</label>
<input type="password" placeholder="Password"
name="password" class="form-control mb">

<input type="submit" name="login" class="btn


btn-primary btn-block" value="login" >
</form>
</div>
</div>
<div class="text-center text-light">
<a href="forgot-password.php" class="text-light">Forgot password?</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>
</body>

</html>

Logout.php-
<?php
session_start();
unset($_SESSION['id']);
session_destroy();
header('Location:index.php');
?>

My-profile.php-
<?php
session_start();
include('includes/config.php');
date_default_timezone_set('Asia/Kolkata');
include('includes/checklogin.php');
check_login();
$aid=$_SESSION['id'];
if(isset($_POST['update']))
{

$regno=$_POST['regno'];
$fname=$_POST['fname'];
$mname=$_POST['mname'];
$lname=$_POST['lname'];
$gender=$_POST['gender'];
$contactno=$_POST['contact'];
$udate = date('d-m-Y h:i:s', time());
$query="update userRegistration set regNo=?,firstName=?,middleName=?,lastName=?,gender=?,contactNo=?,updationDate=? where id=?";
$stmt = $mysqli->prepare($query);
$rc=$stmt->bind_param('sssssisi',$regno,$fname,$mname,$lname,$gender,$contactno,$udate,$aid);
$stmt->execute();
echo"<script>alert('Profile updated Succssfully');</script>";
}
?>

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Profile Updation</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">>
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.11.3-jquery.min.js"></script>
<script type="text/javascript" src="js/validation.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
function valid()
{
if(document.registration.password.value!= document.registration.cpassword.value)
{
alert("Password and Re-Type Password Field do not match !!");
document.registration.cpassword.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<?php include('includes/header.php');?>
<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">
<?php
$aid=$_SESSION['id'];
$ret="select * from userregistration where id=?";
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('i',$aid);
$stmt->execute() ;//ok
$res=$stmt->get_result();
//$cnt=1;
while($row=$res->fetch_object())
{
?>
<div class="row">
<div class="col-md-12">
<h2 class="page-title"><?php echo $row->firstName;?>'s&nbsp;Profile </h2>

<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">

Last Updation date : &nbsp; <?php echo $row->updationDate;?>


</div>

<div class="panel-body">
<form method="post" action="" name="registration" class="form-horizontal" onSubmit="return valid();">

<div class="form-group">
<label class="col-sm-2 control-label"> Registration No : </label>
<div class="col-sm-8">
<input type="text" name="regno" id="regno" class="form-control" required="required" value="<?php echo $row->regNo;?>" >
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">First Name : </label>
<div class="col-sm-8">
<div class="form-group">
<label class="col-sm-2 control-label">Email id: </label>
<div class="col-sm-8">
<input type="email" name="email" id="email" class="form-control" onBlur="checkAvailability()" required="required">
<span id="user-availability-status" style="font-size:12px;"></span>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Password: </label>
<div class="col-sm-8">
<input type="password" name="password" id="password" class="form-control" required="required">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Confirm Password : </label>
<div class="col-sm-8">
<input type="password" name="cpassword" id="cpassword" class="form-control" required="required">
</div>
</div>

<div class="col-sm-6 col-sm-offset-4">


<button class="btn btn-default" type="submit">Cancel</button>
<input type="submit" name="submit" Value="Register" class="btn btn-primary">
</div>
</form>

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>
</body>
<script>
function checkAvailability() {

$("#loaderIcon").show();
jQuery.ajax({
url: "check_availability.php",
data:'emailid='+$("#email").val(),
type: "POST",
success:function(data){
$("#user-availability-status").html(data);
$("#loaderIcon").hide();
},
error:function ()
{
event.preventDefault();
alert('error');
}
});
}
</script>

</html>
Room-details.php-
<?php
session_start();
include('includes/config.php');
include('includes/checklogin.php');
check_login();
?>
<!doctype html>
<html lang="en" class="no-js">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Room Details</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-social.css">
<link rel="stylesheet" href="css/bootstrap-select.css">
<link rel="stylesheet" href="css/fileinput.min.css">
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<link rel="stylesheet" href="css/style.css">
<script language="javascript" type="text/javascript">
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
if(popUpWin)
{
if(!popUpWin.closed) popUpWin.close();
}
popUpWin = open(URLStr,'popUpWin',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+510+',height='+430+',left='+left+',
top='+top+',screenX='+left+',screenY='+top+'');
}

</script>

</head>

<body>
<?php include('includes/header.php');?>

<div class="ts-main-content">
<?php include('includes/sidebar.php');?>
<div class="content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2 class="page-title">Rooms Details</h2>
<div class="panel panel-default">
<div class="panel-heading">All Room Details</div>
<div class="panel-body">
<table id="zctb" class="table table-bordered " cellspacing="0"
width="100%">

<tbody>
<?php
$aid=$_SESSION['login'];
$ret="select * from registration where emailid=?";
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('s',$aid);
$stmt->execute() ;
$res=$stmt->get_result();
$cnt=1;
while($row=$res->fetch_object())
{
?>

<tr>
<td colspan="4"><h4>Room Realted Info</h4></td>
<td><a href="javascript:void(0);" onClick="popUpWindow('http://localhost/hostel/full-profile.php?id=<?php echo $row->emailid;?>');" title="View
Full Details">Print Data</a></td>
</tr>
<tr>
<td colspan="6"><b>Reg no. :<?php echo $row->postingDate;?></b></td>
</tr>

<tr>
<td><b>Room no :</b></td>
<td><?php echo $row->roomno;?></td>
<td><b>Seater :</b></td>
<td><?php echo $row->seater;?></td>
<td><b>Fees PM :</b></td>
<td><?php echo $fpm=$row->feespm;?></td>
</tr>

<tr>
<td><b>Food Status:</b></td>
<td>
<?php if($row->foodstatus==0)
{
echo "Without Food";
}
else
{
echo "With Food";
}
;?></td>
<td><b>Stay From :</b></td>
<td><?php echo $row->stayfrom;?></td>
<td><b>Duration:</b></td>
<td><?php echo $dr=$row->duration;?> Months</td>
</tr>

<tr>
<td colspan="6"><b>Total Fee :
<?php if($row->foodstatus==1)
{
$fd=2000;
echo (($dr*$fpm)+$fd);
}
else
{
echo $dr*$fpm;
}
?></b></td>
</tr>
<tr>
<td colspan="6"><h4>Personal Info Info</h4></td>
</tr>

<tr>
<td><b>Reg No. :</b></td>
<td><?php echo $row->regno;?></td>
<td><b>Full Name :</b></td>
<td><?php echo $row->firstName;?><?php echo $row->middleName;?><?php echo $row->lastName;?></td>
<td><b>Email :</b></td>
<td><?php echo $row->emailid;?></td>
</tr>

<tr>
<td><b>Contact No. :</b></td>
<td><?php echo $row->contactno;?></td>
<td><b>Gender :</b></td>
<td><?php echo $row->gender;?></td>
<td><b>Course :</b></td>
<td><?php echo $row->course;?></td>
</tr>

<tr>
<td><b>Emergency Contact No. :</b></td>
<td><?php echo $row->egycontactno;?></td>
<td><b>Guardian Name :</b></td>
<td><?php echo $row->guardianName;?></td>
<td><b>Guardian Relation :</b></td>
<td><?php echo $row->guardianRelation;?></td>
</tr>
<tr>
<td><b>Guardian Contact No. :</b></td>
<td colspan="6"><?php echo $row->guardianContactno;?></td>
</tr>

<tr>
<td colspan="6"><h4>Addresses</h4></td>
</tr>
<tr>
<td><b>Correspondense Address</b></td>
<td colspan="2">
<?php echo $row->corresAddress;?><br />
<?php echo $row->corresCIty;?>, <?php echo $row->corresPincode;?><br />
<?php echo $row->corresState;?>

</td>
<td><b>Permanent Address</b></td>
<td colspan="2">
<?php echo $row->pmntAddress;?><br />
<?php echo $row->pmntCity;?>, <?php echo $row->pmntPincode;?><br />
<?php echo $row->pmnatetState;?>

</td>
</tr>

<?php
$cnt=$cnt+1;
} ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<!-- Loading Scripts -->


<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>

</body>

</html>
SYSTEM TESTING

UNIT TESTING-

The software units in a system are modules and routines that are assembled and integrated toperform

a specific function. Unit testing focuses first on modules, independently of one another,to locate

errors. This enables, to detect errors in coding and logic that are contained within eachmodule. This

testing includes entering data and ascertaining if the value matches to the type and

size supported by java. The various controls are tested to ensure that each performs its action as

required.

INTEGRATION TESTING-

Data can be lost across any interface, one module can have an adverse effect on another, sub-

functions when combined, may not produce the desired major functions. Integration testing is

asystematic testing to discover errors associated within the interface. The objective is to take

unittested modules and build a program structure. All the modules are combined and tested as

awhole. Here the Server module and Client module options are integrated and tested. This

testingprovides the assurance that the application is well integrated functional unit with smooth

transition of data.
CONCLUSION

To conclude the description about the project: The project developed using PHP and MySQL is

based on the requirement specification of the user and the analysis of the existing system, with

flexibility for future enhancement.The expanded functionality of today’s software requires an

appropriate approachtowards software development. This hostel management software is designed for

people whowant to manage various activities in the hostel. For the past few years the numbers of

educationalinstitutions are increasing rapidly. Thereby the numbers of hostels are also increasing for

theaccommodation of the students studying in this institution. And hence there is a lot of strain on

the person who are running the hostel and software’s are not usually used in this context. This

particular project deals with the problems on managing a hostel and avoids the problems which

occur when carried manually.Identification of the drawbacks of the existing system leads to the

designing ofcomputerized system that will be compatible to the existing system with the system

which ismore user friendly and more GUI oriented


BIBILIOGRAPHY

1. www.w3schools.com

2. in. php.net 3. en.wikipedia.org/wiki/ PHP

4 . www.hotscripts.com/category/php

/5. www.apache.org/6. www.mysql

.com/click.php?e=35050

You might also like