Skip to content

Commit

Permalink
Almost
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit-CBS committed Apr 26, 2019
1 parent df85ec9 commit f124ed5
Show file tree
Hide file tree
Showing 13 changed files with 354 additions and 40 deletions.
137 changes: 115 additions & 22 deletions Admin.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
<?php
$conn = mysqli_connect("localhost", "root", "", "register");
if (isset($_POST["import"])) {
$fileName = $_FILES["file"]["tmp_name"];
if ($_FILES["file"]["size"] > 0) {
$file = fopen($fileName, "r");
while (($column = fgetcsv($file, 10000, ",")) !== FALSE) {
$sqlInsert = "INSERT into users (userId,userName,password,firstName,lastName)
values ('" . $column[0] . "','" . $column[1] . "','" . $column[2] . "','" . $column[3] . "','" . $column[4] . "')";
$result = mysqli_query($conn, $sqlInsert);
if (! empty($result)) {
$type = "success";
$message = "CSV Data Imported into the Database";
// echo "<script type='text/javascript'>alert('CSV Data Imported into the Database');</script>";
}
else {
$type = "error";
$message = "Problem in Importing CSV Data";
}
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Admin Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link rel="stylesheet" href="Search.css">
<script src="jquery-3.2.1.min.js"></script>
<title>Admin Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link rel="stylesheet" href="Search.css">
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
Expand All @@ -29,23 +53,74 @@
</div>
</div>
</nav>
<form action="VerifyReceipt.php" method="POST">
<div class="container">
<div class="jumbotron" style="background: none; color: white;">
<h1 align="center">ABC WXYZ Engineering College</h1>
<h4 align="center">Technocity, Panchpota, Garia, Kolkata - 700152, Phone: 1234567890</h4>
</div>
<div class="input-field thumbnail col-xs-8 col-xs-offset-2">
<input id="rollno" name="rollno" type="text" required maxlength="11" minlength="11" data-length="11" class="form-contol input">
<label for="rollno">Enter MAKAUT Roll Number</label>
<div class="jumbotron" style="background: none; color: white;">
<h1 align="center">ABC WXYZ Engineering College</h1>
<h4 align="center">Technocity, Panchpota, Garia, Kolkata - 700152, Phone: 1234567890</h4>
</div>
</div>
<div class="col-sm-6">
<form action="VerifyReceipt.php" method="POST">
<div class="input-field thumbnail">
<input id="rollno" name="rollno" type="text" required maxlength="11" minlength="11" data-length="11" class="form-contol input">
<label for="rollno">Enter MAKAUT Roll Number</label>
</div>
<center><button class="btn btn3">Search <i class="fas fa-search"></i></button></center>
<center><a href="AdminChange.php">Click here to change Admin username and/or password</a></center>
</form>
</div>
<div class="col-sm-6">
<div id="response" class="<?php if(!empty($type)) { echo $type . " display-block"; } ?>"><?php if(!empty($message)) { echo $message; } ?>
</div>
<form class="form-inline" style="padding-top: 45px" action="" method="post" name="frmCSVImport" id="frmCSVImport" enctype="multipart/form-data">
<div class="form-group">
<h2 style="color: white; display: inline;">Import CSV file into Database:</h2>
<label class="thumbnail sr-only">Choose CSV File:</label>
<div class="input-group">
<input type="file" name="file" id="file" accept=".csv" style="color: white;">
</div>
<!-- <br /> -->
<button type="submit" id="submit" name="import" class="btn btn1">Import</button>
</div>
</form>
</div>
<center><button class="btn btn3">Search <i class="fas fa-search"></i></button></center>
</form>
<script src="https://code.jquery.com/jquery-3.4.0.js" integrity="sha256-DYZMCC8HTC+QDr5QNaIcfR7VSPtcISykd+6eSmBW5qo=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script>
<?php
$sqlSelect = "SELECT * FROM users";
$result = mysqli_query($conn, $sqlSelect);
if (mysqli_num_rows($result) > 0) {
?>
<table id='userTable' class="thumbail">
<thead>
<tr>
<th>User ID</th>
<th>User Name</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<?php
while ($row = mysqli_fetch_array($result)) {
?>
<tbody>
<tr>
<td><?php echo $row['userId']; ?></td>
<td><?php echo $row['userName']; ?></td>
<td><?php echo $row['firstName']; ?></td>
<td><?php echo $row['lastName']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
?>
</div>
<script src="https://code.jquery.com/jquery-3.4.0.js" integrity="sha256-DYZMCC8HTC+QDr5QNaIcfR7VSPtcISykd+6eSmBW5qo=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script>
$(document).ready(function() {
$('input#rollno').characterCounter();
});
Expand All @@ -59,6 +134,24 @@
}
});
});
</script>
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#frmCSVImport").on("submit", function ()
{
$("#response").attr("class", "");
$("#response").html("");
var fileType = ".csv";
var regex = new RegExp("([a-zA-Z0-9\s_\\.\-:])+(" + fileType + ")$");
if (!regex.test($("#file").val().toLowerCase())) {
$("#response").addClass("error");
$("#response").addClass("display-block");
$("#response").html("Invalid File. Upload : <b>" + fileType + "</b> Files.");
return false;
}
return true;
});
});
</script>
</body>
</html>
60 changes: 60 additions & 0 deletions AdminChange.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
$conn = mysqli_connect("localhost", "root", "", "register");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<script src="jquery-3.2.1.min.js"></script>
<title>Admin Change Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link rel="stylesheet" href="Search.css">
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-nav-demo" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="Receipt.php" class="navbar-brand"><span class="glyphicon glyphicon-picture" aria-hidden="true"></span> IMAGE</a>
</div>
<div class="collapse navbar-collapse" id="bs-nav-demo">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="AdminLogin.php">Admin <i class="fas fa-user"></i></a></li>
<li><a href="Logout.php">Logout <i class="fas fa-sign-out-alt"></i></a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="jumbotron" style="background: none; color: white;">
<h1 align="center">ABC WXYZ Engineering College</h1>
<h4 align="center">Technocity, Panchpota, Garia, Kolkata - 700152, Phone: 1234567890</h4>
</div>
</div>
<div class="col-sm-6 col-md-offset-3">
<form action="#" method="POST">
<div class="input-field thumbnail">
<input id="uname" name="uname" type="text" class="form-contol input">
<label for="uname">Enter new Username</label>
</div>
<div class="input-field thumbnail">
<input id="pword" name="pword" type="text" class="form-contol input">
<label for="pword">Enter new Password</label>
</div>
<center><button class="btn btn2">Update <i class="fas fa-user-edit"></i></button></center>
<center><a href="AdminChange.php">Click here to go to Admin Page</a></center>
</form>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.4.0.js" integrity="sha256-DYZMCC8HTC+QDr5QNaIcfR7VSPtcISykd+6eSmBW5qo=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</html>
6 changes: 3 additions & 3 deletions AdminLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

