<?php 
/*include_once "../ichat/admin/route.php";
require_once 'database.php';
if(isset($_SESSION[$elhash]) && $_SESSION[$elhash] != "") { 
    $random_hash = $_SESSION[$elhash];
} else {
    $random_hash = uniqid();
    $_SESSION[$elhash] = $random_hash;
}*/

session_start();
require_once "check_admin.php";
require_once 'database.php';
class add_cenas extends database
{
   public function index($data)
    {
		return $this->insert('cenas',$data);
	}
}
$dev = new add_cenas();	
$msg="";
if(isset($_GET['message']))
{
	$msg=$_GET['message'];
}
if(isset($_POST['data']))
{
	$data=$_POST['data'];
	if(trim($data['name']) == '')
	{
		$msg.= "Name is required<br/>";
	}
      
	if($msg=="")
	{
		 $res = $dev->index($data);
            if($res)
            {
                    header('Location:edit_cenas.php?message=Cenas Added Successfully&id=' . $res);
            }
            else {
                $msg = 'Something Went Wrong';
            }
	}
}
include 'header.php';
?>
<div class="ordes-content">
    <div class="container midle-order">
        <div class="row">
        	<?php include 'menu.php'; ?>
            <div class="col-md-9">
                <div class="order-wraper">
                	<div class="col-md-12">
                    	<h1>Add Cenas</h1>
						<?php if($msg !=''){echo '<span class="alert alert-danger pull-left">'.$msg.'</span>';}?>
                    </div>
                    <div class="clearfix"></div>
                    <div class="col-sm-12">
                    	<div class="order-contact">
                        	
                            <div class="row">
							
							<form method="post">
                            	<div class="col-md-12">
                                	<label> Name</label>
                                    <input type="text" name="data[name]" placeholder="Name" />
                                </div>
                            	
                            	
                                <div class="col-md-12 botm-cont">
                                	<button type="submit" class="track-btn">Add</button>
                                </div>
							</form>
                            </div>
                        </div>
                    </div>
                </div>
                
            </div>
        </div>
	</div>
</div>

<script>
    $(document).ready(function(){
        $('.activ-cat').removeClass('activ-cat');
        $('#cenas-menu').addClass('activ-cat');
    }); 
</script>

<?php include 'footer.php';?>