D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
designpitara.com
/
dash
/
Filename :
view-catgory.php
back
Copy
<?php session_start(); include 'config.php'; if($_SESSION['design1'] == ''){ echo "<script>location.replace('index.php')</script>"; } ?> <!DOCTYPE html> <html lang="zxx"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="robots" content="nofollow,noindex"> <meta name="author" content=""> <link rel="icon" href="assets/img/basic/favicon.ico" type="image/x-icon"> <title>DesignPitara | Admin Panel</title> <link rel="stylesheet" href="assets/css/app.css"> <script src='tinymce/tinymce.min.js' type='text/javascript'></script> <script src="jquery.js"></script> </head> <body class="light"> <div id="app"> <?php include 'left-menu.php'; ?> <!--Sidebar End--> <?php include 'top.php'; ?> <!-- Right Sidebar --> <div class="page has-sidebar-left height-full"> <div class="container-fluid relative animatedParent animateOnce"> <div class="tab-content pb-3" id="v-pills-tabContent"> <div class="card mb-3 shadow no-b r-0 mt-3"> <div class="row"> <div class="col-md-6"> <div class="white p-3"> <h6>Upload Images</h6> </div> </div> <div class="col-md-6 text-right p-3"> <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Add Category +</button> </div> </div> <div class="card-body"> <table class="table"> <thead> <tr style="width:100%;"> <th style="width:5%;">S.no</th> <th style="width:15%;">Category</th> <th style="width:20%;">Title</th> <th style="width:30%;">Description</th> <th style="width:20%;">Keyword</th> <th style="width:10%;">Action</th> </tr> </thead> <tbody> <?php $count = 0; $cat = "select * from category"; $catresult = mysqli_query($conn,$cat); while($catrow = mysqli_fetch_assoc($catresult)){ ?> <tr> <td><?php echo $count = 1 + $count ?></td> <td><?php echo $catrow['category'] ?></td> <td><?php echo $catrow['title'] ?></td> <td><?php echo $catrow['desciption'] ?></td> <td><?php echo $catrow['keyword'] ?></td> <td><a type="button" data-toggle="modal" data-target="#myModaledit<?php echo $catrow['id'] ?>"><i class="icon icon-edit text-blue s-18"></i></a></td> </tr> <!--Edit Modal Category--> <div class="modal fade" id="myModaledit<?php echo $catrow['id'] ?>" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <form action="" method="post"> <input type="hidden" name="id" value="<?php echo $catrow['id'] ?>"> <div class="modal-header"> <h4 class="modal-title">Edit Blog Category</h4> </div> <div class="modal-body"> <div class="form-group"> <label>Category</label> <input class="form-control" value="<?php echo $catrow['category'] ?>" readonly> </div> <div class="form-group"> <label>Title</label> <input class="form-control" name="title" value="<?php echo $catrow['title'] ?>"> </div> <div class="form-group"> <label>Description</label> <input class="form-control" name="description" value="<?php echo $catrow['desciption'] ?>"> </div> <div class="form-group"> <label>Keyword</label> <input class="form-control" name="keyword" value="<?php echo $catrow['keyword'] ?>"> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary" name="editblog">Submit</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </form> </div> </div> </div> <!-- End Modal Category Here --> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <!--/#app --> <!-- Modal --> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <form action="" method="post"> <div class="modal-header"> <h4 class="modal-title">Add Blog Category</h4> </div> <div class="modal-body"> <div class="form-group"> <label>Category Category (Use it - on the space)</label> <input class="form-control" name="category" placeholder="enter category"> </div> <div class="form-group"> <label>Title</label> <input class="form-control" name="title" placeholder="enter title"> </div> <div class="form-group"> <label>Description</label> <input class="form-control" name="description" placeholder="enter description"> </div> <div class="form-group"> <label>Keyword</label> <input class="form-control" name="keyword" placeholder="enter keyword"> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary" name="cat">Submit</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </form> </div> </div> </div> <?php if(isset($_POST['cat'])){ $category = $_POST['category']; $title = $_POST['title']; $description = $_POST['description']; $keyword = $_POST['keyword']; $catsql = "select * from category where category='$category'"; $result = mysqli_query($conn,$catsql); $count = mysqli_num_rows($result); if($count == 0){ $sql = "INSERT INTO `category`(`category`, `title`, `desciption`, `keyword`) VALUES ('$category','$title','$description','$keyword')"; if(mysqli_query($conn,$sql) == true){ echo "<script>alert('Category Added Successfully')</script>"; echo "<script>location.replace('view-catgory.php')</script>"; }else{ echo "<script>alert('Error ! ')</script>"; } }else{ echo "<script>alert('Error ! Category Already Added')</script>"; } } ?> <script src="assets/js/app.js"></script> </body> </html> <?php if(isset($_POST['editblog'])){ echo $id = $conn -> real_escape_string($_POST['id']); echo $title = $conn -> real_escape_string($_POST['title']); echo $description = $conn -> real_escape_string($_POST['description']); echo $keyword = real_escape_string($_POST['keyword']); $update = "UPDATE `category` SET `title`='$title',`desciption`='$description',`keyword`='$keyword' WHERE id='$id'"; if(mysqli_query($conn,$update) == true){ echo "<script>alert('Your Category Updated Successfully')</script>" ; }else{ echo "<script>alert('Error !')</script>"; } } ?>