$query = "SELECT * FROM admin WHERE Username = '$email' AND Password = '$pass'";

$data = mysqli_query($conn,$query);
$data = mysqli_query($connection,$query);
$num = mysqli_num_rows($data);
if($num != 0 )
{
Expand All @@ -19,7 +19,7 @@
$_SESSION['loggedIn'] = 'true';
?>
<script>
window.location.href='AdminLogin.php';
window.location.href='Admin.php';
</script>
<?php
}
Expand Down Expand Up @@ -54,7 +54,7 @@
</div>
<div class="collapse navbar-collapse" id="bs-nav-demo">
<ul class="nav navbar-nav">
<li><a href="Register.php">Register</a></li>
<!-- <li><a href="Register.php">Register</a></li> -->
<li><a href="Search.php"><h3 style="display: inline;" class="fas fa-search"></h3></a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
Expand Down
64 changes: 64 additions & 0 deletions AdminOld.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Admin Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link rel="stylesheet" href="Search.css">
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-nav-demo" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="Receipt.php" class="navbar-brand"><span class="glyphicon glyphicon-picture" aria-hidden="true"></span> IMAGE</a>
</div>
<div class="collapse navbar-collapse" id="bs-nav-demo">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="AdminLogin.php">Admin <i class="fas fa-user"></i></a></li>
<li><a href="Logout.php">Logout <i class="fas fa-sign-out-alt"></i></a></li>
</ul>
</div>
</div>
</nav>
<form action="VerifyReceipt.php" method="POST">
<div class="container">
<div class="jumbotron" style="background: none; color: white;">
<h1 align="center">ABC WXYZ Engineering College</h1>
<h4 align="center">Technocity, Panchpota, Garia, Kolkata - 700152, Phone: 1234567890</h4>
</div>
<div class="input-field thumbnail col-xs-8 col-xs-offset-2">
<input id="rollno" name="rollno" type="text" required maxlength="11" minlength="11" data-length="11" class="form-contol input">
<label for="rollno">Enter MAKAUT Roll Number</label>
</div>
</div>
<center><button class="btn btn3">Search <i class="fas fa-search"></i></button></center>
</form>
<script src="https://code.jquery.com/jquery-3.4.0.js" integrity="sha256-DYZMCC8HTC+QDr5QNaIcfR7VSPtcISykd+6eSmBW5qo=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script>
$(document).ready(function() {
$('input#rollno').characterCounter();
});
$(function(){
$('#rollno').keypress(function(e){
let allow_char = [48,49,50,51,52,53,54,55,56,57];
if(allow_char.indexOf(e.which) !== -1 );
else{
window.alert("Please enter a digit!");
return false;
}
});
});
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion CSS.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ body{
padding-top: 70px;
background: black;
/* background: url(https://images.unsplash.com/photo-1516571748831-5d81767b788d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1534&q=80); */
background: url(eberhard-grossgasteiger-338314-unsplash.jpg);
/* background: url(eberhard-grossgasteiger-338314-unsplash.jpg); */
/* background-size: auto; */
/* background-size: inherit; */
/* background-size: initial; */
Expand Down
2 changes: 1 addition & 1 deletion Receipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</div>
<div class="collapse navbar-collapse" id="bs-nav-demo">
<ul class="nav navbar-nav">
<li><a href="Register.php">Register</a></li>
<!-- <li><a href="Register.php">Register</a></li> -->
<li><a href="Search.php"><h3 style="display: inline;" class="fas fa-search"></h3></a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
Expand Down
2 changes: 1 addition & 1 deletion Search.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ body{
padding-top: 70px;
background: black;
/* background: url(https://images.unsplash.com/photo-1516571748831-5d81767b788d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1534&q=80); */
background: url(eberhard-grossgasteiger-338314-unsplash.jpg);
/* background: url(eberhard-grossgasteiger-338314-unsplash.jpg); */
background-position: center;
background-size: cover;
font-family: Arial, Helvetica, sans-serif;
Expand Down
2 changes: 1 addition & 1 deletion Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
<div class="collapse navbar-collapse" id="bs-nav-demo">
<ul class="nav navbar-nav">
<li><a href="Register.php">Register</a></li>
<!-- <li><a href="Register.php">Register</a></li> -->
<li class="active"><a href="Search.php"><h3 style="display: inline;" class="fas fa-search"></h3></a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
Expand Down
6 changes: 4 additions & 2 deletions connection.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<!-- <script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script> -->
<?php
$connection=mysqli_connect('localhost','root','','register');
if(!$connection)
{
die();
}
if(isset($connection));
else
{
?>
<p class="f1 center tc w-50 mt5">Hold right there,sparky!</p>
<p class="f1 center tc w-50 mt5">Access denied.Enter correct info. please!(:</p>
<?php
}
Expand Down
4 changes: 4 additions & 0 deletions inputCSV.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1,kevin_tom,kevin,Kevin,Thomas
2,vincy,vincy,Vincy,Jone
3,tim_lee,tim,Tim,Lee
4,jane,jane,Jane,Ferro
4 changes: 4 additions & 0 deletions jquery-3.2.1.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit f124ed5

Please sign in to comment.