Subversion Repositories SmartDukaan

Rev

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

Rev 14156 Rev 14160
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',$next);
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',$next);
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
    	// echo $hash;
460
    	// echo $hash;
461
    	// print_r($userData);
461
    	// print_r($userData);
462
    	// echo $token;
462
    	// echo $token;
463
    	if($hash != $token){
463
    	if($hash != $token){
464
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$next);
464
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
465
    		// redirect($next);die;
465
    		// redirect($next);die;
466
    	}
466
    	}
467
    	if (isset($_SERVER['HTTP_REFERER'])) {
467
    	if (isset($_SERVER['HTTP_REFERER'])) {
468
			if ((strpos($_SERVER['HTTP_REFERER'],'login') == false) && (strpos($_SERVER['HTTP_REFERER'],'register') == false)) {
468
			if ((strpos($_SERVER['HTTP_REFERER'],'login') == false) && (strpos($_SERVER['HTTP_REFERER'],'register') == false)) {
469
   				$redirect = $_SERVER['HTTP_REFERER'];
469
   				$redirect = $_SERVER['HTTP_REFERER'];
Line 483... Line 483...
483
		}
483
		}
484
		$this->session->set_userdata('authorized',$userData);
484
		$this->session->set_userdata('authorized',$userData);
485
		$location = $this->session->userdata('location');
485
		$location = $this->session->userdata('location');
486
		if(isset($location) && !empty($location)){
486
		if(isset($location) && !empty($location)){
487
			$this->session->unset_userdata('location');
487
			$this->session->unset_userdata('location');
488
			$this->layout->view(strtolower(__CLASS__).'/autologin',$next);
488
			$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
489
			// redirect($location);
489
			// redirect($location);
490
		}
490
		}
491
		else{
491
		else{
492
			$this->layout->view(strtolower(__CLASS__).'/autologin',base_url());
492
			$this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));
493
			// redirect(base_url());	
493
			// redirect(base_url());	
494
		}
494
		}
495
    }
495
    }
496
}
496
}
497
 
497