Example #1
0
 public function giftmember(Request $request, Response $response)
 {
     $this->_nav_second = 'giftmember';
     $this->v->set_tplname('mod_member_giftmember');
     $searchinfo = ['start_date' => '', 'end_date' => ''];
     $searchinfo['start_date'] = $request->get('sdate', '');
     $searchinfo['end_date'] = $request->get('edate', '');
     if (strlen($searchinfo['start_date']) != 10) {
         //format: 'YYYY-MM-DD'
         $searchinfo['start_date'] = '';
     }
     if (strlen($searchinfo['end_date']) != 10) {
         //format: 'YYYY-MM-DD'
         $searchinfo['end_date'] = '';
     }
     if (!empty($searchinfo['start_date']) && !empty($searchinfo['end_date']) && $searchinfo['start_date'] > $searchinfo['end_date']) {
         //交换
         $t = $searchinfo['start_date'];
         $searchinfo['start_date'] = $searchinfo['end_date'];
         $searchinfo['end_date'] = $t;
     }
     $searchstr = 'sdate=' . $searchinfo['start_date'] . '&edate=' . $searchinfo['end_date'];
     $this->v->assign('searchinfo', $searchinfo);
     $this->v->assign('searchstr', $searchstr);
     //BEGIN list order
     $orderinfo = $this->v->set_listorder('rid', 'desc');
     $extraurl = $searchstr . '&';
     $extraurl .= $orderinfo[2];
     $this->v->assign('extraurl', $extraurl);
     $this->v->assign('qparturl', "#/member/giftmember");
     //END list order
     // Record List
     $limit = 30;
     $recordList = Member_Model::getGiftMemberList($orderinfo[0], $orderinfo[1], $limit, $searchinfo);
     $recordNum = count($recordList);
     $totalNum = $GLOBALS['pager_totalrecord_arr'][0];
     $this->v->assign('recordList', $recordList)->assign('recordNum', $recordNum)->assign('totalNum', $totalNum)->assign('mainsite', C('env.site.mobile'));
     $response->send($this->v);
 }
Example #2
0
File: login.php Project: vobinh/PHP
 private function check_login()
 {
     $login = $this->input->post('txt_email', '', TRUE);
     // security input data
     $pass = md5($this->input->post('txt_password'));
     // encrypt md5 input password
     // query result
     /*$admin_model = new Administrator_Model();
     		$valid = $admin_model->account_exist($login, $pass,1);
     		if($valid !== FALSE)		// if login by admin account	
     		{
     			if (!$valid['administrator_status'])	// if cus_status = 0 
     			{
     				//echo 'sd';die();
     				$this->session->set_flash('error_msg',Kohana::lang('errormsg_lang.msg_inactive_error'));		
     				url::redirect($this->site['history']['current']);
     				die();
     			}
     			
     			else
     			{								
     				$sess_admin['id'] = $valid['administrator_id'];
     				$sess_admin['level'] = $valid['administrator_level'];				
     				$sess_admin['username'] = $valid['administrator_username'];			
     				$sess_admin['name'] = $valid['administrator_fname'].' '.$valid['administrator_lname'];
     				$sess_admin['email'] = $valid['administrator_email'];	
     				$sess_admin['type'] = 0;			
     				Login_Model::set('admin',$sess_admin);
     				Login_Model::status_online($sess_admin['id'], 'online');
     				url::redirect('admin_account');
     				die();
     			}				
     		}
     		else
     		{
     			$member_model = new Member_Model();
     			$valid = $member_model->cus_exist($login, $pass);
     			if ($valid !== FALSE)	// if login by customer account		
     			{
     				if(!$valid['status'])	// if cus_status = 0 
     				{
     					$this->session->set_flash('error_msg',Kohana::lang('errormsg_lang.msg_inactive_error'));							
     					url::redirect('home');
     					die();				
     				}
     				else
     				{					
     					$sess['type'] = 1; // user
     					$sess['username'] = $valid['member_email'];					
     					$sess['id'] = $valid['uid'];
     					$sess['name'] = $valid['member_fname'].' '.$valid['member_lname'];
     					$sess['email'] = $valid['member_email'];
     				}
     			}
     			else
     			{					
     				$this->session->set_flash('error_msg',Kohana::lang('errormsg_lang.error_login_pass'));		
     				url::redirect('home');
     				die();
     			}
     		}*/
     $member_model = new Member_Model();
     $valid = $member_model->cus_exist($login, $pass);
     if ($valid !== FALSE) {
         if (!$valid['status']) {
             $this->session->set_flash('error_msg', Kohana::lang('errormsg_lang.msg_inactive_error'));
             url::redirect('home');
             die;
         } else {
             $sess['type'] = 1;
             // user
             $sess['username'] = $valid['member_email'];
             $sess['id'] = $valid['uid'];
             $sess['name'] = $valid['member_fname'] . ' ' . $valid['member_lname'];
             $sess['email'] = $valid['member_email'];
         }
     } else {
         $this->session->set_flash('error_msg', Kohana::lang('errormsg_lang.error_login_pass'));
         url::redirect('home');
         die;
     }
     Login_Model::set('customer', $sess);
     url::redirect('test');
     die;
 }
