SHARE
TWEET

Untitled

a guest Feb 4th, 2016 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class LoginController extends BaseController {
  4.  
  5.     /*
  6.     |--------------------------------------------------------------------------
  7.     | Default Home Controller
  8.     |--------------------------------------------------------------------------
  9.     |
  10.     | You may wish to use controllers instead of, or in addition to, Closure
  11.     | based routes. That's great! Here is an example controller method to
  12.     | get you started. To route to this controller, just add the route:
  13.     |
  14.     |   Route::get('/', 'HomeController@showWelcome');
  15.     |
  16.     */
  17.  
  18.     public function login()
  19.     {
  20.         return View::make('hello');
  21.     }
  22.    
  23.     public function authenticateUser(){
  24.      
  25.         $mail = Input::get('email');
  26.         $pass = Input::get('password');
  27.    
  28.         $creads = array('email'=>$mail,'password'=>$pass);
  29.        
  30.         //$user = User::find(1);
  31.         //$user = DB::table('users')->where('email', $mail)->first();
  32.        
  33.         //$user_details = DB::table('users_details')->where('users_id', $user->id)->first();
  34.        
  35.         $user = DB::table('users')
  36.             ->join('users_details', 'users.id', '=', 'users_details.users_id')
  37.             ->where('email', $mail)->first();
  38.        
  39.  
  40.         return (Auth::attempt($creads) ? 'true,'.$user->id.','.$user->nama.','.$user->no_kp.','.$user->no_tel.','.$user->email.','.$user->username.','.$pass.','.$user->permissions.','.$user->activated.','.$user->activation_code.','.$user->activated_at.','.$user->last_login.','.$user->persist_code.','.$user->reset_password_code.','.$user->created_at.','.$user->updated_at.','.$user->id.','.$user->negeri_id.','.$user->daerah_id.','.$user->users_id.','.$user->lokaliti_id.','.$user->created_at.','.$user->updated_at.',' :'false');
  41.    
  42.     //return (Auth::attempt($creads) ? 'true,'.$user->id.','.$user->nama.','.$user->no_kp.','.$user->no_tel.','.$user->email.','.$user->username.','.$pass.','.$user->permissions.','.$user->activated.','.$user->activation_code.','.$user->activated_at.','.$user->last_login.','.$user->persist_code.','.$user->reset_password_code.','.$user->created_at.','.$user->updated_at.',' :'false');
  43.    
  44.     }
  45.    
  46.     public function toXML(){
  47.    
  48.       $stat = $this->authenticateUser();
  49.  
  50.       return Response::view('responseMin',array('user' => $stat));
  51.       //return Response::view('response',array('user' => $stat))->header('Content-Type', 'text/xml');
  52.    
  53.     }
  54.    
  55.    
  56.     public function authUser(){
  57.      
  58.         $mail = Input::get('email');
  59.         $pass = Input::get('password');
  60.    
  61.         $creads = array('email'=>$mail,'password'=>$pass);
  62.    
  63.         $status = Auth::attempt($creads) ? 'true':'false';
  64.         if($status == 'true'){
  65.           $user = DB::table('users')->where('email', $mail)->first();
  66.           Session::put('id', $user->id);
  67.           Session::put('nama', $user->nama);
  68.           }
  69.        
  70.         return Response::view('responseMin',array('user' => $status));
  71.     }
  72.    
  73.  
  74.    
  75. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top