Subversion Repositories SmartDukaan

Rev

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

Rev 14160 Rev 14164
Line 444... Line 444...
444
    		$this->session->set_userdata('location',$next);
444
    		$this->session->set_userdata('location',$next);
445
    	}
445
    	}
446
    	if(isset($getdata['data']) && !empty($getdata['data'])){
446
    	if(isset($getdata['data']) && !empty($getdata['data'])){
447
    		$data = $getdata['data'];
447
    		$data = $getdata['data'];
448
    	}else{
448
    	}else{
449
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
449
    		// $this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
450
    		// redirect($next);die;
450
    		redirect($next);die;
451
    	}
451
    	}
452
    	if(isset($getdata['token']) && !empty($getdata['token'])){
452
    	if(isset($getdata['token']) && !empty($getdata['token'])){
453
    		$token = $getdata['token'];
453
    		$token = $getdata['token'];
454
    	}else{
454
    	}else{
455
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
455
    		// $this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
456
    		// redirect($next);die;
456
    		redirect($next);die;
457
    	}    	
457
    	}    	
458
    	$userData = unserialize(base64_decode($data));
458
    	$userData = unserialize(base64_decode($data));
459
    	$hash = md5("21dtr022015|".$userData['Id']);
459
    	$hash = md5("21dtr022015|".$userData['Id']);
-
 
460
    	$userData['isLoggedIn'] = true;
460
    	// echo $hash;
461
    	// echo $hash;
461
    	// print_r($userData);
462
    	// print_r($userData);
462
    	// echo $token;
463
    	// echo $token;
463
    	if($hash != $token){
464
    	if($hash != $token){
464
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
465
    		// $this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
465
    		// redirect($next);die;
466
    		redirect($next);die;
466
    	}
467
    	}
467
    	if (isset($_SERVER['HTTP_REFERER'])) {
468
    	if (isset($_SERVER['HTTP_REFERER'])) {
468
			if ((strpos($_SERVER['HTTP_REFERER'],'login') == false) && (strpos($_SERVER['HTTP_REFERER'],'register') == false)) {
469
			if ((strpos($_SERVER['HTTP_REFERER'],'login') == false) && (strpos($_SERVER['HTTP_REFERER'],'register') == false)) {
469
   				$redirect = $_SERVER['HTTP_REFERER'];
470
   				$redirect = $_SERVER['HTTP_REFERER'];
470
   				$location = $this->session->userdata('location');
471
   				$location = $this->session->userdata('location');
Line 483... Line 484...
483
		}
484
		}
484
		$this->session->set_userdata('authorized',$userData);
485
		$this->session->set_userdata('authorized',$userData);
485
		$location = $this->session->userdata('location');
486
		$location = $this->session->userdata('location');
486
		if(isset($location) && !empty($location)){
487
		if(isset($location) && !empty($location)){
487
			$this->session->unset_userdata('location');
488
			$this->session->unset_userdata('location');
488
			$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
489
			// $this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
489
			// redirect($location);
490
			redirect($location);
490
		}
491
		}
491
		else{
492
		else{
492
			$this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));
493
			// $this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));
493
			// redirect(base_url());	
494
			redirect(base_url());	
494
		}
495
		}
495
    }
496
    }
496
}
497
}
497
 
498
 
498
/***** FOR LOGIN AUTHENTICATION *****
499
/***** FOR LOGIN AUTHENTICATION *****