本文整理汇总了PHP中sendMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP sendMessage函数的具体用法?PHP sendMessage怎么用?PHP sendMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convertToName
function convertToName($chatId)
{
if ($chatId < 0) {
//is Group
switch ($chatId) {
case 'groupID1':
return "group1";
break;
case 'groupID2':
return "group2";
break;
default:
sendMessage("me", $chatId . "群組使用了我");
return $chatId;
break;
}
} else {
if ($chatId > 0) {
//is Personal
switch ($chatId) {
case 'me':
return "me";
break;
case '1':
return "1";
break;
default:
sendMessage("me", $chatId . "是" . $senderName);
return $chatId;
break;
}
}
}
}
示例2: optimalpayments_3dsecure
function optimalpayments_3dsecure($params)
{
$cardtype = optimalpayments_cardtype($params['cardtype']);
$xml = "<ccEnrollmentLookupRequestV1\nxmlns=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:schemaLocation=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\">\n<merchantAccount>\n<accountNum>" . $params['accountnumber'] . "</accountNum>\n<storeID>" . $params['merchantid'] . "</storeID>\n<storePwd>" . $params['merchantpw'] . "</storePwd>\n</merchantAccount>\n<merchantRefNum>" . $params['invoiceid'] . "</merchantRefNum>\n<amount>" . $params['amount'] . "</amount>\n<card>\n<cardNum>" . $params['cardnum'] . "</cardNum>\n<cardExpiry>\n<month>" . substr($params['cardexp'], 0, 2) . "</month>\n<year>20" . substr($params['cardexp'], 2, 2) . "</year>\n</cardExpiry>\n<cardType>" . $cardtype . "</cardType>\n</card>\n</ccEnrollmentLookupRequestV1>";
$url = "https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1";
if ($params['testmode']) {
$url = "https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1";
}
$query_str = "txnMode=ccTDSLookup&txnRequest=" . urlencode($xml);
$data = curlCall($url, $query_str);
$xmldata = XMLtoArray($data);
$xmldata = $xmldata['CCTXNRESPONSEV1'];
if ($xmldata['CODE'] == "0") {
logTransaction("Optimal Payments 3D Auth", $data, "Lookup Successful");
$_SESSION['optimalpaymentsconfirmationnumber'] = $xmldata['CONFIRMATIONNUMBER'];
if ($xmldata['TDSRESPONSE']['ENROLLMENTSTATUS'] == "Y") {
$code = "<form method=\"post\" action=\"" . $xmldata['TDSRESPONSE']['ACSURL'] . "\">\n<input type=hidden name=\"PaReq\" value=\"" . $xmldata['TDSRESPONSE']['PAYMENTREQUEST'] . "\">\n<input type=hidden name=\"TermUrl\" value=\"" . $params['systemurl'] . "/modules/gateways/callback/optimalpayments.php\">\n<input type=hidden name=\"MD\" value=\"" . $params['invoiceid'] . "\">\n<noscript>\n<div class=\"errorbox\"><b>JavaScript is currently disabled or is not supported by your browser.</b><br />Please click the continue button to proceed with the processing of your transaction.</div>\n<p align=\"center\"><input type=\"submit\" value=\"Continue >>\" /></p>\n</noscript>\n</form>";
return $code;
}
$captureresult = optimalpayments_capture($params);
if ($captureresult['status'] == "success") {
addInvoicePayment($params['invoiceid'], $captureresult['transid'], "", "", "optimalpayments", "on");
sendMessage("Credit Card Payment Confirmation", $invoiceid);
}
logTransaction("Optimal Payments Non 3d Processed", $captureresult['rawdata'], ucfirst($captureresult['status']));
return $captureresult['status'];
}
logTransaction("Optimal Payments 3D Auth", $data, "Failed");
}
示例3: onMessage
function onMessage($from, $channel, $msg)
{
//Only trigger on !botlog
if (stringStartsWith($msg, "{$this->config['trigger']}botlog")) {
//Get hold of number of rows to show and possible password
$tmp = explode(" ", $msg);
$pass = '';
if (count($tmp) == 3) {
$pass = $tmp[1];
$limit = $tmp[2];
} else {
if (count($tmp) == 2) {
$limit = $tmp[1];
}
}
if (!is_numeric($limit)) {
$limit = 10;
}
if (strlen($this->config['adminPass']) > 0 && $pass != $this->config['adminPass']) {
sendMessage($this->socket, $channel, "{$from}: Wrong password");
} else {
//Password auth ok, display log data
sendMessage($this->socket, $channel, "{$from}: Last {$limit} entries from bot log:");
$logdata = file('logs/vikingbot.log');
$rows = count($logdata);
for ($i = $rows - $limit; $i < $rows; $i++) {
sendMessage($this->socket, $channel, "{$logdata[$i]}");
//Avoid Excess flood kick from server
usleep(500000);
}
sendMessage($this->socket, $channel, "------------");
}
}
}
示例4: runBountyExchange
public static function runBountyExchange($username, $defender)
{
// *** BOUNTY EQUATION ***
$user = Player::findByName($username);
$defender = Player::findByName($defender);
if ($defender->bounty > 0) {
$user->set_gold($user->gold + $defender->bounty);
$user->save();
$defender->set_bounty(0);
$defender->save();
// *** Reward bounty whenever available. ***
return "You have received the {$defender->bounty} gold bounty on {$defender}'s head for your deeds!";
$bounty_msg = "You have valiantly slain the wanted criminal, {$defender}! For your efforts, you have been awarded {$defender->bounty} gold!";
sendMessage("Village Doshin", $username, $bounty_msg);
} else {
// *** Bounty Increase equation: (attacker's level - defender's level) / an increment, rounded down ***
$levelRatio = floor(($user->level - $defender->level) / 10);
$bountyIncrease = min(25, max($levelRatio * 25, 0));
//Avoids negative increases, max of 30 gold, min of 0
if ($bountyIncrease > 0) {
// *** If Defender has no bounty and there was a level difference. ***
$user->set_bounty($user->bounty + $bountyIncrease);
$user->save();
return "Your victim was much weaker than you. The townsfolk are angered. A bounty of {$bountyIncrease} gold has been placed on your head!";
} else {
return null;
}
}
}
示例5: doUnsubscribe
/**
*
* @ WHMCS FULL DECODED & NULLED
*
* @ Version : 5.2.15
* @ Author : MTIMER
* @ Release on : 2013-12-24
* @ Website : http://www.mtimer.cn
*
**/
function doUnsubscribe($email, $key)
{
global $whmcs;
global $_LANG;
$whmcs->get_hash();
if (!$email) {
return $_LANG['pwresetemailrequired'];
}
$result = select_query("tblclients", "id,email,emailoptout", array("email" => $email));
$data = mysql_fetch_array($result);
$userid = $data['id'];
$email = $data['email'];
$emailoptout = $data['emailoptout'];
$newkey = sha1($email . $userid . $cc_encryption_hash);
if ($newkey == $key) {
if (!$userid) {
return $_LANG['unsubscribehashinvalid'];
}
if ($emailoptout == 1) {
return $_LANG['alreadyunsubscribed'];
}
update_query("tblclients", array("emailoptout" => "1"), array("id" => $userid));
sendMessage("Unsubscribe Confirmation", $userid);
logActivity("Unsubscribed From Marketing Emails - User ID:" . $userid, $userid);
return null;
}
return $_LANG['unsubscribehashinvalid'];
}
示例6: send_kill_mails
function send_kill_mails($username, $target, $attacker_id, $article, $item, $today, $loot)
{
$target_email_msg = "You have been killed by {$attacker_id} with {$article} {$item} at {$today} and lost {$loot} gold.";
sendMessage($attacker_id, $target, $target_email_msg);
$user_email_msg = "You have killed {$target} with {$article} {$item} at {$today} and received {$loot} gold.";
sendMessage($target, $username, $user_email_msg);
}
示例7: updateCheck
/**
*
* update check value
* @param type $id curr id
* @param type $status status: 0 or 1
*/
public function updateCheck()
{
if (!v_islogin()) {
$this->error('请登录', U("Admin/User/Login"));
} else {
$status = I('param.status');
$id = I('param.cork-id');
$canid = I('param.canid');
$content = I('param.content');
$cork = M('cork')->where(array("id" => $id))->select();
if ($cork) {
$cork[0]['check'] = $status;
$cork[0]['content'] = $content;
$cork[0]['canid'] = $canid;
M('cork')->data($cork[0])->save();
if ($status == 1) {
self::delete($id);
sendMessage($cork[0]['openid'], "您的作品未通过审核,请按规则重新上传,如有疑问请联系客服。\n原因:" . $content . "\n点击链接重新上传:http://wx.mynow.net/?s=/Home/Oauth2/index/type/index");
} else {
if ($status == 2) {
sendMessage($cork[0]['openid'], "您的作品已通过审核,详情请点击:http://wx.mynow.net/?s=/Home/Oauth2/index/type/index");
}
}
$this->success('审核成功', U("Admin/Activity/cork"), 3);
} else {
//no change
$this->error('参数错误,ID未找到', U("Admin/Activity/cork"), 5);
}
}
}
示例8: sendFormatedMessage
function sendFormatedMessage($msgInfo)
{
$msgInfo['reqTime'] = number_format(1000 * time(), 0, '', '');
$content = $msgInfo['memberCode'] . $msgInfo['customerName'] . $msgInfo['customerPhone'] . $msgInfo['customerAddress'] . $msgInfo['customerMemo'] . $msgInfo['msgDetail'] . $msgInfo['deviceNo'] . $msgInfo['msgNo'] . $msgInfo['reqTime'] . FEYIN_KEY;
$msgInfo['securityCode'] = md5($content);
$msgInfo['mode'] = 1;
return sendMessage($msgInfo);
}
示例9: newFiles
public static function newFiles()
{
$this->setDefaults();
foreach ($this->plugin->storage->newFiles as $fileName) {
MessageM . sendMessage(null, "%TAG%WCouldn't find '%A%fileName%.yml%W' creating new one.", "fileName-" . $fileName);
}
$this->plugin->storage->newFiles = [];
}
示例10: onMessage
public function onMessage($from, $channel, $msg)
{
if (stringEndsWith($msg, "{$this->config['trigger']}memory")) {
$usedMem = round(memory_get_usage() / 1024 / 1024, 2);
$freeMem = round($this->config['memoryLimit'] - $usedMem, 2);
sendMessage($this->socket, $channel, $from . ": Memory status: {$usedMem} MB used, {$freeMem} MB free.");
$usedMem = null;
$freeMem = null;
}
}
示例11: onMessage
public function onMessage($from, $channel, $msg)
{
global $config;
if ($from != '' || $channel != '') {
global $irc;
$data = $irc->processIncomingMessage(array('message' => iconv($config['encoding'], 'UTF-8', $msg), 'from' => iconv($config['encoding'], 'UTF-8', $from), 'channel' => iconv($config['encoding'], 'UTF-8', $channel)));
if ($data && $data != 1) {
sendMessage($this->socket, $channel, $from . ': ' . iconv('UTF-8', $config['encoding'], $data));
}
}
}
示例12: loginMail
function loginMail()
{
$errMsg = '';
if (!isset($_GET['email'])) {
$errMsg .= 'email';
}
if (!isset($_GET['password'])) {
if (strlen($errMsg) > 0) {
$errMsg .= ', ';
}
$errMsg .= 'password';
}
if (strlen($errMsg) > 0) {
// At least one of the fields is not set, so return an error
sendMessage(ERR, 'The following required parameters are not set: [' . $errMsg . ']');
return;
}
$email = $_GET['email'];
$password = $_GET['password'];
// Check if user exists
$db = acquireDatabase();
$loader = new User($db);
try {
$res = $loader->loadWhere('email=?', [$email]);
if (sizeof($res) > 0) {
$user = $res[0];
// Check if password is correct
$validPassword = $user->getPassword();
$password = User::encryptPassword($password);
if ($validPassword == $password) {
// Login successful -> return session id
session_start();
$_SESSION['uid'] = $user->getId();
$_SESSION['email'] = $user->getEmail();
if ($user->getState() == 'FILL_DATA') {
sendMessage(WARN, 'Login successful. Please complete your registration.');
} else {
$_SESSION['name'] = $user->getName();
sendMessage(OK, 'Login successful.');
}
} else {
sendMessage(ERR, 'Password invalid.');
}
} else {
// User doesn't exist
sendMessage(ERR, 'User invalid.');
}
} catch (DbException $e) {
sendMessage(ERR, $e->getMessage());
}
$db->close();
}
示例13: register
public function register($username = '', $nickname = '', $password = '', $repassword = '', $email = '', $verify = '', $type = 'start')
{
$type = op_t($type);
if (!C('USER_ALLOW_REGISTER')) {
$this->error('注册已关闭');
}
$verifyarr = explode(',', C('VERIFY_OPEN'));
if (in_array('1', $verifyarr)) {
$this->assign('isverify', 1);
} else {
$this->assign('isverify', 0);
}
if (IS_POST) {
//注册用户
/* 检测验证码 TODO: */
if (in_array('1', $verifyarr)) {
if (!$this->check_verify($verify)) {
$this->error('验证码输入错误!');
}
}
if ($password != $repassword) {
$this->error('两次密码输入不一致');
}
/* 调用注册接口注册用户 */
$User = new UserApi();
$uid = $User->register($username, $nickname, $password, $email);
if (0 < $uid) {
//注册成功
sendMessage($uid, 0, '注册成功', '恭喜您!您已经注册成功,请尽快<a href="' . U('Ucenter/yzmail') . '">验证邮箱地址</a>,第一时间获取网站动态!', 0);
$uid = $User->login($username, $password);
//通过账号密码取到uid
D('Member')->login($uid, false);
//登陆
asyn_sendmail($email, 2);
setuserscore($uid, C('REGSCORE'));
$this->success('注册成功并登陆!', cookie('referurl'));
} else {
//注册失败,显示错误信息
$this->error($this->showRegError($uid));
}
} else {
//显示注册表单
if (is_login()) {
redirect(cookie('referurl'));
}
if (cookie('referurl') == '') {
cookie('referurl', $_SERVER['HTTP_REFERER']);
}
$this->display();
}
}
示例14: telCode
public function telCode()
{
//手机号码
$tel = I('post.phone');
//发送验证码
$telcode = rand(100000, 999999);
$res = sendMessage($tel, $telcode);
//存入session中
if ($res) {
session('telcode', $telcode);
//将telcode返回到js
$this->ajaxReturn($telcode);
}
}
示例15: mass
/**
* 群聊
*
* @param swoole_server $server
* @param array|mixed $content 消息内容
* @param int $from_fd 发送人
* @param string $channel 频道,如果没有指定,默认为公共频道
*/
function mass($server, $content, $from_fd, $channel = 'public')
{
global $app;
foreach ($app->users->online() as $user) {
$to_fd = $user['fd'];
if ($from_fd === $to_fd) {
continue;
}
if (is_null($channel) || $user['channel'] !== $channel) {
continue;
}
sendMessage($server, 'chat', $content, $from_fd, $to_fd);
}
}