国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
3.0KB

  1. <?php
  2. /**
  3. * 会员短消息,发送到一个
  4. *
  5. * @version $Id: member_pmone.php 1 11:24 2010年7月20日Z tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__) . "/config.php");
  12. CheckPurview('member_Pm');
  13. //检查用户名的合法性
  14. function CheckUserID($uid, $msgtitle = '用户名', $ckhas = true)
  15. {
  16. global $cfg_mb_notallow, $cfg_mb_idmin, $cfg_md_idurl, $cfg_soft_lang, $dsql;
  17. if ($cfg_mb_notallow != '') {
  18. $nas = explode(',', $cfg_mb_notallow);
  19. if (in_array($uid, $nas)) {
  20. return $msgtitle . '为系统禁止的标识!';
  21. }
  22. }
  23. if ($cfg_md_idurl == 'Y' && preg_match("#[^a-z0-9]#i", $uid)) {
  24. return $msgtitle . '必须由英文字母或数字组成!';
  25. }
  26. if ($cfg_soft_lang == 'utf-8') $ck_uid = utf82gb($uid);
  27. else $ck_uid = $uid;
  28. for ($i = 0; isset($ck_uid[$i]); $i++) {
  29. if (ord($ck_uid[$i]) > 0x80) {
  30. if (isset($ck_uid[$i + 1]) && ord($ck_uid[$i + 1]) > 0x40) {
  31. $i++;
  32. } else {
  33. return $msgtitle . '可能含有乱码,建议你改用英文字母和数字组合!';
  34. }
  35. } else {
  36. if (preg_match("#[^0-9a-z@\.-]i#", $ck_uid[$i])) {
  37. return $msgtitle . '不能含有 [@]、[.]、[-]以外的特殊符号!';
  38. }
  39. }
  40. }
  41. if ($ckhas) {
  42. $row = $dsql->GetOne("SELECT * FROM `#@__member` WHERE userid LIKE '$uid' ");
  43. if (is_array($row)) return $msgtitle . "已经存在!";
  44. }
  45. return 'ok';
  46. }
  47. if (!isset($action)) $action = '';
  48. if ($action == "post") {
  49. $floginid = $cuserLogin->getUserName();
  50. $fromid = $cuserLogin->getUserID();
  51. if ($subject == '') {
  52. ShowMsg("请填写信息标题!", "-1");
  53. exit();
  54. }
  55. $msg = CheckUserID($msgtoid, "用户名", false);
  56. if ($msg != 'ok') {
  57. ShowMsg($msg, "-1");
  58. exit();
  59. }
  60. $row = $dsql->GetOne("Select * From `#@__member` where userid like '$msgtoid' ");
  61. if (!is_array($row)) {
  62. ShowMsg("你指定的用户不存在,不能发送信息!", "-1");
  63. exit();
  64. }
  65. $subject = cn_substrR(HtmlReplace($subject, 1), 60);
  66. $message = cn_substrR(HtmlReplace($message, 0), 1024);
  67. $sendtime = $writetime = time();
  68. //发给收件人(收件人可管理)
  69. $inquery = "INSERT INTO `#@__member_pms` (`floginid`,`fromid`,`toid`,`tologinid`,`folder`,`subject`,`sendtime`,`writetime`,`hasview`,`isadmin`,`message`)
  70. VALUES ('$floginid','$fromid','{$row['mid']}','{$row['userid']}','inbox','$subject','$sendtime','$writetime','0','0','$message'); ";
  71. $dsql->ExecuteNoneQuery($inquery);
  72. ShowMsg('短信已成功发送', 'member_pmone.php');
  73. exit();
  74. }
  75. require_once(DEDEADMIN . "/templets/member_pmone.htm");