function logout() { $data['thispage'] = "logout"; $data['title'] = "Logout || WishingMart."; //Chat User Offline $url_online = base_api_url() . "chat/online" . base_api_key(); if ($url_online) { $username = '******'; $password = '******'; $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, $url_online); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, array("uid" => $this->session->userdata('uid'), "online" => '0')); // Optional, delete this line if your API is open curl_setopt($curl_handle, CURLOPT_USERPWD, $username . ':' . $password); $buffer = curl_exec($curl_handle); curl_close($curl_handle); $result = json_decode($buffer); //print_r($result); if (isset($result->status) && $result->status == 'success') { //$this->session->all_userdata(); $this->session->sess_destroy(); redirect("landing"); } else { $this->session->set_flashdata('flashmsg', "<div>User in online error.</div>"); redirect('landing'); } // else end } // if end }
public function init() { $this->file_url = $this->url . "staticfiles/"; $this->base_app_url = base_url() . "module/app/"; $this->base_app_popup_url = base_url() . "module/app_popup/"; $this->base_api_url = base_api_url() . "module/api/"; $this->app_url = $this->base_app_url . $this->id . "/"; $this->app_popup_url = $this->base_app_popup_url . $this->id . "/"; $this->api_url = $this->base_api_url . $this->id . "/"; $class_data = new stdClass(); $class_data->id = $this->id; $class_data->bundle_id = $this->bundle_id; $class_data->version = $this->version; $class_data->path = $this->path; $class_data->url = $this->url; $class_data->file_url = $this->file_url; $class_data->base_app_url = $this->base_app_url; $class_data->base_app_popup_url = $this->base_app_popup_url; $class_data->base_api_url = $this->base_api_url; $class_data->app_url = $this->app_url; $class_data->app_popup_url = $this->app_popup_url; $class_data->api_url = $this->api_url; $this->class_data = $class_data; }
public function allchat() { self::logcheck(); //TO CHECK USER LOGIN OR NOT $data['thispage'] = "c2"; $data['title'] = "WishingMart || User Chat."; $uid = $this->session->userdata('uid'); $url_chat_all = base_api_url() . "chat/all_chat/uid/" . $uid . base_api_key(); $data['chat_all'] = self::getapi($url_chat_all); echo "<pre>"; print_r($data['chat_all']); echo "</pre>"; $this->load->view('chatapp/index', $data); }
</div> </div> <div id="pageModal"> <div class="pml_body"> <div class="pml_title">Reset Point</div> <div class="pml_detail">ล้างแต้มจากสมาชิกที่เลือกทั้งหมด ให้เป็น 0</div> <div class="pml_button_div"> <div class="btn pml_btn cancel rad_btn">Cancel</div> <div class="btn pml_btn done rad_btn">Done</div> </div> </div> </div> <ui-page-loading></ui-page-loading> <script type="text/javascript"> GURL.init("<?php echo root_url(); ?> ","<?php echo base_url(); ?> ","<?php echo base_api_url(); ?> "); </script> <div id="pageHeader"> </div> <div id="pageContent"> <!--pageContent :: START -->
function sendChat() { echo $from = $_SESSION['uid']; //echo "view1111111"; //$to = $_POST['to']; //$message = $_POST['message']; //echo $to = '101'; //echo $message = 'sample txt for test'; // $to = $this->input->get('to'); //echo $message = $this->input->get('message'); //echo $to = $this->get("to"); //echo $message = $this->get('message'); $this->load->helper('form'); $to = $this->input->post('to'); $message = $this->input->post('message'); //exit(); $_SESSION['openChatBoxes'][$to] = date('Y-m-d H:i:s', time()); $messagesan = $this->sanitize($message); if (!isset($_SESSION['chatHistory'][$to])) { $_SESSION['chatHistory'][$to] = ''; } $_SESSION['chatHistory'][$to] .= <<<EOD \t{ "s": "1", "f": "{$to}", "m": "{$messagesan}" \t}, EOD; unset($_SESSION['tsChatBoxes'][$to]); //$sql = "insert into chat (chat.from,chat.to,message,sent) values ('".mysql_real_escape_string($from)."', '".mysql_real_escape_string($to)."','".mysql_real_escape_string($message)."',NOW())"; //$query = mysql_query($sql); $data['chat_insrt'] = array('from' => $this->session->userdata('uid'), 'to' => $to, 'message' => $message); $url_chat_insert = base_api_url() . "chat/chatinsert/" . base_api_key(); if ($url_chat_insert) { $username = '******'; $password = '******'; $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, $url_chat_insert); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data["chat_insrt"]); // Optional, delete this line if your API is open curl_setopt($curl_handle, CURLOPT_USERPWD, $username . ':' . $password); $buffer = curl_exec($curl_handle); curl_close($curl_handle); $result = json_decode($buffer); //print_r($result);exit(); } //IF END echo "1"; exit(0); }
public function mygrant() { // TO GET Shipping Address Details PAGE $data['thispage'] = "10"; $data['title'] = "My Grant Requests || WishingMart"; $url_mygrant = base_api_url() . "dashboard/mygrantlist/uid/" . $this->session->userdata('uid') . base_api_key(); $data['mygrant_list'] = self::getapi($url_mygrant); //print_r($data['mygrant_list']); //exit(); $this->load->view('dashboard/index', $data); }