<?php
include('header.php');
include("dbcon.php");
error_reporting(0);
if(isset($_POST['submit']))
{
    $description1=$_POST['description1'];
    $description2=$_POST['description2'];
    $description3=$_POST['description3'];

    /* image1 */
    $valid_formats = array("jpg","png","jpeg");
    $image1 = rand(1000,100000)."-".$_FILES['a-image']['name'];
    list($width, $height, $type, $attr) = getimagesize($image1); 
    if($width>1600 || $height>637) 
    { 
    die("exceeded image dimension limits."); 
    } 
    $path1="uploads/about/".$image1;
    move_uploaded_file($_FILES["a-image"]["tmp_name"], $path1);   
 /* image1 */

    
    $result="INSERT into `aboutus`(`description`,`image`,`content1`,`content2`)VALUES('$description1','$path1','$description2','$description3')";
    if (mysqli_query($con, $result)){
    header("location:aboutus.php?message=success");
} 
 }   
?>


<div class="clearfix">
</div>
<!-- BEGIN CONTAINER -->
<div class="page-container">

    <!-- BEGIN SIDEBAR -->
    <div class="page-sidebar-wrapper">
        <div class="page-sidebar navbar-collapse collapse">
            <!-- BEGIN SIDEBAR MENU -->
            <ul class="page-sidebar-menu">
                <li class="sidebar-toggler-wrapper">
                    <!-- BEGIN SIDEBAR TOGGLER BUTTON -->
                    <div class="sidebar-toggler hidden-phone">
                    </div>
                    <!-- BEGIN SIDEBAR TOGGLER BUTTON -->
                </li>
                
                
                <!--SEARCH-->
                <li class="sidebar-search-wrapper">
                    <!-- BEGIN RESPONSIVE QUICK SEARCH FORM -->
                    <form class="sidebar-search" action="#" method="POST">
                        <div class="form-container">
                            <div class="input-box">
                                <a href="javascript:;" class="remove"></a>
                                <input type="text" placeholder="Search..."/>
                                <input type="button" class="submit" value=" "/>
                            </div>
                        </div>
                    </form>
                    <!-- END RESPONSIVE QUICK SEARCH FORM -->
                </li>
                <!--SEARCH-->
                
                <li class="">
        
                    <a href="dashboard.php">
                    <i class="fa fa-desktop"></i>
                    <span class="title">Dashboard</span>
                    <span class="selected"></span>
                    </a>
                </li>
                
                
                    <li class="">
                    <a href="banner.php">
                    <i class="fa fa-home" aria-hidden="true"></i>
                    <span class="title">HOME</span>
                    <span class="arrow "></span>
                    </a>
                    <ul class="sub-menu">
                        <li><a href="banner.php">Banner</a></li>
                        <li><a href="welcome-note.php">Welcome Note</a></li>
                        
                    </ul>


                  </li>

                


                    <li class="active">
                    <a href="aboutus.php">
                    <i class="fa fa-info-circle" aria-hidden="true"></i>
                    <span class="title">ABOUT US</span>
                    </a>
                </li>



                   <li class="">
                    <a href="projects.php">
                    <i class="fa fa-info-circle" aria-hidden="true"></i>
                    <span class="title">PROJECTS</span>
                    </a>
                </li>
                
                    <li class="">
                    <a href="javascript:;">
                    <i class="fa fa-tags" aria-hidden="true"></i>
                    <span class="title">PRODUCTS</span>
                    <span class="arrow "></span>
                    </a>

                    <ul class="sub-menu">
                        <li><a href="works.php">Add Products</a></li>
                        <li><a href="">Products Details List</a></li>
                        
                    </ul>


                </li>



                    <li class="">
                    <a href="gallery.php">
                    <i class="fa fa-picture-o" aria-hidden="true"></i>
                    <span class="title">GALLERY</span>
                    </a>
                </li>


                    <li class="">
                    <a href="contactus.php">
                    <i class="fa fa-envelope" aria-hidden="true"></i>
                    <span class="title">ENQUIRIES</span>
                    </a>
                  </li>
                  
                   <li class="">
                    <a href="seo.php">
                    <i class="fa fa-globe" aria-hidden="true"></i>
                    <span class="title">SEO</span>
                    </a>
                  </li>

           
                    <li class="">
                    <a href="lock.php">
                    <i class="fa fa-lock" aria-hidden="true"></i>
                    <span class="title">Lock</span>
                    </a>
                </li>
                
                
                                </ul>
            <!-- END SIDEBAR MENU -->
        </div>
    </div>
    <!-- END SIDEBAR -->



	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
					<h3 class="page-title"></h3>
					<ul class="page-breadcrumb breadcrumb">
						
						<li>
                                    <i class="fa fa-info-circle"></i>
                                    <a href="aboutus.php"><B>ABOUT US</B></a>
                                                                        
            					</li>

	
