4 <meta charset
="Shift_JIS">
8 if (!isset($_COOKIE['DMDM']) && !isset($_COOKIE['MDMD'])) {
9 header('location:index.php');
13 include('encrypt.php');
15 $sub = Decrypt(addslashes(trim($_POST['zxcvbnm'])), KEY
);
16 //$sub = addslashes(trim($_POST['zxcvbnm']));
17 $msg = trim($_POST['msg']);
19 if (strlen($msg) > 250) {
20 $_SESSION['msg'] = "<div class=¥"alert alert
-danger¥長すぎるコンテンツ
</div
>";
21 header('Location:message.php?d='.$file);
24 $from = substr($sub, 0, 9);
25 $to = substr($sub, 9, 9);
26 $file = substr($sub, 18);
29 if($reply->CheckBanMessaging()) {
30 $_SESSION['msg'] = "<div
class=¥
"alert alert-success¥BEポイントが足りないので、メッセージを送信することができません。</div>";
31 header('Location:message.php?d='.$file);
34 $msg = $reply->BeSanitize($msg);
35 $reply_receiver = $reply->FindUser($to,$id_mail_path);
37 $fdir = substr($reply_receiver, 0, 1);
38 $sdir = substr($reply_receiver, 1, 1);
39 $udir = str_replace("@", "-", $reply_receiver);
40 $file_path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}/{$file}.dat";
41 //$ufile_path = MDB_PATH."{$fdir}/{$sdir}/{$udir}/u_{$file}.dat";
42 $tmp_copy_path = MDB_PATH
."{$fdir}/{$sdir}/{$udir}";
44 $sender_path = $reply->FindUser($from,$id_mail_path);
45 if ($sender_path == false) {
50 $allow_post = $reply->CheckPostLimit($from,$plimit_path,TRUE);
51 if (($allow_post >= 60) && ($allow_post != false)) {
52 $_SESSION['msg'] = "<div class=¥"alert alert
-danger¥
">到達した後の制限は、次の分お待ちください</div>";
53 header('Location:message.php?d='.$file);
56 $allow_post = $reply->CheckPostLimit($from,$plimit_hpath,FALSE);
57 if (($allow_post >= 600) && ($allow_post != false)) {
58 $_SESSION['msg'] = "<div class=¥"alert alert
-danger¥
">到達した後の制限は、次の1時間お待ちください</div>";
59 header('Location:message.php?d='.$file);
62 $fdir2 = substr($sender_path, 0, 1);
63 $sdir2 = substr($sender_path, 1, 1);
64 $udir2 = str_replace("@", "-", $sender_path);
65 $sender_file_path = MDB_PATH
."{$fdir2}/{$sdir2}/{$udir2}/{$file}.dat";
66 //$usender_file_path = MDB_PATH."{$fdir2}/{$sdir2}/{$udir2}/u_{$file}.dat";
67 date_default_timezone_set("Asia/Tokyo");
69 $writeData = "<id>{$time}</id><from>{$from}</from><subj></subj><msg>{$msg}</msg><read>0</read>¥n";
70 $writeDataSender = "<id>{$time}</id><from>{$from}</from><subj></subj><msg>{$msg}</msg><read>1</read>¥n";
72 //echo $file_path."<br>";
73 //echo $sender_file_path;
74 if (!file_exists($file_path)) {
76 if (file_exists($sender_file_path)) {
77 if (!file_exists($tmp_copy_path)) {
78 @mkdir
(MDB_PATH
."{$fdir}");
79 @mkdir
(MDB_PATH
."{$fdir}/{$sdir}");
80 @mkdir
(MDB_PATH
."{$fdir}/{$sdir}/{$udir}");
82 if (file_exists($tmp_copy_path."/ban.txt")) {
83 $banlist = file($tmp_copy_path."/ban.txt");
84 foreach ($banlist as $key => $value) {
85 if (trim($from) == trim($value)) {
86 //echo "Message sending failed, You have been blocked by the user";
87 $_SESSION['msg'] = "<div class=¥"alert alert
-danger¥
">メッセージ送信が失敗し、ユーザーによってブロックされた</div>";
88 header('Location:message.php?d='.$file);
89 // header('Location:inbox.php');
94 $aa = file($sender_file_path);
95 $aa = implode("¥n", $aa);
96 $aa = str_replace("¥n¥n", "¥n", $aa); // A pain before I found this bug!
97 file_put_contents($file_path, $aa);
98 $handle = fopen($sender_file_path, "a");
99 //if(!fwrite($handle, $writeData)) {
100 if(!fwrite($handle, $writeDataSender)) {
108 if (trim($sender_file_path) <> trim($file_path)) {
109 $handle = fopen($file_path, "a");
110 if(!fwrite($handle, $writeData)) {
117 $add_post = $reply->AddPostLimit($from,$plimit_path,TRUE);
118 $add_post = $reply->AddPostLimit($from,$plimit_hpath,FALSE);
120 # $_SESSION['msg'] = "<div class=¥"alert alert-success¥">正常に送信されたメッセージ</div>";
121 $_SESSION['msg'] = "<div class=¥"alert alert
-success¥正常に送信されたメッセージ
</div
>";
122 header('Location:message.php?d='.$file);
123 // header('Location:inbox.php');
126 if (file_exists($tmp_copy_path."/ban
.txt
")) {
127 $banlist = file($tmp_copy_path."/ban
.txt
");
128 foreach ($banlist as $key => $value) {
129 if (trim($from) == trim($value)) {
130 //echo "Message sending failed
, You have been blocked by the user
";
131 $_SESSION['msg'] = "<div
class=¥
"alert alert-danger¥">メッセージ送信が失敗し、ユーザーによってブロックされた
</div
>";
132 header('Location:message.php?d='.$file);
133 // header('Location:inbox.php');
138 //echo "--pangalawa
--";
139 $handle = fopen($sender_file_path, "a
");
140 //if(!fwrite($handle, $writeData)) {
141 if(!fwrite($handle, $writeDataSender)) {
146 if (trim($sender_file_path) <> trim($file_path)) {
147 $handle = fopen($file_path, "a
");
148 if(!fwrite($handle, $writeData)) {
155 $add_post = $reply->AddPostLimit($from,$plimit_path,TRUE);
156 $add_post = $reply->AddPostLimit($from,$plimit_hpath,FALSE);
157 # $_SESSION['msg'] = "<div
class=¥
"alert alert-success¥">正常に送信されたメッセージ
</div
>";
158 $_SESSION['msg'] = "<div
class=¥
"alert alert-success¥正常に送信されたメッセージ</div>";
159 // header('Location:inbox.php');
160 header('Location:message.php?d='.$file);