diff --git a/application/config/database.php b/application/config/database.php
index 67cf9d1..86ba215 100644
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -75,10 +75,10 @@ $query_builder = TRUE;
 
 $db['default'] = array(
 	'dsn'	=> '',
-	'hostname' => 'localhost',
+	'hostname' => '192.168.140.123',
 	'username' => 'root',
-	'password' => '',
-	'database' => 'access',
+	'password' => 'Golden_123',
+	'database' => 'adarsh_access',
 	'dbdriver' => 'mysqli',
 	'dbprefix' => '',
 	'pconnect' => FALSE,
diff --git a/application/controllers/Handlerequest.php b/application/controllers/Handlerequest.php
new file mode 100644
index 0000000..6963124
--- /dev/null
+++ b/application/controllers/Handlerequest.php
@@ -0,0 +1,96 @@
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Handlerequest extends CI_Controller {
+	private $cipher = "aes-256-cbc";
+	private $key = "af3a2a1f8947ec7fd087f76a7ab3107f";
+	private $iv= "9A55F9FE7CDB4C21";
+	private $secret_key = "my_key";
+	private $headers;
+	private $jsonRequest;
+
+	public function __construct() {
+        parent::__construct();
+        $this->headers = apache_request_headers();
+        $this->load->model('Handle_model','handle_model');		
+		$this->load->model('Validation_model', 'validation_model');
+		
+	}
+	
+	public function index()
+	{
+
+		if($this->validate_headers() == true){
+			$request = json_decode(file_get_contents('php://input'));
+			$this->jsonRequest = json_decode($this->decrypt($request->jsonRequest));
+			if($this->jsonRequest) {
+				$method = $this->jsonRequest->request->method;
+				$data = (array) $this->jsonRequest->requestDetails;
+				if($method !=''){
+					$res = $this->validation_model->check($method, $data);
+					if($res['state'] == 1) {
+						$this->errorResponse($res['response']['code'], $res['response']['message']);
+					} else {
+						$data = $this->handle_model->{$method}($data);
+						if($data['status'] == 1){
+							$data = $this->encrypted(json_encode($data['data']));
+							$this->response($data);
+						} else {
+							$this->errorResponse($data['code'],$data['message']);
+						}						
+					}
+				} else {
+					$this->errorResponse('003','Invalid request URL');
+				}				
+			} else {
+				$this->errorResponse('002','Invalid request');
+			}
+		} else {
+			$this->errorResponse('001','Authentication failed');
+		}
+	}
+
+	public function validate_headers() {
+		if($this->headers['x-api-key'] == $this->secret_key) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+	public function encrypted($plaintext) {		
+		if (in_array($this->cipher, openssl_get_cipher_methods())) {
+			$ciphertext = openssl_encrypt($plaintext, $this->cipher, $this->key, $options=0, $this->iv);
+			$ciphertext = str_replace('=','',$ciphertext);
+		    return $ciphertext;
+		}
+	}
+
+	public function decrypt($decrypt) {
+		if (in_array($this->cipher, openssl_get_cipher_methods()))
+		{ 	    
+		    $original_plaintext = openssl_decrypt($decrypt, $this->cipher, $this->key, $options=0, $this->iv);
+		    return $original_plaintext;
+		}
+	}
+
+	public function response($data = null) {
+ 		$result =  array(
+ 			'responseCode' => 0,
+ 			'status'=>'SUCCESS',
+ 			'message' => 'SUCCESS',
+ 			'jsonResponse' =>$data
+ 		);
+ 		print json_encode($result);
+ 	}
+
+ 	public function errorResponse($code, $errorDesc) {
+ 		$result =  array(
+ 			'responseCode' => $code,
+ 			'status'=>'FAILED',
+ 			'message'=> $errorDesc
+ 		);
+ 		print json_encode($result);
+ 	}
+
+}
diff --git a/application/models/Handle_model.php b/application/models/Handle_model.php
new file mode 100644
index 0000000..6529df3
--- /dev/null
+++ b/application/models/Handle_model.php
@@ -0,0 +1,111 @@
+<?php 
+
+class Handle_model extends CI_Model {
+	
+	public function _consruct(){
+		parent::_construct();
+ 	}
+
+
+	function login($data) { 
+		$query = $this->db->where('username',$data['email_id'])->where('password',md5($data['password']))->where('status',1)->get('users');
+		if($query->num_rows() > 0) {
+			$response = $query->row();
+			if($response->user_type == 1) {
+				$data = $this->db->where('id',$response->user_id)->get('customer')->row();
+				$res = array('status'=>1,'message'=>"Login successfully done",'data'=>$data);
+			} else if($response->user_type == 2) {
+				$data = $this->db->where('id',$response->user_id)->get('shopper')->row();
+				$res = array('status'=>1,'message'=>"Login successfully done",'data'=>$data);
+			} else {
+				$res = array('status'=>0,'message'=>'Invalid credentials','code'=>'008');
+			}
+		} else {
+			$res = array('status'=>0,'message'=>'Invalid credentials','code'=>'008');
+		}
+		return $res;
+	}
+
+	function registration($data) {
+		$dup = $this->db->query("SELECT customer.email_id, customer.phone_no FROM `users` LEFT JOIN customer ON users.user_type = customer.user_type WHERE (users.username = '".$data['email_id']."' OR customer.phone_no = '".$data['phone_no']."')");
+		if($dup->num_rows() > 0) {
+			if($dup->num_rows() > 1) {
+				$res = array('status'=> 0,'message'=>'Email and Phone are already exists','code'=>'009');
+			} else {
+				$dup_res = $dup->row();
+				if($dup_res->email_id == $data['email_id'] && $dup_res->phone_no == $data['phone_no']) {
+					$res = array('status'=>0,'message'=>'Email and Phone no are already exists','code'=>'009');
+				} else if($dup_res->email_id == $data['email_id']) {
+					$res = array('status'=>0,'message'=>'Email already exists','code'=>'010');
+				} else {
+					$res = array('status'=>0,'message'=>'Phone no already exists','code'=>'011');
+				}
+			}
+		} else {
+			$userData = array(
+				'name'=>$data['name'],
+				'email_id'=>$data['email_id'],
+				'phone_no'=>$data['phone_no'],
+				'dob'=>$data['dob'],
+				'address'=>$data['address'],
+				'assist_name'=>$data['assist_name'],
+				'assist_phone_no'=>$data['assist_phone_no'],
+				'assist_email_id'=>$data['assist_email_id']
+			);
+			$rs = $this->db->insert('customer', $userData);
+			if($rs) {
+				$insert_id = $this->db->insert_id();
+				$this->db->where('user_id',$insert_id)->where('user_type',1)->update('users',array('pin'=>md5($data['pin']), 'status'=>1));
+				$user = $this->db->where('id', $insert_id)->get('customer')->row();
+				$res = array('status'=>1, 'message'=>'Registration Successfully', 'data'=>$user);
+			} else {
+				$res = array('status'=>0,'message'=>'Something Went Wrong! Registration Failed','code'=>'012');
+			}
+		}
+		return $res;
+	}
+
+	function categories($data) {
+		if($data['cat_id']) {
+			$this->db->where('id',$data['cat_id']);
+		}
+		$data_rs = $this->db->select('id,cat_name,cat_image')->where('status', 1)->get('category');
+		if($data_rs->num_rows() > 0){
+			if($data_rs->num_rows() > 1){
+				$data = $data_rs->result();
+			} else {
+				$data = $data_rs->row();
+			}			
+			$res = array('status'=>1, 'message'=>'Category List', 'data'=>$data);
+		} else {
+			$res = array('status'=>0,'message'=>'No categories found!','code'=>'021');
+		}
+		return $res;
+	}
+
+	function sub_categories($data) {
+		if($data['cat_id']) {
+			$this->db->where('cat_id',$data['cat_id']);
+		}
+		if($data['id']) {
+			$this->db->where('id',$data['id']);
+		}
+		$data_rs = $this->db->select('id,sub_cat_name,sub_cat_image')->where('status', 1)->get('sub_category');
+		if($data_rs->num_rows() > 0){
+			if($data_rs->num_rows() > 1){
+				$data = $data_rs->result();
+			} else {
+				$data = $data_rs->row();
+			}			
+			$res = array('status'=>1, 'message'=>'Sub Category List', 'data'=>$data);
+		} else {
+			$res = array('status'=>0,'message'=>'No sub categories found!','code'=>'022');
+		}
+		return $res;
+	}
+
+
+
+	
+
+}
\ No newline at end of file
diff --git a/application/models/Validation_model.php b/application/models/Validation_model.php
new file mode 100644
index 0000000..12e4d3e
--- /dev/null
+++ b/application/models/Validation_model.php
@@ -0,0 +1,183 @@
+<?php 
+
+class Validation_model extends CI_Model {
+
+	public $validation_array = array(
+			'login'=> array('email_id'=>array('required'=>array('code'=>'004', 'message'=>'Email id is null or empty'),
+											  'email'=>array('code'=>'005', 'message'=>'Invalid Email id')
+										),
+							'password'=>array('required'=>array('code'=>'006', 'message'=>'Password is null or empty'),
+											  'min_4'=>array('code'=>'007', 'message'=>'Password length is minimum 6')
+								        )
+						),
+			'registration'=> array('email_id'=>array('required'=>array('code'=>'004', 'message'=>'Email id is null or empty'),
+											  'email'=>array('code'=>'005', 'message'=>'Invalid Email id')
+										),
+							'phone_no'=>array('required'=>array('code'=>'014', 'message'=>'Phone no is null or empty'),
+										   'phone'=>array('code'=>'015', 'message'=>'Invalid Phone no'),
+								        ),
+							'pin'=>array('required'=>array('code'=>'006', 'message'=>'Password is null or empty'),
+										'min_4'=>array('code'=>'007', 'message'=>'Password length is minimum 6')
+									),
+							'name'=>array('event_id'=>array('required'=>array('code'=>'016', 'message'=>'Name is null or empty')
+										)
+									),
+							'dob'=>array('event_id'=>array('required'=>array('code'=>'017', 'message'=>'DOB is required')
+									)
+								),
+							'address'=>array('event_id'=>array('required'=>array('code'=>'018', 'message'=>'Address is null or empty')
+									)
+								),
+							'assist_name'=>array('event_id'=>array('required'=>array('code'=>'019', 'message'=>'Assist name is required')
+									)
+								),
+							'assist_phone_no'=>array('event_id'=>array('required'=>array('code'=>'020', 'message'=>'Assist phone no is required')
+								)
+							),
+						),
+			'categories'=>array(),
+			'sub_categories'=>array(),
+			'forgot'=> array('email_id'=>array('required'=>array('code'=>'ER02', 'message'=>'Email id is null or empty'),
+											  'email'=>array('code'=>'ER03', 'message'=>'Invalid Email id')
+										)
+						),
+			'popular'=>array(),
+			'category'=>array(),
+			'locality'=>array(),
+			'favourite'=>array('event_id'=>array('required'=>array('code'=>'ER16', 'message'=>'Event id is null or empty')
+										),
+							'auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+							'status'=>array('required'=>array('code'=>'ER18', 'message'=>'Favourite status is missing'),
+								        ),
+						),
+			'favouritelist'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+						),
+			'bookedlist'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+						),
+			'bookingdetails'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+									'bookingCode'=>array('required'=>array('code'=>'ER23', 'message'=>'Booking code is null or empty'),
+								        ),
+						),
+			'cancel'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+									'bookingCode'=>array('required'=>array('code'=>'ER23', 'message'=>'Booking code is null or empty'),
+								        ),
+						),
+			'confirm'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+									'bookingCode'=>array('required'=>array('code'=>'ER23', 'message'=>'Booking code is null or empty'),
+								        ),
+						),
+			'userinfo'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+						),
+			'profile'=>array('name'=>array('required'=>array('code'=>'ER27', 'message'=>'Name is null or empty')
+										),
+							'gender'=>array('required'=>array('code'=>'ER28', 'message'=>'Gender is null or empty')
+								        ),
+							'dob'=>array('required'=>array('code'=>'ER29', 'message'=>'Date of birth is null or empty')
+								        ),
+							'city'=>array('required'=>array('code'=>'ER30', 'message'=>'City no is null or empty')
+								        ),
+							'auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+						),
+			'tempbooking'=>array('event_id'=>array('required'=>array('code'=>'ER16', 'message'=>'Event id is null or empty')
+										),
+							'event_date_id'=>array('required'=>array('code'=>'ER33', 'message'=>'Event date and time is null or empty')
+								        ),
+							'ticket_details'=>array('required'=>array('code'=>'ER34', 'message'=>'Ticket information is null or empty')
+								        ),
+							'amount'=>array('required'=>array('code'=>'ER35', 'message'=>'Amount is null or empty')
+								        ),
+							'no_of_ticket'=>array('required'=>array('code'=>'ER36', 'message'=>'no of ticket is null or empty')
+								        ),							
+							'auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+						),
+			'recommend'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+						),
+			'search'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+						),
+			'discover'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+							'cat_id'=>array('required'=>array('code'=>'ER38', 'message'=>'Category id null or empty')
+								        ),
+						),
+			'event'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
+								        ),
+							'event_id'=>array('required'=>array('code'=>'ER16', 'message'=>'Event id is null or empty')
+								        ),
+						),
+				);
+			
+	
+	public function _consruct(){
+		parent::_construct();			
+ 	}
+
+ 	public function check($method_name, $parms) {
+ 		$state = 0;
+		$rules = $this->validation_array[$method_name];
+		if($rules == ''){
+			return array('state'=> 1,'response'=>array('code'=>'013', 'message'=>'Invalid API'));
+		} 		
+ 		$error_key = '';
+ 		foreach ($rules as $key => $value) {
+ 			foreach ($value as $keys => $values) {
+ 				switch ($keys) {
+ 						case 'required':
+ 							if(!isset($parms[$key]) || $parms[$key]=='' || $parms[$key]== null){
+ 								$state = 1;
+ 								$error_key = $values;
+ 							} 
+ 							break;
+ 						case 'email':
+ 							if (isset($parms[$key]) && !filter_var($parms[$key], FILTER_VALIDATE_EMAIL)) {
+	  							$state = 1;
+ 								$error_key = $values; 
+							} 
+ 							break;
+ 						case 'phone':
+ 							if(isset($parms[$key])){
+ 							$phone = preg_replace('/[^0-9]/', '', $parms[$key]);
+	 							if (strlen($phone) !== 10) {
+		  							$state = 1;
+	 								$error_key = $values; 
+								}
+							} 
+							break;
+						case 'min_4':
+ 							if(isset($parms[$key])){
+	 							if (strlen($parms[$key]) < 4) {
+		  							$state = 1;
+	 								$error_key = $values; 
+								}
+							} 
+ 							break;
+
+
+ 						
+ 						default:
+ 							# code...
+ 							break;
+ 					}
+ 					if($state==1){
+ 						break;
+ 					}
+ 			}
+ 			if($state==1){
+ 				break;
+ 			}
+ 		}
+ 		return array('state'=>$state,'response'=>$error_key);
+ 	} 	
+}
+
+?>
\ No newline at end of file
diff --git a/index.php b/index.php
index 8078a5c..690a6e9 100644
--- a/index.php
+++ b/index.php
@@ -73,7 +73,8 @@ switch (ENVIRONMENT)
 
 	case 'testing':
 	case 'production':
-		ini_set('display_errors', 0);
+		error_reporting(-1);
+		ini_set('display_errors', 1);
 		if (version_compare(PHP_VERSION, '5.3', '>='))
 		{
 			error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);