</ul>
						
				
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>
			<!-- END PAGE HEADER-->
			<!-- BEGIN PAGE CONTENT-->
			
            <div class="row profile">
				<div class="col-md-12">
					<div class="row">
                        <div class="col-md-12">
                            <div class="row">
                                <div class="col-md-12 ">
				
					
					
                    <!-- BEGIN PORTLET-->
					<div class="portlet">
						<div class="portlet-title">
							<div class="caption">
								<?php 
  if( $_GET['message'] == 'success' ) 
  { ?>
                    <p style="color:green;">
      <?php 
    echo "Record Added successfully"; ?>
                    </p>
 
    <?php
  } ?> 
							 </div>
							<div class="tools">
								<a href="javascript:;" class="reload"></a>
							</div>
						</div>
						<div class="portlet-body form">
                        
                        
                             
<?php 
$qry="select * from `aboutus`";
$res=mysqli_query($con,$qry);
$r=mysqli_fetch_array($res);
?>
							<!-- BEGIN FORM-->
<form action="aboutus.php" class="form-horizontal form-bordered" method="post" enctype="multipart/form-data">
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-2"><b>About us</b></label>
<div class="col-md-9">
<textarea  name="description1" class="ckeditor form-control" rows="15">
<?php if($r>0){
echo $r['description'];}?>
</textarea> 
</div></div>


<div class="form-group last">
<label class="control-label col-md-2"><b>About-Image</b></label>
<div class="col-md-9">
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
<?php if($r>0){ ?>
<img src="<?php echo $r['image'];?>" width="250px" height="250" alt=""/>
<?php }else {?>
<img src="http://www.placehold.it/640x426/EFEFEF/AAAAAA&amp;text=no+image" alt=""/>
<?php } ?>
</div>
<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
<div>
<span class="btn default btn-file">
<span class="fileupload-new"><i class="fa fa-paper-clip"></i> Select Image</span>
<span class="fileupload-exists"><i class="fa fa-undo"></i> Change</span>
<input type="file" class="default" name="a-image" />
</span>
<a href="#" class="btn red fileupload-exists" data-dismiss="fileupload"><i class="fa fa-trash-o"></i> Remove</a>
</div>
</div>
<span class="label label-danger">NOTE! Image Size 640x426 Pixels.</span>
</div>
</div>

<div class="form-group">
<label class="control-label col-md-2"><b>Building Materials<b></label>
<div class="col-md-9">
<textarea  name="description2" class="ckeditor form-control" rows="10">
<?php if($r>0){
echo $r['content1'];}?>
</textarea> 
</div></div>


<div class="form-group">
<label class="control-label col-md-2"><b>Impact Protection System<b></label>
<div class="col-md-9">
<textarea  name="description3" class="ckeditor form-control" rows="10">
<?php if($r>0){
echo $r['content2'];}?>
</textarea> 
</div></div>
	                   
</div>
                                                          
								<div class="form-actions fluid">
									<div class="row">
										<div class="col-md-12">
											<div class="col-md-offset-3 col-md-9">
												<button type="submit" class="btn green" name="submit"><i class="fa fa-check"></i> Save</button>
												</div>
										</div>
									</div>
								</div>
							</form>
							<!-- END FORM-->
						</div>
					</div>
					<!-- END PORTLET-->
                    
                    
                    
                    
                    
                    
					<!-- END SAMPLE FORM PORTLET-->
				</div>
                                <!--end col-md-8-->
                                
				</div>
			</div>
            
			<!-- END PAGE CONTENT-->
		</div>


<!-- END CONTAINER -->
<?php
include('footer.php');
?>
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
<script src="assets/plugins/respond.min.js"></script>
<script src="assets/plugins/excanvas.min.js"></script> 
<![endif]-->
<script src="assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap/js/bootstrap2-typeahead.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-hover-dropdown/twitter-bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->


<!-- BEGIN PAGE LEVEL PLUGINS -->
<script type="text/javascript" src="assets/plugins/fuelux/js/spinner.min.js"></script>
<script type="text/javascript" src="assets/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-fileupload/bootstrap-fileupload.js"></script>
<script type="text/javascript" src="assets/plugins/select2/select2.min.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-wysihtml5/wysihtml5-0.3.0.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="assets/plugins/clockface/js/clockface.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-multi-select/js/jquery.multi-select.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-multi-select/js/jquery.quicksearch.js"></script>
<script src="assets/plugins/jquery.pwstrength.bootstrap/src/pwstrength.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-switch/static/js/bootstrap-switch.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-tags-input/jquery.tagsinput.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-markdown/js/bootstrap-markdown.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-markdown/lib/markdown.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-touchspin/bootstrap.touchspin.js" type="text/javascript"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="assets/scripts/app.js"></script>
<script src="assets/scripts/form-components.js"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script>
jQuery(document).ready(function() {       
   // initiate layout and plugins
   App.init();
   FormComponents.init();
});   
</script>
<!-- BEGIN GOOGLE RECAPTCHA 
<script type="text/javascript">
var RecaptchaOptions = {
   theme : 'custom',
   custom_theme_widget: 'recaptcha_widget'
};
</script>
<script type="text/javascript" src="https://www.google.com/recaptcha/api/challenge?k=6LcrK9cSAAAAALEcjG9gTRPbeA0yAVsKd8sBpFpR"></script>
<!-- END GOOGLE RECAPTCHA -->
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>