Subversion Repositories SmartDukaan

Rev

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

Rev 14457 Rev 14868
Line 435... Line 435...
435
            }
435
            }
436
 
436
 
437
        }
437
        }
438
    }
438
    }
439
 
439
 
-
 
440
    public function autologin() {
-
 
441
        $getdata = $this->input->get();
-
 
442
        //error_log(print_r($getdata,true));
-
 
443
        $configdata = $this->config->item('gosf');
-
 
444
        $this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
-
 
445
        if(isset($getdata['data']) && !empty($getdata['data'])){
-
 
446
            $data = $getdata['data'];
-
 
447
        } else{
-
 
448
            // $this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));
-
 
449
            redirect(base_url().'home');
-
 
450
        }
-
 
451
        $userData = unserialize(base64_decode($data));
-
 
452
        if(isset($getdata['next']) && !empty($getdata['next'])){
-
 
453
            $userData['next'] = $getdata['next'];
-
 
454
        }
-
 
455
        $userData['next'] = str_replace('&next=','',$userData['next']);
-
 
456
        $authorized = $this->session->userdata('authorized');
-
 
457
        //check if user is already logged in
-
 
458
		if(isset($authorized) && !empty($authorized) && $authorized['isLoggedIn'] == 1){
-
 
459
			// $this->layout->view(strtolower(__CLASS__).'/autologin',$userData);
-
 
460
			redirect(base_url().$userData['next']);
-
 
461
		}        
-
 
462
        $userData['stylesheet'] = 'auth.css';
-
 
463
        $userData['title'] = 'Saholic';
-
 
464
        // if(isset($userData['next']) && !empty($userData['next'])){
-
 
465
            // $next = $userData['next'];
-
 
466
            // $this->session->set_userdata('location',$next);
-
 
467
        // }
-
 
468
        if(isset($getdata['token']) && !empty($getdata['token'])){
-
 
469
            $token = $getdata['token'];
-
 
470
        } else{
-
 
471
        	// $this->layout->view(strtolower(__CLASS__).'/autologin',$userData);
-
 
472
        	redirect(base_url().$userData['next']);
-
 
473
        }
-
 
474
        $hash = md5("21dtr022015|".$userData['Id']);
-
 
475
        //error_log(print_r($hash,true));
-
 
476
        if($hash != $token){
-
 
477
            // $this->layout->view(strtolower(__CLASS__).'/autologin',$userData);
-
 
478
            redirect(base_url().$userData['next']);
-
 
479
        }       
-
 
480
        $userData['isLoggedIn'] = true;
-
 
481
        $this->session->set_userdata('authorized',$userData);
-
 
482
        // error_log("cookie ".print_r($_COOKIE,true));
-
 
483
        $location = $this->session->userdata('location');
-
 
484
        if(isset($location) && !empty($location)){
-
 
485
            // error_log("inside condition 6", 0);
-
 
486
//          $this->session->unset_userdata('location');
-
 
487
            $this->layout->view(strtolower(__CLASS__).'/autologin',$userData);
-
 
488
  		} else {
-
 
489
       	    // error_log("inside condition 7", 0);
-
 
490
            $this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));
-
 
491
        }
-
 
492
    }
-
 
493
 
-
 
494
/*
440
    public function autologin() {    
495
    public function autologin() {    
441
    	$getdata = $this->input->get();
496
    	$getdata = $this->input->get();
442
    	$configdata = $this->config->item('gosf');
497
    	$configdata = $this->config->item('gosf');
443
		$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
498
		$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
444
		if(isset($getdata['data']) && !empty($getdata['data'])){
499
		if(isset($getdata['data']) && !empty($getdata['data'])){
Line 491... Line 546...
491
		}
546
		}
492
		else{
547
		else{
493
			$this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));			
548
			$this->layout->view(strtolower(__CLASS__).'/autologin',array('next'=>base_url()));			
494
		}
549
		}
495
    }
550
    }
-
 
551
    */
496
}
552
}
497
 
553
 
498
/***** FOR LOGIN AUTHENTICATION *****
554
/***** FOR LOGIN AUTHENTICATION *****
499
*    AUTHORIZE ARRAY + AUTHORIZE[AUTHORITY]=SUCCESS
555
*    AUTHORIZE ARRAY + AUTHORIZE[AUTHORITY]=SUCCESS
500
*	 FOR SIGN UP - 
556
*	 FOR SIGN UP -