public function register() { $inputs['username'] = array('type' => 'input', 'label' => 'Username', 'rules' => 'required'); $inputs['password'] = array('type' => 'password', 'label' => 'Password', 'rules' => 'required'); $inputs['email'] = array('type' => 'input', 'label' => 'Email', 'rules' => 'required'); $inputs['hp'] = array('type' => 'input', 'label' => 'Mobile Phone', 'rules' => 'required'); $inputs['height'] = array('type' => 'input', 'label' => 'Height (cm)', 'rules' => 'required'); $inputs['gender'] = array('type' => 'input', 'label' => 'Gender', 'rules' => 'required', 'options' => array('male' => 'Male', 'female' => 'Female')); $defaults = array(); if (rbt_valid_post($inputs)) { $_POST['password'] = hashim($this->input->post('password')); $_POST['created_at'] = date('Y-m-d H:i:s'); $_POST['status'] = 'activated'; $this->db->insert('users', $this->input->post()); toshout_success('Your account has been created. <br/>Please <a href="' . site_url('login') . '">login here »</a>'); redirect('umum/register'); } $data['inputs'] = $inputs; $data['defaults'] = $defaults; if (!$this->uri->segment(3)) { $data['title'] = 'Register'; } else { $data['title'] = 'Change Details'; } $this->load->view('umum_form', $data); }
public function setting() { $user = $this->session->userdata('user'); $inputs['username'] = array('type' => 'input', 'label' => 'Username', 'rules' => 'required'); $inputs['password'] = array('type' => 'password', 'label' => 'Password', 'rules' => 'required'); $inputs['email'] = array('type' => 'input', 'label' => 'Email', 'rules' => 'required'); $inputs['hp'] = array('type' => 'input', 'label' => 'Mobile Phone', 'rules' => 'required'); $inputs['height'] = array('type' => 'input', 'label' => 'Height (cm)', 'rules' => 'required'); $inputs['gender'] = array('type' => 'dropdown', 'label' => 'Gender', 'rules' => 'required', 'options' => array('male' => 'Male', 'female' => 'Female')); $defaults = array(); if (rbt_valid_post($inputs)) { $_POST['password'] = hashim($this->input->post('password')); // $_POST['created_at'] = date('Y-m-d H:i:s'); // $_POST['status'] = 'activated'; $this->db->where('id', $user['id']); $this->db->update('users', $this->input->post()); // $this->db->insert('users',$this->input->post()); toshout_success('Your settings has been changed.'); } $this->db->where('id', $user['id']); $query = $this->db->get('users'); $defaults = $query->row_array(); $defaults['password'] = robot($defaults['password']); $data['inputs'] = $inputs; $data['defaults'] = $defaults; $data['title'] = 'Change Details'; $this->load->view('dashboard_form', $data); }
public function purchase() { $inputs['upload_receipt'] = array('type' => 'upload', 'label' => 'Upload Resit', 'rules' => 'upload_path:locked/receipts|allowed_types:gif,png,jpeg,jpg,pdf|max_size:1000|overwrite:TRUE'); $inputs['manual_receipt'] = array('type' => 'textarea', 'label' => 'ATAU Taip Maklumat Resit', 'rules' => ''); $data['inputs'] = $inputs; $this->load->model('Purchase'); if (rbt_valid_post($inputs)) { toshout_success('Maklumat Bayaran telah selamat kami terima. Kami akan sahkan bayaran tuan secepat mungkin. <b>Emel berserta link download</b> akan di hantar setelah bayaran di sahkan. Terima kasih!'); $res = $this->Purchase->approve_manual($this->uri->segment(3), $this->input->post()); // redirect('umum/purchase/'.$this->uri->segment(3)); } $purchase = $this->Purchase->get_details($this->uri->segment(3)); // will send status as pending $data['purchase'] = $purchase; // if(rbt_valid_post($inputs)){ // // tukar status as payment_confirmed ... so boleh redirect download terus // $this->db->where('key', $this->uri->segment(3)); // $this->db->update('purchases', array('status'=>'payment_confirmed')); // } $this->load->view('umum_purchase', $data); }
public function resend() { $key = $this->uri->segment(3); if ($key) { $this->load->model('Purchase'); $this->Purchase->email_download_link($key); toshout_success('Yay, that ebook has been resend!'); } redirect($_SERVER['HTTP_REFERER']); }