Example #3
0
File: login.php Project: vobinh/PHP
 private function check_login()
 {
     $login = $this->input->post('txt_email', '', TRUE);
     // security input data
     $pass = md5($this->input->post('txt_password'));
     // encrypt md5 input password
     $member_model = new Member_Model();
     $valid = $member_model->cus_exist($login, $pass);
     if ($valid !== FALSE) {
         if (!$valid['status']) {
             $this->session->set_flash('error_msg', Kohana::lang('errormsg_lang.msg_inactive_error'));
             url::redirect(url::base() . 'home');
             die;
         } else {
             $sess['type'] = 1;
             // user
             $sess['username'] = $valid['member_email'];
             $sess['id'] = $valid['uid'];
             $sess['name'] = $valid['member_fname'] . ' ' . $valid['member_lname'];
             $sess['email'] = $valid['member_email'];
         }
     } else {
         $this->session->set_flash('error_msg', Kohana::lang('errormsg_lang.error_login_pass'));
         url::redirect(url::base() . 'home');
         die;
     }
     $this->login_model->set('customer', $sess);
     url::redirect(url::base() . 'courses');
     die;
 }
Example #4
0
 public function submit()
 {
     $frm_reg = $this->_get_register_valid();
     if ($frm_reg['chk_sendmail'] == 'on') {
         $chk_sendmail = 1;
     } else {
         $chk_sendmail = 0;
     }
     $rec_up = array('member_email' => $frm_reg['txt_email'], 'member_pw' => md5($frm_reg['txt_password']), 'member_fname' => $frm_reg['txt_fname'], 'member_lname' => $frm_reg['txt_lname'], 'company_name' => $frm_reg['txt_cpname'], 'company_contact_name' => $frm_reg['txt_spname'], 'company_contact_email' => $frm_reg['txt_spemail'], 'register_date' => time(), 'status' => 1, 'send_mail' => $chk_sendmail);
     $this->db->insert('member', $rec_up);
     $this->session->set_flash('success_msg', 'Congratulations. You have successfully created an account. Please log-in using your new account.');
     $member_email = explode('@', $rec_up['member_email']);
     if ($chk_sendmail == 0) {
         if (isset($member_email[1]) && ($member_email[1] == 'hotmail.com' || $member_email[1] == 'live.com' || $member_email[1] == 'outlook.com')) {
             $send = $this->send_mailgun_register($rec_up, $frm_reg['txt_password']);
             if (!$send) {
                 $this->send_mailgun_register($rec_up, $frm_reg['txt_password']);
             }
         } else {
             $this->send_mailgun_register($rec_up, $frm_reg['txt_password']);
         }
     }
     /**
      * login
      */
     $login = $frm_reg['txt_email'];
     $pass = md5($frm_reg['txt_password']);
     $member_model = new Member_Model();
     $valid = $member_model->cus_exist($login, $pass);
     if ($valid !== FALSE) {
         if (!$valid['status']) {
             $this->session->set_flash('error_msg', Kohana::lang('errormsg_lang.msg_inactive_error'));
             url::redirect(url::base() . 'home');
             die;
         } else {
             $sess['type'] = 1;
             // user
             $sess['username'] = $valid['member_email'];
             $sess['id'] = $valid['uid'];
             $sess['name'] = $valid['member_fname'] . ' ' . $valid['member_lname'];
             $sess['email'] = $valid['member_email'];
             $this->db->where('uid', $valid['uid']);
             $this->db->update('member', array('id_sess' => $this->session->id()));
         }
     } else {
         $this->session->set_flash('error_msg', Kohana::lang('errormsg_lang.error_login_pass'));
         url::redirect(url::base() . 'home');
         die;
     }
     $this->login_model->set('customer', $sess);
     url::redirect(url::base() . 'courses');
     die;
 }