187 lines
2.6 KiB
PHP
187 lines
2.6 KiB
PHP
<?php
|
|
|
|
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Models\User_model;
|
|
|
|
use App\Models\Dashboard_model;
|
|
|
|
use App\Models\Common_model;
|
|
|
|
use App\Models\Member_model;
|
|
|
|
class Common_controller extends BaseController
|
|
|
|
{
|
|
|
|
public $session;
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->session = session();
|
|
|
|
$this->MemberModel = new Member_model();
|
|
|
|
$this->UserModel = new User_model();
|
|
|
|
$this->dModel = new Dashboard_model();
|
|
|
|
$this->cModel = new Common_model();
|
|
|
|
helper(['form']);
|
|
|
|
}
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function fetch_country()
|
|
|
|
{
|
|
|
|
echo $this->cModel->fetch_country();
|
|
|
|
}
|
|
|
|
|
|
|
|
function fetch_state()
|
|
|
|
{
|
|
|
|
if($this->request->getVar('country_id'))
|
|
|
|
{
|
|
|
|
echo $this->cModel->fetch_state($this->request->getVar('country_id'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function fetch_city()
|
|
|
|
{
|
|
|
|
if($this->request->getVar('state_id'))
|
|
|
|
{
|
|
|
|
echo $this->cModel->fetch_city($this->request->getVar('state_id'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function check_if_mail_exists()
|
|
|
|
{
|
|
|
|
if($this->request->getVar('table'))
|
|
{
|
|
|
|
if($this->request->getVar('table') == 'member')
|
|
{
|
|
$data = $this->MemberModel->where('email', $this->request->getVar('email'))->find();
|
|
}else if($this->request->getVar('table') == 'users'){
|
|
$data = $this->UserModel->where('email', $this->request->getVar('email'))->find();
|
|
}
|
|
if ($data)
|
|
{
|
|
echo true;
|
|
}
|
|
else
|
|
{
|
|
echo false;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function forgot_password()
|
|
|
|
{
|
|
|
|
$this->session->setTempdata('user',"member",3);
|
|
|
|
if($this->request->getmethod() == 'get')
|
|
|
|
{
|
|
|
|
return view('forgot_password_otp.php');
|
|
|
|
}
|
|
|
|
else if($this->request->getmethod() == 'post')
|
|
|
|
{
|
|
|
|
|
|
|
|
$email = $this->request->getVar('email');
|
|
|
|
$user_data = $this->MemberModel->where('email', $email)->where('is_email_verified', 1 )->find();
|
|
|
|
if ($user_data)
|
|
|
|
{
|
|
|
|
$otp = rand(1000 , 9999);
|
|
|
|
$sendmail_controller = new Sendmail_controller();
|
|
|
|
$sendmail_controller->index($this->request->getVar('email') , $otp , 2 );
|
|
$this->session->setTempdata('email', $this->request->getVar('email') ,3);
|
|
$this->session->setTempdata('otp', $otp ,3);
|
|
|
|
return view('password_match.php');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->session->setTempdata('error', "Email is not verified.please check your mail.",3);
|
|
|
|
return view('forgot_password_otp.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------
|
|
|
|
}
|
|
|