Mini Shell

Direktori : /home/rizant5/www/development/admin/
Upload File :
Current File : /home/rizant5/www/development/admin/news-new.php

<?php 
require_once("../config.php");
require_once("function-file.php");
require_once("function-menu.php");
cookiecheck();
if(isset($_POST['save'])){
	//Upload Image
	$name=$_FILES['news_image']['name'];
	$news_image=str_replace(" ","_",$name);
	$tmp_name=$_FILES['news_image']['tmp_name'];
	$target_path="img/news/";
	$target_path=$target_path.basename($news_image);
	move_uploaded_file($_FILES['news_image']['tmp_name'],$target_path);
	//--
	$news_title=$_POST['news_title'];
	$news_desc=$_POST['news_desc'];
	$conn->exec("insert into news (news_title,news_img,news_desc,news_date) VALUES ('$news_title','$news_image','$news_desc',now())");
	header("location:news.php");
}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Add News</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();?>
  </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">Add News</h3>
              <div class="box-tools pull-right">
                <a href="news.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" enctype="multipart/form-data">
              <div class="form-group">
              		<div class="col-sm-6"><label>News Title</label><input name="news_title" class="form-control" placeholder="Enter News Title"></div>
                    <div class="col-sm-6"><label>News Image:</label><br>
                  <input type="file" id="file" name="news_image" type="file" class="form-control"  accept="image/*" onchange="loadFile(event)"></div>
              </div>
               <div class="form-group">
              		<div class="col-sm-6"><label>News Description</label>
                    <textarea name="news_desc" id="editor1" class="form-control editors" placeholder="Type News Description" rows="20"></textarea></div>
                 <div class="col-sm-6"><img id="output" class="img-responsive img-thumbnail" /></div>  
              </div>
              <div class="form-group">
              		<div class="col-sm-12" align="right">
                    <button type="reset"  class="btn btn-default" rows="4">Reset</button>&nbsp;&nbsp;
                    <button  type="submit" name="save" class="btn btn-success" >Save</button></div>
                   
              </div>
            </div><!-- /.box-body -->
          </div><!-- /.box -->
        </section><!-- /.content -->
      </div></div><!-- /.content-wrapper -->
      <?php footer();?>
    </div><!-- ./wrapper -->
   <?php jsfile();ratenum();?>
<script>
  var loadFile = function(event) {
    var output = document.getElementById('output');
    output.src = URL.createObjectURL(event.target.files[0]);
  };
</script>
   <script src="//cdn.ckeditor.com/4.5.8/full/ckeditor.js"></script>
   <script>
	  $(function() {
$('.editors').each(function(){
    CKEDITOR.replace( $(this).attr('id') );
});
});
    </script>
   
  </body>
</html>

Zerion Mini Shell 1.0