".rtrim($configData["url"], "/")."/webchat/admin/talk.php?talker=".$sid."&apikey=apikey
"; $msg .= $_POST["nickName"]."
"; $msg .= "Please Click Here to start talk...
"; $post = array( "uid" => "8860120", "pwd" => md5("1234"), "msg" => nl2br($msg), "rid" => $SM_SN_ACC ); curl_post("http://www.sendnotices.com/api/sendprivate.php?", $post); safechat_post($post); */ } }else if($cmd == "getHistroyMessage"){ $historyMessage = getHistoryMessage($sid, "user"); $ret["success"] = true; $ret["historyMessage"] = $historyMessage; }else if($cmd == "getNewMessage"){ $newMessage = getNewMessage($sid, $_POST["lastFile"], "user"); $ret["success"] = (count($newMessage) > 0) ? true : false; $ret["newMessage"] = $newMessage; }else if($cmd == "uploadFile2"){ $uploaddir = DATAIMAGEDIR; ismkdir($uploaddir); $uploaddir .= $sid."/"; ismkdir($uploaddir); foreach($_FILES as $k => $v){ if ($v["error"] == UPLOAD_ERR_OK){ $tmp_name = $v["tmp_name"]; $imgName = time()."_".rand(1, 1000); $name = $v["name"]; $tmp = explode(".", $name); $ext = strtolower($tmp[count($tmp) - 1]); $imgName .= ".".$ext; $imgName = basename($imgName); $uploadfile = $uploaddir . $imgName; $ext= pathinfo($uploadfile, PATHINFO_EXTENSION); if($ext!='jpg' && $ext!='jpeg' && $ext!='png' && $ext!='gif') die('function error move_uploaded_file'); if (move_uploaded_file_anti($tmp_name, $uploadfile)){ chmod($uploadfile, 0644); $email = $_SESSION["webChat"]["email"]; $nickName = $_SESSION["webChat"]["nickName"]; $uploadurl = URL_DATAIMAGE.$sid."/".$imgName; $message = getUploadFileMessage($uploadurl, $name, $ext); setNewMessage($sid, $message, $email, $nickName, "user"); $ret['success'] = true; }else{ $ret['success'] = false; $errorMsg .= $name." : ".$configData["fatal_error"]." #139"; } }else{ $ret['success'] = false; $errorMsg .= $name." : ".$configData["fatal_error"]." #143"; } } }else if($cmd == "uploadFile"){ $uploaddir = DATAIMAGEDIR; ismkdir($uploaddir); $uploaddir .= $sid."/"; ismkdir($uploaddir); $data = array(); $errorMsg = ''; $email = $_SESSION["webChat"]["email"]; $nickName = $_SESSION["webChat"]["nickName"]; $file_name = $_FILES['uploadFile']['name']; $file_error = $_FILES['uploadFile']['error']; $file_tmp_name = $_FILES['uploadFile']['tmp_name']; $count = count($file_name); for($i = 0; $i < $count; $i++){ if ($file_error[$i] == UPLOAD_ERR_OK){ $uploadCount = count(glob($uploaddir."/*")); if($uploadCount >= 30){ $errorMsg .= $configData["fatal_error"]." #120"; break; } $tmp_name = $file_tmp_name[$i]; $imgName = time()."_".rand(1, 1000); $name = $file_name[$i]; $tmp = explode(".", $name); $ext = strtolower($tmp[count($tmp) - 1]); $imgName .= ".".$ext; $imgName = basename($imgName); $uploadfile = $uploaddir . $imgName; $ext= pathinfo($uploadfile, PATHINFO_EXTENSION); if($ext!='jpg' && $ext!='jpeg' && $ext!='png' && $ext!='gif') die('function error move_uploaded_file'); if (move_uploaded_file_anti($tmp_name, $uploadfile)){ chmod($uploadfile, 0644); $uploadurl = URL_DATAIMAGE.$sid."/".$imgName; $message = getUploadFileMessage($uploadurl, $name, $ext); $data[] = setNewMessage($sid, $message, $email, $nickName, "user"); }else{ $errorMsg .= $name." : ".$configData["fatal_error"]." #139"; } }else{ $errorMsg .= $name." : ".$configData["fatal_error"]." #143"; } } $ret['success'] = true; $ret['data'] = $data; $ret['errorMsg'] = $errorMsg; }else{ $email = $_SESSION["webChat"]["email"]; $nickName = $_SESSION["webChat"]["nickName"]; if($nickName =='火苗') { $ret["success"] = true; die(json_encode($ret)); } $message = $_POST["message"]; $ret = setNewMessage($sid, $message, $email, $nickName, "user"); if($ret['is_block']==true){ die(json_encode($ret)); //來亂的,就不送簡訊 } $SM_SN_ACC = $configData["sendNotice"]; $msg = '來自 3x 呼叫管理員
'; $msg .= '時間:'.date(' Y-m-d H:i:s ')."
"; $msg .= "".$message.""; $html = urlencode($msg); //send_mail("may980610@gmail.com",$email,"來自 3x 呼叫管理員",$msg); //file_get_contents('http://m.3x.com.tw/send_mobile_msg_self.php?xid='.$userid.'&password='.$password.'&html='.$html); $phone='0966199090'; $password='lionlion'; file_get_contents('http://webapp.wnotice.com/?phone='.$phone.'&password='.$password.'&html='.$html); $phone='0933096595'; $password='123456'; file_get_contents('http://webapp.wnotice.com/?phone='.$phone.'&password='.$password.'&html='.$html); $post = array( "uid" => $sid, "nickName" => $nickName, "pwd" => md5("1234"), "msg" => nl2br($msg), "rid" => $SM_SN_ACC ); //curl_post("http://www.3x.com.tw/webchat/wNotice/api/broadcasting.php?", $post); //safechat_post($post); } die(json_encode($ret)); } function move_uploaded_file_anti($tmp_name, $uploadfile){ $temp = load_image($tmp_name); $imagesx = imagesx($temp); $imagesy = imagesy($temp); if($imagesx>1920){ $w = 1920; $h = $imagesy*$w/$imagesx; $temp = imagescale($temp , $w, $h); } else if($imagesx>0){ $w = $imagesx; $h = $imagesy*$w/$imagesx; $temp = imagescale($temp , $w, $h); } else { die('236 not allow size'); } imagejpeg($temp, $uploadfile); } function load_image($pic){ $type=exif_imagetype($pic); $support_type=array(IMAGETYPE_JPEG , IMAGETYPE_PNG , IMAGETYPE_GIF); if(!in_array($type, $support_type,true)) { echo "pic: ".$pic."
"; echo "type: ".$type."
"; die( 'this type of image does not support! only support jpg , gif or png'); } switch($type) { case IMAGETYPE_JPEG : $image = imagecreatefromjpeg($pic); break; case IMAGETYPE_PNG : $image = imagecreatefrompng($pic); break; case IMAGETYPE_GIF : $image = imagecreatefromgif($pic); break; default: die( 'Load image error!'); } return $image; } /* if(empty($_SESSION["webChat"])){ if($_SESSION["buyer"]["isLogin"]){ $_SESSION["webChat"] = array(); $_SESSION["webChat"]["nickName"] = $_SESSION["buyer"]["name"]; $_SESSION["webChat"]["email"] = $_SESSION["buyer"]["email"]; } } */ function safechat_post($post = array(), $options = array()) { $userid='lion'; $password='lionlion'; $html = urlencode($post['msg'])."
from:".$_SESSION["webChat"]["nickName"]."
email:".$_SESSION["webChat"]["email"]; file_get_contents('http://m.3x.com.tw/send_mobile_msg_self.php?xid='.$userid.'&password='.$password.'&html='.$html); //$phone='0930889066'; //$password='lionlion'; //$html = urlencode($post['msg'])."
from:".$_SESSION["webChat"]["nickName"]."
email:".$_SESSION["webChat"]["email"]; //file_get_contents('http://safechat.wnotice.com/?phone='.$phone.'&password='.$password.'&html='.$html.''); } function curl_post($url, $post = array(), $options = array()) { $defaults = array( CURLOPT_POST => 1, CURLOPT_HEADER => 0, CURLOPT_URL => $url, CURLOPT_FRESH_CONNECT => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FORBID_REUSE => 1, CURLOPT_TIMEOUT => 20, CURLOPT_POSTFIELDS => http_build_query($post) ); $ch = curl_init(); curl_setopt_array($ch, ($options + $defaults)); if( ! $result = curl_exec($ch)) { //trigger_error(curl_error($ch)); } curl_close($ch); return $result; } ?>