-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4a767bf
Showing
7 changed files
with
421 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# admin_panel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
$db = mysqli_connect('localhost','root','','kartik') | ||
or die('Error connecting to MySQL server.'); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?php | ||
session_start(); | ||
include "connection.php"; | ||
?> | ||
<?php | ||
$id=@$_GET['id']; | ||
$query="DELETE FROM `info` WHERE id='".$id."'";//Delete Query coming from line no. 109 | ||
$result = $db->query($query); | ||
?> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> | ||
<link rel="stylesheet" type="text/css" href="style1.css"> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> | ||
</head> | ||
<body><!-- Insert into database --> | ||
<form method="post" action="" enctype="multipart/form-data"> | ||
<div class="outline"> | ||
<div class="r1"> | ||
<h4><i class="fa fa-id-badge" style="font-size:24px"> </i> Add Info</h4><br> | ||
<div class="r2">Title:- | ||
<input type="text" name="title" placeholder="Enter your title" class="form-control"> | ||
</div> | ||
<div class="form-group"> Description :- | ||
<textarea class="form-control" name="description" placeholder="Enter Description"></textarea> | ||
</div> | ||
<div class="form-group">Select Category :- | ||
<select name="Category" class="form-control"> | ||
<option value="OPEN" selected>OPEN</option> | ||
<option value="OBC">OBC</option> | ||
<option value="NT">NT</option> | ||
<option value="OTHER">SC/ST</option> | ||
</select> | ||
</div> | ||
<br> | ||
<input type="file" name="image" id="image"> | ||
<br>Keywords:- | ||
<input type="text" name="keywords" placeholder="Enter Keywords" class="form-control"><br> | ||
<input type="submit" name="submit" value="INSERT"> | ||
<center><input type="submit" name="logout" value="logout"></center><!-- Destroy the session --> | ||
</div> | ||
<?php | ||
@$Name=@$_FILES['image']['name']; | ||
if($Name!=''){ | ||
if(isset($_POST['submit'])){//actual name of uploaded file | ||
$Type=$_FILES['image']['type']; | ||
if (preg_match("/.(gif|jpg|png|jpeg|svg)$/i", $Name)){ | ||
if(@$_POST['submit']=="INSERT"){ | ||
$title=$_POST['title']; | ||
$description=$_POST['description']; | ||
$Category=$_POST['Category']; | ||
$image = $_FILES['image']['name']; | ||
$file = addslashes(file_get_contents($_FILES['image']['tmp_name'])); | ||
$keywords=$_POST['keywords'];//Taking required inputs from user & applying insert query | ||
$sql = "INSERT INTO `info`(`title`, `description`, `Category`, `image`,`keywords`) VALUES ('".$title."','".$description."','".$Category."','".$file."','".$keywords."')"; | ||
@$res1=mysqli_query($db,$sql); | ||
header( "refresh:50;url=info.php" );//refreshing the page | ||
} | ||
} | ||
else{ | ||
echo "file doesn't have correct format<br>It's ".$Type; | ||
} | ||
} | ||
}else{ | ||
echo "* Image is needed."; | ||
} | ||
if(isset($_POST['logout'])){ | ||
session_destroy();//logout button | ||
header( 'location:login.php' ); | ||
} | ||
?> | ||
</div> <br> | ||
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Show Info</button> | ||
<div id="demo" class="collapse"> | ||
<hr><!-- Displaying all database information --> | ||
<div class="row"> | ||
<div class="col-xs-12"> | ||
<div class="clearfix"> | ||
<div class="pull-right tableTools-container"></div> | ||
</div> | ||
<div> | ||
<table id="dynamic-table" class="table table-striped table-bordered table-hover"> | ||
<thead> | ||
<tr> | ||
<th class="center">Sr. No</th> | ||
<th class="center">Title</th> | ||
<th class="center">Description</th> | ||
<th class="center">Category</th> | ||
<th class="center">Image</th> | ||
<th class="center">Keywords</th> | ||
<th class="center"></th> | ||
<th hidden="true"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php | ||
$title = $description = $Category = $image = $keywords = ""; | ||
$query="SELECT * FROM `info` WHERE 1 ";//taking out all enteries from db | ||
@$res=mysqli_query($db,$query); | ||
$a=1; | ||
if(mysqli_num_rows($res)>0) | ||
{ | ||
while($row=mysqli_fetch_row($res))//showing result sequentially | ||
{ | ||
$id=$row[0]; | ||
$title=$row[1]; | ||
$description=$row[2]; | ||
$Category=$row[5]; | ||
$keywords=$row[4]; | ||
$i=1; | ||
?> | ||
<tr> | ||
<td class="center" ><?php echo $id; ?></td> <!-- Displaying information in tabular format --> | ||
<td class="center" ><?php echo $title; ?></td> | ||
<td class="center" ><?php echo $description; ?></td> | ||
<td class="center" ><?php echo $Category; ?></td> | ||
<td class="center" ><?php echo $keywords; ?></td> | ||
<td class="center"><?php echo'<img src="data:image/jpeg;base64,'.base64_encode($row[3] ).'" height="100" class="img-thumnail" /> ' ?></td> | ||
<td class="center"><div class="hidden-sm hidden-xs action-buttons"> | ||
<a href="update.php?id=<?php echo $row[0]; ?>"><i class="ace-icon fa fa-pencil bigger-130"> Update | </i></a><!-- Update Button --> | ||
<a href="info.php?id=<?php echo $row[0]; ?>"><i class="ace-icon fa fa-pencil bigger-130"> Delete</i></a><!-- Delete Button --> | ||
</div> | ||
</td> | ||
<td hidden="true"></td> | ||
</tr> | ||
<?php | ||
$a++; | ||
$i++; | ||
} | ||
} | ||
?> | ||
</tbody> | ||
</table> | ||
</div> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
session_start(); | ||
include "connection.php"; | ||
?> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="style.css"> | ||
<style> | ||
.error{ | ||
color: red; | ||
} | ||
</style> | ||
</head> | ||
<?php | ||
$idErr = $passErr = ""; | ||
$id = $pass = $res = ""; | ||
$db = mysqli_connect('localhost','root','','kartik') | ||
or die('Error connecting to MySQL server.'); | ||
if(isset($_POST['submit'])){ | ||
if (empty($_POST['pass'])) { | ||
$passErr="Password can't be Empty"; | ||
} | ||
if (!empty($_POST['id'])) { | ||
$id=$_POST['id']; | ||
$pass=$_POST['pass']; | ||
$sql_query = "select count(*) as cntUser from login where id='".$id."' and pass='".$pass."'"; | ||
$result = mysqli_query($db,$sql_query); | ||
$row = mysqli_fetch_array($result); | ||
$count = $row['cntUser']; | ||
if($count > 0){ | ||
$_POST['id'] = $id; | ||
$res= "Login Successful"; | ||
header('location:info.php'); | ||
}else{ | ||
$res="Invalid username and password"; | ||
} | ||
} | ||
else{ | ||
$idErr="ID can not be Empty."; | ||
}} | ||
?> | ||
<body> | ||
<div class="login-page"> | ||
<div class="form"> | ||
<form class="login-form" method="post"> | ||
<span class="error"><?php echo"*".$res."*";?></span> | ||
<input type="text" placeholder="username" name="id" value="<?= $id?>" > | ||
<span class="error"><?php echo"*".$idErr."*";?></span> | ||
<input type="password" placeholder="password" name="pass" value="<?= $pass?>"> | ||
<span class="error"><?php echo"*".$passErr."*";?></span> | ||
<button name="submit">login</button> | ||
</form> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
@import url(https://fonts.googleapis.com/css?family=Roboto:300); | ||
|
||
.login-page { | ||
width: 360px; | ||
padding: 8% 0 0; | ||
margin: auto; | ||
} | ||
.form { | ||
position: relative; | ||
z-index: 1; | ||
background: #FFFFFF; | ||
max-width: 360px; | ||
margin: 0 auto 100px; | ||
padding: 45px; | ||
text-align: center; | ||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24); | ||
} | ||
.form input { | ||
font-family: "Roboto", sans-serif; | ||
outline: 0; | ||
background: #f2f2f2; | ||
width: 100%; | ||
border: 0; | ||
margin: 0 0 15px; | ||
padding: 15px; | ||
box-sizing: border-box; | ||
font-size: 14px; | ||
} | ||
.form button { | ||
font-family: "Roboto", sans-serif; | ||
text-transform: uppercase; | ||
outline: 0; | ||
background: #4CAF50; | ||
width: 100%; | ||
border: 0; | ||
padding: 15px; | ||
color: #FFFFFF; | ||
font-size: 14px; | ||
-webkit-transition: all 0.3 ease; | ||
transition: all 0.3 ease; | ||
cursor: pointer; | ||
} | ||
.form button:hover,.form button:active,.form button:focus { | ||
background: #43A047; | ||
} | ||
.form .message { | ||
margin: 15px 0 0; | ||
color: #b3b3b3; | ||
font-size: 12px; | ||
} | ||
.form .message a { | ||
color: #4CAF50; | ||
text-decoration: none; | ||
} | ||
.form .register-form { | ||
display: none; | ||
} | ||
.container { | ||
position: relative; | ||
z-index: 1; | ||
max-width: 300px; | ||
margin: 0 auto; | ||
} | ||
.container:before, .container:after { | ||
content: ""; | ||
display: block; | ||
clear: both; | ||
} | ||
.container .info { | ||
margin: 50px auto; | ||
text-align: center; | ||
} | ||
.container .info h1 { | ||
margin: 0 0 15px; | ||
padding: 0; | ||
font-size: 36px; | ||
font-weight: 300; | ||
color: #1a1a1a; | ||
} | ||
.container .info span { | ||
color: #4d4d4d; | ||
font-size: 12px; | ||
} | ||
.container .info span a { | ||
color: #000000; | ||
text-decoration: none; | ||
} | ||
.container .info span .fa { | ||
color: #EF3B3A; | ||
} | ||
body { | ||
background: #76b852; /* fallback for old browsers */ | ||
background: -webkit-linear-gradient(right, #76b852, #8DC26F); | ||
background: -moz-linear-gradient(right, #76b852, #8DC26F); | ||
background: -o-linear-gradient(right, #76b852, #8DC26F); | ||
background: linear-gradient(to left, #76b852, #8DC26F); | ||
font-family: "Roboto", sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
body{ | ||
margin-left: 10px; | ||
width: 100%; | ||
padding: 0px; | ||
} | ||
.outline{ | ||
margin: auto; | ||
padding: 10px; | ||
border: 2px solid grey ; | ||
width: 95%; | ||
} | ||
hr { | ||
display: block; | ||
margin-top: 0.5em; | ||
margin-bottom: 0.5em; | ||
margin-left: auto; | ||
margin-right: auto; | ||
border-style: inset; | ||
border-width: 1px; | ||
} | ||
.radio{ | ||
margin-left: 30px; | ||
} | ||
.r1 { | ||
padding: 10px; | ||
border: 1px solid grey; | ||
border-radius: 10px; | ||
margin: 0; | ||
} | ||
{ | ||
margin:0 auto; | ||
display: block; | ||
} | ||
button:hover{ | ||
background: #3B5C76; | ||
} | ||
.r2{ | ||
margin-top: -10px; | ||
margin-bottom: 0px; | ||
} | ||
.form-group{ | ||
padding: 0px; | ||
margin: auto; | ||
} | ||
i{ | ||
color:grey; | ||
} | ||
.btn{ | ||
margin: 5px auto; | ||
display: block; | ||
} | ||
span{ | ||
color: red; | ||
opacity: 0.7; | ||
} |
Oops, something went wrong.