-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew_message.php
More file actions
48 lines (34 loc) · 1.09 KB
/
Copy pathnew_message.php
File metadata and controls
48 lines (34 loc) · 1.09 KB
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
<?php
include 'epic.php';
if(!function_exists("signed_in")) {
die("Unavailable Site");
}
global $db, $user;
$to = $_POST['to'];
$subject = $_POST['subject'];
$content = $_POST['content'];
$time = date('Y-m-d H:i:s');
$db->prepare("SELECT * FROM _user WHERE user_id = {$user->getId()}");
$db->exe_prepare();
if ($cuser = $db->get_next_result("User")) {
while($db->get_next_result("User"));
$db->prepare("SELECT * FROM _user WHERE nick = ?;");
$db->exe_prepare("s", $to);
if ($to = $db->get_next_result("User")) {
while($db->get_next_result("User"));
if ($subject == "") {
$name = "No Subject";
}
if ($content == "") {
$description = "No Text";
}
$db->prepare("INSERT INTO _pn(subject, content, sendDate, from_user, to_user) VALUES(?,?,?,?,?);");
$db->exe_prepare('sssii',$subject, $content, $time, $user->getId(), $to->getId());
header("Location: index.php?messages");
} else {
header("Location: index.php?new_message&error");
}
} else {
echo "User not exists";
}
?>