File: /home/barbeatleanalyti/www/public_html/application/controllers/Front.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Front extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('front/index');
}
public function websolutions(){
$this->load->view('front/websolutions');
}
public function branding(){
$this->load->view('front/branding');
}
public function designing(){
$this->load->view('front/designing');
}
public function digitalmarketing(){
$this->load->view('front/digitalmarketing');
}
public function events(){
$this->load->view('front/events');
}
public function training(){
$this->load->view('front/training');
}
public function ajaxlogin(){
$this->load->model('Front_model');
$email = $this->input->post('email');
$passwd = $this->input->post('passwd');
$rsData = $this->Front_model->userloginvalidate($email,$passwd,'client');
//print_r($rsData);
$return[0] = 0;
if(count($rsData) <= 0){
$return[0] = 1;
$return[1] = "Wrong credentials, please try again with correct credentials";
}else{
$loginid = $rsData[0]->bbuid;
$this->session->set_userdata('loginid',$loginid);
$this->session->set_userdata('logintype','client');
//redirect('index.php/manage/cdashboard');
////$sessiondata = $this->session->set_userdata('loginid',$loginid);
}
echo json_encode($return);
exit;
}
public function ajaxregistration(){
$this->load->model('Front_model');
$name = $this->input->post('name');
$email = $this->input->post('email');
$phone = $this->input->post('phone');
$passwd = $this->input->post('passwd');
$return[0] = 0;
$return[1] = "You are registered with us successfuly.";
if(empty($name)){
$return[0] = 1;
$return[1] = "Your name should not be empty.";
}
else if(empty($email)){
$return[0] = 1;
$return[1] = "Email should not be empty.";
}
else if(filter_var($email, FILTER_VALIDATE_EMAIL) == false){
$return[0] = 1;
$return[1] = "Email id should be in proper format";
}
else if(empty($phone)){
$return[0] = 1;
$return[1] = "Phone number should not be empty.";
}
else if(strlen($phone) != 10){
$return[0] = 1;
$return[1] = "Phone number should 10 digit.";
}
else if(empty($passwd)){
$return[0] = 1;
$return[1] = "Password should not be empty.";
}
if($return[0] == 1){
echo json_encode($return);
exit;
}
$rsEmail = $this->Front_model->fetchuserinfo('emailid',$email);
$rsPhone = $this->Front_model->fetchuserinfo('phone',$phone);
if(count($rsEmail) > 0){
$return[0] = 1;
$return[1] = "Email allready taken, please try again with different email id";
}else
if(count($rsPhone) > 0){
$return[0] = 1;
$return[1] = "Phone number allready taken, please try again with different phone number";
}
if($return[0] == 1){
echo json_encode($return);
exit;
}
$insertArr = array();
$insertArr['name'] = $name;
$insertArr['emailid'] = $email;
$insertArr['phone'] = $phone;
$insertArr['utype'] = 'client';
$insertArr['password'] = $passwd;
$insertArr['added_date'] = date("Y-m-d H:i:s");
$insertArr['active'] = "Y";
$this->Front_model->newregistration($insertArr);
echo json_encode($return);
exit;
}
}