-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage_insert.php
50 lines (42 loc) · 1.08 KB
/
message_insert.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<meta charset='utf-8'>
<?php
$send_id = $_GET["send_id"];
$rv_id = $_POST['rv_id'];
$subject = $_POST['subject'];
$content = $_POST['content'];
$subject = htmlspecialchars($subject, ENT_QUOTES);
$content = htmlspecialchars($content, ENT_QUOTES);
$regist_day = date("Y-m-d (H:i)");
if(!$send_id) {
echo("
<script>
alert('로그인 후 이용해 주세요! ');
history.go(-1)
</script>
");
exit;
}
$con = mysqli_connect("localhost", "Steve", "Vrick2956!@", "Term");
$sql = "select * from members where id='$rv_id'";
$result = mysqli_query($con, $sql);
$num_record = mysqli_num_rows($result);
if($num_record)
{
$sql = "insert into message (send_id, rv_id, subject, content, regist_day) ";
$sql .= "values('$send_id', '$rv_id', '$subject', '$content', '$regist_day')";
mysqli_query($con, $sql);
echo("
<script>
alert('수신 아이디가 잘못 되었습니다!');
history.go(-1)
</script>
");
exit;
}
mysqli_close($con);
echo "
<script>
location.href = 'message_box.php?mode=send';
</script>
";
?>