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); }
function sendmsg($qq, $sid, $sendmsg) { global $method; $url = 'http://q32.3g.qq.com/g/s?sid=' . $sid . '&3G_UIN=' . $qq . '&saveURL=0&aid=nqqChat'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, 'MQQBrowser WAP (Nokia/MIDP2.0)'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); echo $url = curl_exec($ch); curl_close($ch); $url = htmlspecialchars($url); $qq2 = explode('【QQ功能】<br/>', $url); $qq2 = explode('">', $qq2[1]); $qq2 = explode('q=', $qq2[0]); $m = explode('提示</a>)', $url); $m = explode('<input', $m[1]); $msg = explode('<br/>', $url); $nc = explode(':', $msg[2]); $nc = $nc[0]; $qq2 = $qq2[1]; $array = explode($nc, $m[0]); $tj = count($array) - 1; $sc = array($msg[3], $msg[5], $msg[7]); $resultStr = ''; for ($i = 0; $i < $tj; $i++) { $arr1 = array(' ', ' '); $arr2 = array('', ''); $msg = str_replace($arr1, $arr2, $sc[$i]); $d = date("Y-m-j H:i:s"); if ($method = 'robot') { $msg3 = robot($msg); if ($msg3 == '') { $msg3 = "{$nc}不懂这是什么意思哦~"; } } elseif ($method = 'diy') { $msg3 = $sendmsg; } $resultStr .= '问:<FONT color=green>' . $msg . '</FONT><br>答:' . $msg3 . '<hr>'; $url5 = 'http://q16.3g.qq.com/g/s?sid=' . $sid . '&aid=sendmsg&tfor=qq&referer='; $post = 'msg=' . $msg3 . '&u=' . $qq2 . '&saveURL=0&do=send'; $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $url5); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_exec($ch); curl_close($ch); sleep(1); } return $resultStr; }
function retrieve() { $this->load->helper('form'); if ($this->input->post()) { //dumper($this->input->post('email')); $this->load->helper('email'); if (valid_email($this->input->post('email'))) { $query = $this->db->get_where('users', array('email' => $this->input->post('email'))); if ($query->num_rows() == 1) { $res = $query->result_array(); $msg = 'Password anda ialah: ' . robot($res[0]['password']) . ' .Jangan lupa lagi. Login di: http://pts.com.my/ppsv2 . Sekian,'; $this->load->library('email'); $this->email->from('*****@*****.**', 'MIS'); $this->email->to($res[0]['email']); //$this->email->cc('*****@*****.**'); //$this->email->bcc('*****@*****.**'); $this->email->subject('PPS - Password'); $this->email->message($msg); $this->email->send(); //send_email($res[0]['email'], 'PPS - Password', $msg); //dumper($msg); $_POST['email'] = ''; toshout(array('Password anda telah sistem emailkan. Sila semak email.' => 'success')); } else { toshout(array('Email tersebut tidak wujud dalam sistem. Sila gunakan email yang betul.' => 'error')); } } else { toshout(array('Email tidak sah. Anda yakin itu adalah email?' => 'error')); } } $this->load->view('v_user_retrieve'); }