国内流行的内容管理系统(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.

96 lines
3.0KB

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