Mini Shell

Direktori : /home/rizant5/public_html_old/development/admin/
Upload File :
Current File : //home/rizant5/public_html_old/development/admin/blogs-view.php

<?php 

require_once("../config.php");

require_once("function-file.php");

require_once("function-menu.php");

cookiecheck();

$blog_id=$_GET['blog_id'];

$datas=$conn->prepare("select * from blogs where blog_id='$blog_id'");

$datas->execute();$result=$datas->fetch();

if((!empty($_GET['action']))&&($_GET['action']=='answer')){

	$blogans_id=$_GET['blogans_id'];

	$blog_id=$_GET['blog_id'];

	$conn->exec("delete from blog_answer where blogans_id='$blogans_id'");

	header("location:blogs-view.php?blog_id=$blog_id");

}

if((!empty($_GET['action']))&&($_GET['action']=='comment')){

	$commentid=$_GET['commentid'];

	$blog_id=$_GET['blog_id'];

	$conn->exec("delete from blog_comment where commentid='$commentid'");

	$conn->exec("delete from blog_answer where comment_id='$commentid'");

	header("location:blogs-view.php?blog_id=$blog_id");

}

?>

<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>Blog</title>

    <!-- Tell the browser to be responsive to screen width -->

    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <?php  cssfile();?>

    <style>.box-comment{border: 1px solid #ccc; padding: 10px;}.comment{padding: 15px; background: rgba(122, 170, 191, 0.27); border: 1px solid #86c2de;}

    .comment-box{    border: 1px solid rgba(197, 45, 47, 0.49);border-radius: 15px;padding: 10px;background: rgba(197, 45, 47, 0.21);    margin-bottom: 15px;}.comment-ans{    background: rgba(122, 170, 191, 0.27);

    border: 1px solid #86c2de;

    border-radius: 15px 50px;

    padding: 15px;

    margin-bottom: 10px;}.border{border-bottom: 1px dashed #ccc; padding: 10px;}</style>   

  </head>

  <body class="hold-transition skin-blue layout-top-nav">

    <!-- Site wrapper -->

    <div class="wrapper">

<?php headermenu();?>

      <!-- =============================================== -->

      <!-- Content Wrapper. Contains page content -->

      <div class="content-wrapper">

        <!-- Content Header (Page header) -->

        <!-- Main content -->

        <section class="content">

          <!-- Default box -->

          <div class="box">

            <div class="box-header with-border">

              <h3 class="box-title">Blog</h3>

              <div class="box-tools pull-right">

                <a href="blogs.php" class="btn btn-info btn-sm" ><i class="fa fa-angle-double-left"></i> Back</a>

              </div>

            </div>

            <div class="box-body">

            <form action="#" method="post" role="form" class="form-horizontal" >

              <div class="form-group">

              		<div class="col-sm-12"><label>Blog Title: </label>&nbsp;<?php echo $result['blog_title']; ?></div>

              </div>

               <div class="form-group">

              		<div class="col-sm-6"><label>Blog Description:</label>

                    <?php echo $result['blog_desc']; ?></div>

                    <div class="col-sm-6"><img src="img/blogs/<?php echo $result['blog_img'];?>" id="output"  class="img-responsive img-thumbnail"/></div>

              </div>

              <hr />

              <h4>Comment</h4>

              <?php $db=$conn->prepare("select * from blog_comment where blog_id='$blog_id'");

$db->execute();$results=$db->fetchall();

foreach($results as $row){?>

              <div class="comment-box">

               <div class="form-group">

               <div class="col-sm-12" align="right"><a href='blogs-view.php?action=comment&commentid=<?php echo $row['commentid'];?>&blog_id=<?php echo $blog_id;?>' class='btn btn-danger btn-xs'>Delete</a></div>

               		<div class="col-sm-12"><label>Name: </label> <?php echo $row['name'];?></div>

                    <div class="col-sm-12"><label>Email: </label> <?php echo $row['email'];?></div>

               </div>

                <div class="form-group">

               		<div class="col-sm-12"><label>Comment: </label></div>

                    <div class="col-sm-12"><?php echo $row['message'];?><a href="edit-comment.php?blog_id=<?php echo $blog_id; ?>&cid=<?php echo $row['commentid'] ?>">Edit</a></div>

               </div>

             </div>  

             <br>

             <b>Reply</b>

            

                <?php $dbs=$conn->prepare("select * from blog_answer where comment_id='$row[commentid]'");

				$dbs->execute();$resultss=$dbs->fetchall();$nums=$dbs->rowcount();

				if($nums>0){

					echo" <div class='comment-ans'>

             <div class='form-group'>";

				foreach($resultss as $rows){?>

						<div class="col-sm-12 border"><p align="right"><a href='blogs-view.php?action=answer&blogans_id=<?php echo $rows['blogans_id'];?>&blog_id=<?php echo $blog_id;?>' class='btn btn-danger btn-xs'>Delete</a></p>

						<?php echo $rows['reply'];?><div><a href="edit-comment.php?blog_id=<?php echo $blog_id; ?>&rid=<?php echo $rows['blogans_id'] ?>">Edit</a></div></div>

                      

				<?php }

				echo" <hr /></div>

              </div> ";

				}?>

              

              <div class="form-group">

                    <div class="col-sm-12"><textarea name="reply" id="ans_<?php echo $row['commentid']; ?>" class="form-control" rows="4" placeholder="Reply..."></textarea></div>

              </div> 

              <div class="form-group">     

                    <div class="col-sm-12" align="right"><button type="button" onClick="saveme('<?php echo $row['commentid']; ?>')" name="save" class="btn btn-primary">Submit</button></div>

               </div>

               <hr />

               <?php }?>

            </div><!-- /.box-body -->

            </form>

          </div><!-- /.box -->

        </section><!-- /.content -->

      </div></div><!-- /.content-wrapper -->

      <?php footer();?>

    </div><!-- ./wrapper -->

   <?php jsfile();ratenum();?>

<script>

   function saveme(id){

   		var answer=$("#ans_"+id).val();

		$.ajax({

		type: 'post',

		url: 'comment-answer.php',

		data: {'id':id,'answer':answer},

	  	success: function (data) {

			window.location.reload();

        }

     });

   }

   </script>

   </body>

</html>


Zerion Mini Shell 1.0