PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function send($peer_id, $message, $attachment = '', $keyboard = '{"one_time": false, "buttons": []}', $a = 0) { global $user_id; global $kopat; $data = file_get_contents("/var/www/html/playersdouble/" . $user_id); $array = unserialize($data); $nick = $array["nick"]; if(iconv_strlen(str_replace(" ", " ", str_replace(" ", " ", str_replace(" ", " ", $nick))), 'UTF-8') < 3){ $array["nick"] = "Игрок"; $nick = $array["nick"]; savePlayer("/var/www/html/playersdouble/".$user_id, serialize($array)); } if ($array["nick2"] == "0") { $message = "[id" . $array["idvk"] . "|" . $nick . "], " . $message; } if ($array["nick2"] == "1") { $message = $nick . ", " . $message; } if ($array["dop25"] == "1") { $message = "". $array['prefix'] ." [id" . $array["idvk"] . "|" . $nick . "], " . $message; } $params['peer_id'] = $peer_id; $params['message'] = $message; $params['attachment'] = $attachment; global $inline; global $inlinemsg; if($inline != "NO"){ $params['keyboard'] = $inline; } else { $params['keyboard'] = $keyboard; } if($peer_id == 2000000001 && $inlinemsg == "NO"){ // double $keyboard = '{ "one_time": false, "buttons": [ ['; $keyboard .= '{ "action": { "type": "text", "payload": "{\"button\": \"0\"}", "label": "Банк" }, "color": "positive" }, '; $keyboard .= '{ "action": { "type": "text", "payload": "{\"button\": \"0\"}", "label": "Баланс" }, "color": "positive" } '; $keyboard .= '], ['; $keyboard .= '{ "action": { "type": "text", "payload": "{\"button\": \"0\"}", "label": "x2" }, "color": "primary" }, '; $keyboard .= '{ "action": { "type": "text", "payload": "{\"button\": \"0\"}", "label": "x3" }, "color": "primary" }, '; $keyboard .= '{ "action": { "type": "text", "payload": "{\"button\": \"0\"}", "label": "x5" }, "color": "primary" } '; $keyboard .= '], ['; $keyboard .= '{ "action": { "type": "text", "payload": "{\"button\": \"0\"}", "label": "x50" }, "color": "positive" }'; $keyboard .= '], ['; $keyboard .= '{ "action": { "type": "text", "payload": "{\"button\": \"0\"}", "label": "Рейтинг" }, "color": "negative" }, '; $keyboard .= '{ "action": { "type": "text", "payload": "{\"button\": \"0\"}", "label": "Бонус" }, "color": "default" }, '; $keyboard .= '{ "action": { "type": "text", "payload": "{\"button\": \"0\"}", "label": "Донат" }, "color": "default" } '; $keyboard .= '] ] }'; $params['keyboard'] = $keyboard; } else { $params['keyboard'] = $inline; } //$params['keyboard'] = ''; $params['access_token'] = ACCESS_TOKEN; $params['v'] = VKAPI_VERSION; $url = 'https://api.vk.me/method/messages.send'; $result = @file_get_contents($url, false, stream_context_create(array( 'http' => array( 'method' => 'POST', 'content' => http_build_query($params) ) ))); $response = json_decode($result); if (isset($response->error)){ //send2($peer_id, serialize($response->error)); } return true; } send($peer_id, '123');
Show:  
Copy Clear