Subversion Repositories SmartDukaan

Rev

Rev 14165 | Rev 14456 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14165 Rev 14442
Line 439... Line 439...
439
 
439
 
440
    public function autologin() {    
440
    public function autologin() {    
441
    	$getdata = $this->input->get();
441
    	$getdata = $this->input->get();
442
    	$configdata = $this->config->item('gosf');
442
    	$configdata = $this->config->item('gosf');
443
		$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
443
		$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
444
		$getdata['title'] = 'Saholic';
-
 
445
		$getdata['stylesheet'] = 'auth.css';	    	
-
 
446
    	if(isset($getdata['next']) && !empty($getdata['next'])){
-
 
447
    		$next = $getdata['next'];
-
 
448
    		$this->session->set_userdata('location',$next);
-
 
449
    	}
-
 
450
    	if(isset($getdata['data']) && !empty($getdata['data'])){
444
		if(isset($getdata['data']) && !empty($getdata['data'])){
451
    		$data = $getdata['data'];
445
    		$data = $getdata['data'];
452
    	}else{
446
    	}else{
453
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
447
    		$this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));
454
    		// redirect($next);die;
-
 
455
    	}
448
    	}
-
 
449
		$userData = unserialize(base64_decode($data));
-
 
450
	 	$userData['stylesheet'] = 'auth.css';
-
 
451
    	$userData['title'] = 'Saholic';
-
 
452
    	if(isset($userData['next']) && !empty($userData['next'])){
-
 
453
    		$next = $userData['next'];
-
 
454
    		$this->session->set_userdata('location',$next);
-
 
455
    	}    	
456
    	if(isset($getdata['token']) && !empty($getdata['token'])){
456
    	if(isset($getdata['token']) && !empty($getdata['token'])){
457
    		$token = $getdata['token'];
457
    		$token = $getdata['token'];
458
    	}else{
458
    	}else{
459
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
459
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$userData);
460
    		// redirect($next);die;
-
 
461
    	}    	
460
    	}    	    	
462
    	$userData = unserialize(base64_decode($data));
-
 
463
    	$hash = md5("21dtr022015|".$userData['Id']);    	
461
    	$hash = md5("21dtr022015|".$userData['Id']);    	
464
    	if($hash != $token){
462
    	if($hash != $token){
465
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
463
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$userData);
466
    		// redirect($next);die;
-
 
467
    	}
464
    	}
468
    	if (isset($_SERVER['HTTP_REFERER'])) {
465
    	if (isset($_SERVER['HTTP_REFERER'])) {
469
			if ((strpos($_SERVER['HTTP_REFERER'],'login') == false) && (strpos($_SERVER['HTTP_REFERER'],'register') == false)) {
466
			if ((strpos($_SERVER['HTTP_REFERER'],'login') == false) && (strpos($_SERVER['HTTP_REFERER'],'register') == false)) {
470
   				$redirect = $_SERVER['HTTP_REFERER'];
467
   				$redirect = $_SERVER['HTTP_REFERER'];
471
   				$location = $this->session->userdata('location');
468
   				$location = $this->session->userdata('location');
Line 476... Line 473...
476
   				}elseif(isset($location) && ($location == 'my-recharges' || $location == 'my-wallet')){
473
   				}elseif(isset($location) && ($location == 'my-recharges' || $location == 'my-wallet')){
477
   					$location = base_url().$location;
474
   					$location = base_url().$location;
478
   					$this->session->set_userdata('location',$location);
475
   					$this->session->set_userdata('location',$location);
479
   				}else{
476
   				}else{
480
   					$this->session->set_userdata('location',$redirect);	
477
   					$this->session->set_userdata('location',$redirect);	
481
   				}
478
   				}   				
482
   				
-
 
483
			}
479
			}
484
		}
480
		}
485
		$userData['isLoggedIn'] = true;
481
		$userData['isLoggedIn'] = true;
486
		$this->session->set_userdata('authorized',$userData);
482
		$this->session->set_userdata('authorized',$userData);
487
		$location = $this->session->userdata('location');
483
		$location = $this->session->userdata('location');
488
		if(isset($location) && !empty($location)){
484
		if(isset($location) && !empty($location)){
489
			$this->session->unset_userdata('location');
485
			$this->session->unset_userdata('location');
490
			$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
486
			$this->layout->view(strtolower(__CLASS__).'/autologin',$userData);
491
			// redirect($location);
-
 
492
		}
487
		}
493
		else{
488
		else{
494
			$this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));
489
			$this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));			
495
			// redirect(base_url());	
-
 
496
		}
490
		}
497
    }
491
    }
498
}
492
}
499
 
493
 
500
/***** FOR LOGIN AUTHENTICATION *****
494
/***** FOR LOGIN AUTHENTICATION *****