Mini Shell

Direktori : /home/rizant5/public_html-1210/development/admin/
Upload File :
Current File : /home/rizant5/public_html-1210/development/admin/answer.php

<?php 
require_once("../config.php");
require_once("function-file.php");
require_once("function-menu.php");
cookiecheck();
$topic_id=$_GET['topic_id'];
$queid=$_GET['queid'];
$datas=$conn->prepare("select * from topics where topic_id='$topic_id'");
$datas->execute();$result=$datas->fetch();
if(isset($_POST['save']))
{
	$text=htmlspecialchars($_POST['answer'],ENT_QUOTES);//$_POST['answer'];
	$question=htmlspecialchars($_POST['question'],ENT_QUOTES);//$_POST['question'];
	$conn->exec("insert into answers (que_id,datetime,text) values ('$queid',NOW(),'$text')");
	$conn->exec("update question SET check_status='1',approve='1',text='$question' where que_id='$queid'");
	header("location:questions.php");
}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?php echo $result['topic_name'];?></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>iframe{width: 100% !Important;}</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"><?php echo $result['topic_name'];?></h3>
              <div class="box-tools pull-right">
                <a  href="javascript:history.back()" class="btn btn-info btn-sm" ><i class="fa fa-angle-double-left"></i> Back</a>
              </div>
            </div>
            <div class="box-body">
              <div class="form-group">
              		<div class="col-sm-5 img-thumbnail col-xs-12"><?php echo $result['topic_desc'];?></div>
                    <div class="col-sm-6 img-thumbnail col-sm-offset-1 col-xs-12"><?php echo $result['video_url'];?></div>
              </div>
            </div><!-- /.box-body -->
          </div><!-- /.box -->
          <div class="box box-primary">
          	<div class="box-body">
            <form action="#" method="post">
              <div class="row form-group" id="answer">      
                    <div class="col-sm-12">
              <!-- The time line -->
              <ul class="timeline">
                <!-- timeline time label -->
                <?php $db=$conn->prepare("select * from question a inner join student_reg b on a.stu_id=b.stu_id where que_id='$queid'");
				$db->execute();$rows=$db->fetch();?>
                <!-- timeline item -->
                <li>
                  <i class="fa fa-envelope bg-blue"></i>
                  <div class="timeline-item">
                    <span class="time "><?php echo date('d M. Y',strtotime($rows['datetime']));?> - <i class="fa fa-clock-o"></i>  <?php echo date('h:i A',strtotime($rows['datetime']));?></span>
                    <h3 class="timeline-header"><?php echo $rows['stu_name'];?></h3>
                    <div class="timeline-body">
                      <textarea name="question" class="form-control" required><?php echo $rows['text'];?></textarea><a href="edit-question.php?topic_id=<?php echo $topic_id;?>&queid=<?php echo $queid;?>">Edit</a>
                    </div>
                  </div>
                </li>
                <!-- END timeline item -->
                <!-- timeline item -->
                <?php $db=$conn->prepare("select a.datetime,a.ans_id,a.text,s.stu_name from answers a,student_reg s, question q where a.que_id='$queid' and q.stu_id=s.stu_id and a.que_id=q.que_id");
                $db->execute();$rows=$db->fetchAll();
                foreach($rows as $row){?>
                <li>
                  <!--<i class="fa fa-envelope bg-blue"></i>-->
                  <div class="timeline-item">
                    <span class="time "><?php echo date('d M. Y',strtotime($row['datetime']));?> - <i class="fa fa-clock-o"></i>  <?php echo date('h:i A',strtotime($row['datetime']));?></span>
                    <h3 class="timeline-header"><?php echo $row['stu_name'];?><span class="badge bg-green">Answer</span></h3>
                    <div class="timeline-body">
                      <textarea name="question" class="form-control" required disabled><?php echo $row['text'];?></textarea><a href="edit-answer.php?topic_id=<?php echo $topic_id;?>&queid=<?php echo $queid;?>&ansid=<?php echo $row['ans_id'] ?>">Edit</a>
                    </div>
                  </div>
                </li>
                <?php } ?>
                <!-- END timeline item -->
                <!-- timeline item -->
                <!-- END timeline item -->
               
              </ul>
              </div>
            </div>
            
            		<div class="row form-group" style="padding: 10px 30px;"><div class="col-sm-12" align="center"><textarea name="answer" class="form-control" placeholder="Type your answer..." required></textarea></div></div>
                    <div class="row form-group"><div class="col-sm-12" align="center"><button type="submit" name="save" class="btn btn-success">Submit Answer</button></div></div>
            </div>
            </form>
          </div><!-- /.box -->
        </section><!-- /.content -->
      </div></div><!-- /.content-wrapper -->
      <?php footer();?>
    </div><!-- ./wrapper -->
   <?php jsfile();ratenum();?>
   
  </body>
</html>

Zerion Mini Shell 1.0