138 lines
4.7 KiB
PHP
138 lines
4.7 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: karthi
|
|
* Date: 11/9/17
|
|
* Time: 5:28 PM
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Forgot_model extends CI_Model {
|
|
|
|
|
|
/*
|
|
* get user login details
|
|
* params:email,password
|
|
* created by karthi
|
|
* */
|
|
|
|
/*
|
|
* Default login venba@123 -> 7594aacdb21d8a9b29f71ea9163a5730
|
|
*/
|
|
//
|
|
function forget($user=null, $password)
|
|
{
|
|
$this->db->select('ID,Emailid,MobileNumber,Password');
|
|
$this->db->where('MobileNumber', $user['MobileNumber']);
|
|
|
|
|
|
|
|
$forgotDetails = $this->db->get('T_Login')->first_row();
|
|
//print_r ($forgotDetails) ;
|
|
//exit();
|
|
|
|
// $result = $query->result_array();
|
|
if($forgotDetails){
|
|
|
|
$existUserID=$forgotDetails->ID;
|
|
$this->db->where('ID', $existUserID);
|
|
$upatePassword=$this->db->update('T_Login', $user);
|
|
// print_r ($upatePassword) ;
|
|
//exit();
|
|
if($upatePassword) {
|
|
$result['forgotstatus'] = true;
|
|
$result['resPass'] = $password;
|
|
$result['message'] = "Password updated successfully";
|
|
}
|
|
else{
|
|
$result['forgotstatus'] = false;
|
|
$result['message'] = "Something went wrong!";
|
|
}
|
|
|
|
|
|
}
|
|
else {
|
|
$result['forgotstatus'] = false;
|
|
$result['message'] = "User is not exist!";
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
// public function change_Password( $userId, $newPassword, $oldPassword, $updateOn) {
|
|
// $this->db->select('Password');
|
|
// $this->db->from(LOGIN);
|
|
// $this->db->where('ID', $userId);
|
|
// $loginDetails = $this->db->get()->first_row();
|
|
// if ($loginDetails->Password == $oldPassword) {
|
|
// $sql = "UPDATE ".LOGIN." SET Password='$newPassword', UpdatedBy='$userId', UpdatedOn='$updateOn' WHERE ID='$userId'";
|
|
// if($this->db->query($sql) == '1'){
|
|
// $result['changePassStatus'] = true;
|
|
// $result['message'] = "Your Password Successfully changed !!";
|
|
// } else {
|
|
// $result['changePassStatus'] = false;
|
|
// $result['message'] = "Please try Again !!";
|
|
// }
|
|
// } else {
|
|
// $result['changePassStatus'] = false;
|
|
// $result['message'] = "Your Current Password miss match, Please try Again !!";
|
|
// }
|
|
// return $result;
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
//public function login($mobile = null)
|
|
//{
|
|
// $this->db->select('MobileNumber');
|
|
//$this->db->where('MobileNumber', $mobile);
|
|
//$this->db->where('IsActive', 1);
|
|
//$//loginDetails = $this->db->get(LOGIN)->first_row();
|
|
//if($loginDetails){
|
|
//if($mobile == $loginDetails->MobileNumber){
|
|
|
|
//if($password == $loginDetails->Password){
|
|
//print_r($loginDetails);exit();
|
|
//$this->db->select('t1.MobileNumber, t1.ListCode, t1.ID, t2.BranchCode');
|
|
//$this->db->from(''.LOGIN.' as t1');
|
|
//$this->db->where('t1.MobileNumber', $mobile);
|
|
//$this->db->join(''.STAFF.' as t2', 't1.StaffID = t2.StaffID', 'LEFT');
|
|
//$responseDetails = $this->db->get()->first_row();
|
|
//$result['loginStatus'] = true;
|
|
|
|
//$result['details'] = $responseDetails;
|
|
|
|
//}
|
|
//else {
|
|
//$result['loginStatus'] = false;
|
|
/* $result['message'] = "Please Enter Valid Password !!";
|
|
}
|
|
}
|
|
else{
|
|
$result['loginStatus'] = false;
|
|
$result['message'] = "Please Enter Register Mobile Number !!";
|
|
}
|
|
}
|
|
else {
|
|
$result['loginStatus'] = false;
|
|
$result['message'] = "Something Went Wrong, Please try Again !!";
|
|
}
|
|
|
|
/*$this->db->join('areas a', 'a.id = e.id_area', 'inner');
|
|
$this->db->join('horario h', 'h.id = e.id_horario', 'inner');
|
|
$this->db->join('dia d', 'd.id = e.id_data', 'inner');
|
|
$this->db->join('tipo_evento t', 't.id = e.id_tipo', 'inner');
|
|
$this->db->join('campus c', 'c.id = e.id_unidade', 'inner');
|
|
if ( $id != null ){
|
|
$this->db->where('e.id', $id);
|
|
return $this->db->get('eventos')->first_row();
|
|
} else {
|
|
return $this->db->get('eventos')->result();
|
|
}*/
|
|
|
|
//return $result;
|
|
|
|
// }
|
|
|
|
|
|
} |