<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Add_number extends CI_Controller {

	
	public function __construct()
        {
                parent::__construct();
                $this->load->library('session');
                $this->load->model('admin/Add_number_model');
                if(!isset($_SESSION['admin'])){redirect('admin/Login');}
        }

	

	public function index()
	{
		$this->load->view('admin/header');
		$this->load->view('admin/add-contect');
		$this->load->view('admin/footer');
	}

	public function insert()
	{
		// $slug = preg_replace('/[^a-z0-9]+/i', '-', trim(strtolower($patr)));
		$data = $this->Add_number_model->db_insert();
		if($data == 1){
			$this->session->set_flashdata("success"," Data sucessfully Saved.");
				$this->output->set_header('refresh:1; url='.site_url("admin/Add_number"));
		}elseif($data == 2){
			echo 'Not Inserted';
		}else{
			$this->session->set_flashdata("same"," Data Alredy Exist.");
				$this->output->set_header('refresh:1; url='.site_url("admin/Add_number"));
		}
	}
}
