本文整理汇总了PHP中sendMsg函数的典型用法代码示例。如果您正苦于以下问题:PHP sendMsg函数的具体用法?PHP sendMsg怎么用?PHP sendMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: manage_action
function manage_action() {
if(!config::get('sms_username') || !config::get('sms_password')){
echo '<script>alert("您需要先设置用户名和密码才能使用短信管理功能!");window.location.href="'.url('config/system/set/sms').'";</script>';
exit;
}
include_once("phprpc/phprpc_client.php");
$client = new PHPRPC_Client();
$client->setProxy(NULL);
$client->useService('http://pay.cmseasy.cn/sms.php');
$client->setKeyLength(128);
$client->setEncryptMode(3);
$info = $client->getInfo(config::get('sms_username'),md5(config::get('sms_password')));
$info[0] = intval($info[0]);
$info[1] = intval($info[1]);
$this->view->info = $info;
if (front::post('submit')) {
if (front::post('act') == 'test') {
$rs = sendMsg(front::post('mobile'),'test');
if($rs->SendSMSResult == '0'){
front::flash('发送成功');
}else{
front::flash('发送失败,请检查用户名、密码或剩余条数');
}
}
}else{
if($info[0] < 50) front::flash('你的剩余短信不足50条,请及时充值');
}
}
示例2: run_shell_cmd
function run_shell_cmd($cmd)
{
$msg = "";
exec("{$cmd}", $output, $status);
foreach ($output as $line) {
$msg .= $line . PHP_EOL;
}
sendMsg($msg);
}
示例3: sendMsg
public function sendMsg()
{
$phone = I('post.phone');
$action = I('post.action');
$code = rand(1000, 9999);
$re = sendMsg($phone, $code, $action);
if ($re['result'] == 'SUCCESS') {
$this->ajaxReturn($code);
} else {
$this->ajaxReturn($re);
}
}
示例4: auth
public function auth($level = 1, $return = false)
{
if (isset($_SESSION['auth']) && $_SESSION['auth'] >= $level) {
return true;
} else {
if ($return) {
return false;
}
sendMsg('/', textid('system/messages/no_permission'));
}
die('foo');
}
示例5: tagall
function tagall()
{
$db = new SQLite3('bot.db');
$query = $db->query("SELECT username FROM CPRTeam_STAFF");
$i = 0;
$row = array();
while ($result = $query->fetchArray(SQLITE3_ASSOC)) {
$row[$i++]["username"] = $result["username"];
}
$msg = "";
for ($i = 0; $i < count($row); $i++) {
if ($row[$i]['username'] != $GLOBALS['userName']) {
$msg .= "@" . $row[$i]['username'] . " ";
}
}
sendMsg($msg);
}
示例6: findUserAction
public function findUserAction($gps, $long)
{
if (count(array_filter($gps)) != 2 || !$long) {
sendMsg('Data Error', 1);
}
$mlist = $this->mdb->command(['geoNear' => 'auths', 'near' => [doubleval($gps[0]), doubleval($gps[1])], 'spherical' => true, 'maxDistance' => $long / 6371000, 'distanceMultiplier' => 6371]);
if (!$mlist['ok']) {
sendMsg('Find Error', 1);
}
$info['results'] = array();
$userModel = new User();
foreach ($mlist['results'] as $val) {
if ((string) $this->auth->getAuth('userId') != (string) $val['obj']['userId']) {
$info['results'][] = ['userId' => (string) $val['obj']['userId'], 'user' => $userModel->info($val['obj']['userId']), 'userGame' => $userModel->ginfo($val['obj']['userId']), 'userIm' => $userModel->iminfo($val['obj']['userId']), 'GPS' => $val['obj']['addr'], 'pab' => getPab(doubleval($gps[0]), doubleval($gps[1]), $val['obj']['addr']['lng'], $val['obj']['addr']['lat']), 'ht' => $val['obj']['ht'], 'distance' => ceil($val['dis'] * 1000)];
}
}
sendMsg($info);
}
示例7: push
public function push()
{
global $worker_tasker, $cid;
global $ava_client, $client_sorted;
if (!$this->sid || time() - $this->last_time < 60) {
return False;
}
$this->last_time = time();
if (!$client_sorted) {
$to_choose_from = array();
$client_count = 0;
foreach ($cid as $now_client) {
if ($now_client->cid) {
$to_choose_from[] = $now_client;
$client_count++;
}
}
if (!$client_count) {
$this->cid = -1;
return False;
}
$client_sorted = True;
$ava_client = $to_choose_from;
} else {
$to_choose_from = $ava_client;
$client_count = count($ava_client);
}
if ($this->cid == -1) {
$turn = $this->sid % $client_count;
} else {
$turn = ($this->turn + 1) % $client_count;
}
$this->turn = $turn;
$this->cid = $to_choose_from[$turn]->cid;
sendMsg($to_choose_from[$turn], $this->send);
p("The solution ( sid = {$this->sid} ) was sent to the client ( cid = {$this->cid} )");
return True;
}
示例8: consult_action
function consult_action() {
if(front::post('submit')) {
if(front::post('content') == ''){
echo '<script>alert("请填写你要咨询的内容!");history.go(-1);</script>';
return false;
}
if(front::post('u_mobile') == ''){
echo '<script>alert("请填写你的手机号码!");history.go(-1);</script>';
return false;
}
$user='';
if(cookie::get('login_username') &&cookie::get('login_password')) {
$user=new user();
$user=$user->getrow(array('username'=>cookie::get('login_username')));
}
if($user['username'] == ''){
$user['username'] = '游客';
}
$smtpemailto = config::get('email');
$title = '游客'.front::ip().'在'.date('Y-m-d H:i:s').'留言';
$code = $user['username'].'('.front::post('u_mobile').')在'.date('Y-m-d H:i:s').'说'.front::post('content');
if($smtpemailto) {
$this->sendmail($smtpemailto,$title,$code);
}
if(config::get('sms_on') && config::get('sms_consult_admin_on') && $mobile = config::get('site_mobile')){
sendMsg($mobile,$user['username'].'('.front::post('u_mobile').')在'.date('Y-m-d H:i:s').'说'.front::post('content'));
$f = fopen('data/message/'.date('Ymd').'.txt','ab');
fwrite($f,$user['username']."\t".front::post('u_mobile')."\t".date('Y-m-d H:i:s')."\t".front::post('content')."\r\n");
fclose($f);
echo '<script>alert("咨询信息发送成功!");history.go(-1);</script>';
return false;
}
echo '<script>alert("咨询信息发送失败!");history.go(-1);</script>';
return false;
}
}
示例9: fputs
}
}
}
// now just pipe those commands to the server
fputs($fp, $args["eventstring"] . "\n");
// tell the server that we are done nicely.
fputs($fp, "close\n");
fclose($fp);
return TRUE;
}
}
if (isset($_GET)) {
if (isset($_GET['host'])) {
$args['host'] = urldecode($_GET['host']);
} else {
$args['host'] = '127.0.0.1';
}
$args['port'] = 2886;
//$args['password'] = 'pass';
$args['eventstring'] = urldecode($_GET['event']);
foreach ($_GET as $key => $value) {
if (strcasecmp(substr($key, 0, 3), 'pld') == 0) {
$args['payload'][] = urldecode($value);
}
}
sendMsg($args);
if (!isset($_GET['REFERER'])) {
$_GET['REFERER'] = "index.html";
}
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/" . $_GET["REFERER"]);
}
示例10: Bidelman
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: Eric Bidelman (ericbidelman@chromium.org)
*/
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
$REFRESH = 2;
// send SSE message (refresh appcache) every 2min.
/**
* Constructs the SSE data format and flushes that data to the client.
*
* @param string $id Timestamp/id of this connection.
* @param string $msg Line of text that should be transmitted.
*/
function sendMsg($id, $msg)
{
echo "id: {$id}" . PHP_EOL;
echo "data: {$msg}" . PHP_EOL;
echo PHP_EOL;
flush();
}
sleep($REFRESH);
$startedAt = time();
sendMsg($startedAt, $startedAt);
示例11: orders_action
function orders_action() {
$this->view->aid = trim(front::get('aid'));
if (front::post('submit')) {
$this->orders = new orders();
$row = $this->orders->getrow("","adddate DESC");
//var_dump(time());
if($row['adddate'] && time() - $row['adddate'] <= intval(config::get('order_time'))){
alerterror('操作频繁,请稍后再试');
return;
}
if (front::$post['telphone'] == '') {
alerterror('联系电话为必填!');
return;
}
front::$post['mid'] = $this->view->user['userid'] ? $this->view->user['userid'] : 0;
front::$post['adddate'] = time();
front::$post['ip'] = front::ip();
if (isset(front::$post['aid'])) {
$aidarr = front::$post['aid'];
unset(front::$post['aid']);
foreach ($aidarr as $val) {
front::$post['aid'].=$val . ',';
front::$post['pnums'].=front::$post['thisnum'][$val] . ',';
}
} else {
front::$post['aid'] = $this->view->aid;
}
if (!isset(front::$post['logisticsid']))
front::$post['logisticsid'] = 0;
front::$post['oid'] = date('YmdHis') . '-' . front::$post['logisticsid'] . '-' . front::$post['mid'] . '-' . front::$post['payname'];
$insert = $this->orders->rec_insert(front::$post);
if ($insert < 1) {
front::flash($this->tname . lang('添加失败!'));
} else {
if (config::get('sms_on') && config::get('sms_order_on')) {
sendMsg(front::$post['telphone'], config::get('sms_order'));
}
if (config::get('sms_on') && config::get('sms_order_admin_on') && $mobile = config::get('site_mobile')) {
sendMsg($mobile, '网站在' . date('Y-m-d H:i:s') . '有新订单了');
//echo 11;
}
$user = $this->view->user;
if(config::get('email_order_send_cust') && $user['e_mail']){
$title = "您在".config::get('sitename')."的订单".front::get('oid')."已提交";
$this->sendmail($user['e_mail'], $title, $title);
}
if(config::get('email_order_send_admin') && config::get('email')){
$title = '网站在' . date('Y-m-d H:i:s') . '有新订单了';
$this->sendmail(config::get('email'), $title, $title);
}
if (front::$post['payname'] && front::$post['payname'] != 'nopay') {
echo '<script type="text/javascript">alert("' . lang('orderssuccess') . ' ' . lang('现在转入支付页面') . '");window.location.href="' . url('archive/payorders/oid/' . front::$post['oid'], true) . '";</script>';
}
echo '<script type="text/javascript">alert("' . lang('orderssuccess') . '");window.location.href="' . url('archive/orders/oid/' . front::$post['oid'], true) . '";</script>';
}
} elseif (front::get('oid')) {
preg_match_all("/-(.*)-(.*)-(.*)/isu", front::get('oid'), $oidout);
$this->view->paytype = $oidout[3][0];
if($oidout[2][0] != $this->view->user['userid']){
alertinfo('查看订单失败', url::create('index/index'));
}
$where = array();
$where['oid'] = front::get('oid');
$this->view->orders = orders::getInstance()->getrow($where);
$this->view->statusnum = $data['status'] = $this->view->orders['status'];
switch ($data['status']) {
case 1:
$data['status'] = lang('完成');
break;
case 2:
$data['status'] = lang('处理中');
break;
case 3:
$data['status'] = lang('已发货');
break;
case 4:
$data['status'] = lang('客户已付款,待审核');
break;
case 5:
$data['status'] = lang('已核实客户支付');
break;
default:
$data['status'] = lang('新订单');
break;
}
$this->view->orders['status'] = $data['status'];
if ($this->view->paytype) {
$this->view->gotopaygateway = '<a href="' . url('archive/payorders/oid/' . front::get('oid'), true) . '">进入支付页面</a>';
}
//var_dump($this->view->user);var_dump($_SESSION);exit();
$this->out('message/orderssuccess.html');
} elseif (front::get('aid')) {
$this->view->archive = archive::getInstance()->getrow(front::get('aid'));
$this->view->categorys = category::getpositionlink2($this->view->archive['catid']);
$this->view->paylist = pay::getInstance()->getrows('', 50);
$this->view->logisticslist = logistics::getInstance()->getrows('', 50);
$prices = getPrices($this->view->archive['attr2']);
//.........这里部分代码省略.........
示例12: sendRecord
function sendRecord()
{
$record = $_POST["record"];
$subject = "聊天记录--" . friendlyDate(time(), "full");
echo sendMsg($this->mid, $this->mid, $subject, $record);
}
示例13: p
}
Timer::add(5, 'check_lost');
// 每5秒,检查无响应的评测请求
Timer::add(10, 'check_forgotten');
// 每10秒,在数据库中寻找丢失的请求
p('The server <Tasker> has started.');
};
$worker_tasker->onConnect = function ($connection) {
$connection->IP = $connection->getRemoteIp();
$connection->cid = 0;
$connection->name = '';
$connection->last_ping = 0;
$connection->deadline = Timer::add(5, function () use($connection) {
Timer::del($connection->deadline);
$connection->deadline = 0;
sendMsg($connection, array('action' => 'refuse'));
$connection->close();
p("A client timeout logging in. ( IP = {$connection->IP} )");
});
p("A new client has joined. ( IP = {$connection->IP} )");
};
$worker_tasker->onMessage = function ($connection, $data) {
$data = json_decode($data, True);
if ($connection->IP == '127.0.0.1' && isset($data['pass'], $data['task']) && $data['pass'] == sha1(DB_PASS)) {
if (!isset($data['task']['action'])) {
$solution = new Solution($data['task']);
$solution->push();
return;
} else {
switch ($data['task']['action']) {
case 'kill':
示例14: CPRTeam_STAFF
}
if (count($row) == 0) {
$db->exec("INSERT INTO CPRTeam_STAFF (uid, username) VALUES ('{$fromID}','{$userName}')");
} else {
$db->exec("UPDATE CPRTeam_STAFF SET username = '{$userName}' WHERE uid = '{$fromID}'");
}
}
if (substr($message, 0, 1) == "/") {
if (in_array($fromID, $users) || in_array($chatID, $groups)) {
$cmd = str_replace(strtolower("@" . BOT_NAME), '', strtolower($message));
switch ($cmd) {
case "/help":
help();
break;
case "/uptime":
uptime();
break;
case "/tagall":
tagall();
break;
case "/pull":
git_pull();
break;
default:
break;
}
} else {
sendMsg("你沒有權限喔~~~~~");
}
}
}
示例15: while
$steps = 0;
//when the client first registeres to the server, he is known with the timestamp of registering in the database
//the while loop checks, if the client already connected to somewhere else (newer timestamp)
$client_still_active = true;
while ($steps < 30) {
$sql = "SELECT SQL_CACHE max(DB_LAST_CHANGE) as DB_LAST_CHANGE FROM z_meta where RESOURCE_ID =:id";
$stmt = $dbh->prepare($sql);
$stmt->bindParam(":id", $res_id);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$stmt = null;
if ($result["DB_LAST_CHANGE"] > $client_timestamp) {
sendMsg(time(), "update");
$client_timestamp = $result["DB_LAST_CHANGE"];
}
//check if client has re-registered (you could do that every 3,4,5 sleep tick) by $steps%5 == 0
// $sql = "select count(*) as anz from z_push_clients where id = :id and timestamp = :ts";
// $stmt= $dbh->prepare($sql);
// $stmt->bindParam(":id",$_COOKIE['freiraum-identifier']);
// $stmt->bindParam(":ts",$client_timestamp);
// $stmt->execute();
// $result = $stmt->fetch(PDO::FETCH_ASSOC);
// $stmt->closeCursor();
// if ($result["anz"] == 0){$client_still_active = false;}
sleep(1);
$steps++;
}
} catch (Exception $e) {
sendMsg(time(), $e->getMessage());
}