Subversion Repositories SmartDukaan

Rev

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

Rev 14164 Rev 14165
Line 435... Line 435...
435
            }
435
            }
436
 
436
 
437
        }
437
        }
438
    }
438
    }
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');
-
 
443
		$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
-
 
444
		$getdata['title'] = 'Saholic';
-
 
445
		$getdata['stylesheet'] = 'auth.css';	    	
442
    	if(isset($getdata['next']) && !empty($getdata['next'])){
446
    	if(isset($getdata['next']) && !empty($getdata['next'])){
443
    		$next = $getdata['next'];
447
    		$next = $getdata['next'];
444
    		$this->session->set_userdata('location',$next);
448
    		$this->session->set_userdata('location',$next);
445
    	}
449
    	}
446
    	if(isset($getdata['data']) && !empty($getdata['data'])){
450
    	if(isset($getdata['data']) && !empty($getdata['data'])){
447
    		$data = $getdata['data'];
451
    		$data = $getdata['data'];
448
    	}else{
452
    	}else{
449
    		// $this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
453
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
450
    		redirect($next);die;
454
    		// redirect($next);die;
451
    	}
455
    	}
452
    	if(isset($getdata['token']) && !empty($getdata['token'])){
456
    	if(isset($getdata['token']) && !empty($getdata['token'])){
453
    		$token = $getdata['token'];
457
    		$token = $getdata['token'];
454
    	}else{
458
    	}else{
455
    		// $this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
459
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
456
    		redirect($next);die;
460
    		// redirect($next);die;
457
    	}    	
461
    	}    	
458
    	$userData = unserialize(base64_decode($data));
462
    	$userData = unserialize(base64_decode($data));
459
    	$hash = md5("21dtr022015|".$userData['Id']);
463
    	$hash = md5("21dtr022015|".$userData['Id']);    	
460
    	$userData['isLoggedIn'] = true;
-
 
461
    	// echo $hash;
-
 
462
    	// print_r($userData);
-
 
463
    	// echo $token;
-
 
464
    	if($hash != $token){
464
    	if($hash != $token){
465
    		// $this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
465
    		$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
466
    		redirect($next);die;
466
    		// redirect($next);die;
467
    	}
467
    	}
468
    	if (isset($_SERVER['HTTP_REFERER'])) {
468
    	if (isset($_SERVER['HTTP_REFERER'])) {
469
			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)) {
470
   				$redirect = $_SERVER['HTTP_REFERER'];
470
   				$redirect = $_SERVER['HTTP_REFERER'];
471
   				$location = $this->session->userdata('location');
471
   				$location = $this->session->userdata('location');
Line 480... Line 480...
480
   					$this->session->set_userdata('location',$redirect);	
480
   					$this->session->set_userdata('location',$redirect);	
481
   				}
481
   				}
482
   				
482
   				
483
			}
483
			}
484
		}
484
		}
-
 
485
		$userData['isLoggedIn'] = true;
485
		$this->session->set_userdata('authorized',$userData);
486
		$this->session->set_userdata('authorized',$userData);
486
		$location = $this->session->userdata('location');
487
		$location = $this->session->userdata('location');
487
		if(isset($location) && !empty($location)){
488
		if(isset($location) && !empty($location)){
488
			$this->session->unset_userdata('location');
489
			$this->session->unset_userdata('location');
489
			// $this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
490
			$this->layout->view(strtolower(__CLASS__).'/autologin',$getdata);
490
			redirect($location);
491
			// redirect($location);
491
		}
492
		}
492
		else{
493
		else{
493
			// $this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));
494
			$this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));
494
			redirect(base_url());	
495
			// redirect(base_url());	
495
		}
496
		}
496
    }
497
    }
497
}
498
}
498
 
499
 
499
/***** FOR LOGIN AUTHENTICATION *****
500
/***** FOR LOGIN AUTHENTICATION *****