Last active
April 11, 2017 12:33
-
-
Save Rameshwar-ghodke/019db24b4e31655f83cfe6814ead5233 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
class Android_api extends CI_Controller { | |
public function index() | |
{ | |
$this->load->view('login'); | |
} | |
public function login_check() | |
{ | |
//echo "id is"; | |
$username=$_POST['user_name']='9960676092'; | |
$password=$_POST['password']='71068'; | |
$table='tbl_employee_master'; | |
$where=array('is_deleted'=>'N','employee_contact'=>$username,'employee_password'=>$password,'application_id' =>$this->session->userdata('application_id')); | |
$result=$this->Select_model->select_table_data($table,$where); | |
if($result!=0) | |
{ | |
echo json_encode($result); | |
} | |
else if($result==0) | |
{ | |
echo "fail"; | |
} | |
} | |
public function forgotpassword() | |
{ | |
$Username=$_POST['user_name']; | |
if($Username=='') | |
{ | |
} | |
else{ | |
$mailresult=$this->Login_model->recovery_mail($Username); | |
if($mailresult==1) | |
{ | |
echo "Pass"; | |
} | |
else | |
{ | |
echo "fail"; | |
} | |
} | |
} | |
} | |
?> | |
// For login API create select model.php in that call the following function -- | |
public function select_table_data($table,$where) | |
{ | |
$query = $this->db->get_where($table,$where); | |
//echo $this->db->last_query(); | |
return $query->result(); | |
} | |
// create login-model.php in that call the recovery mail fuction code as --- | |
public function recovery_mail($Username) | |
{ | |
$query = $this->db->query("SELECT * from tbl_employee_master where employee_contact='".$Username."'"); | |
if($query->num_rows()>0) | |
{ | |
$rand_num=rand(9999,99999); | |
$message = "Your OTP is : ".$rand_num; | |
$smsresponce=$this->notification->sendSMS($Username,urldecode($message)); | |
$dataupdate_apply = array( | |
'employee_password' => $rand_num, | |
'updated_by' => $Username, | |
'updated_time' => date("Y-m-d H:i:s") | |
); | |
$this->db->where('employee_contact',$Username); | |
$this->db->update('tbl_employee_master',$dataupdate_apply); | |
return 1; | |
} | |
else | |
{ | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment