YaWK  24.1
Yet another WebKit
message-new.php
Go to the documentation of this file.
1 <?php
2 if (!isset($_POST['token'])) {
3  die ('no direct access allowed.');
4 }
5 else if ($_POST['token'] != "U3E44ERG0H0M3") {
6  die ('no direct access allowed!');
7 }
8 
9 include '../../../classes/db.php';
10 include '../../../classes/sys.php';
11 include '../../../classes/user.php';
12 include '../../../classes/alert.php';
13 
14 /* set database object */
15 if (!isset($db)) {
16  $db = new \YAWK\db();
17 }
18 $msg_date = date("Y-m-d H:i:s");
19 $msg_to = $_POST['msg_to'];
20 $msg_body = $_POST['msg_body'];
21 $fromUID = $_POST['fromUID'];
22 
23 $toUID = \YAWK\user::getUserIdFromName($db, $msg_to);
24 
25 // remove HTML tags for security reasons
26 // $msg_body = str_replace("\n", "<br>", $msg_body);
27 // remove special chars
29 $msg_body = nl2br($msg_body);
30 $msg_body = utf8_encode($msg_body);
31 
32 $sql = "INSERT INTO {plugin_msg} (msg_date, fromUID, toUID, msg_body)
33  VALUES('$msg_date', '$fromUID', '$toUID', '$msg_body')";
34 if ($db->query($sql)){
35 
36  echo"<div id=\"msg_success\" class=\"animated lightSpeedIn\">
37  <h2><i class=\"fa fa-check\"></i> &nbsp;Nachricht erfolgreich zugestellt!</h2>
38  </div>";
39 
40 }
41 else {
42  echo \YAWK\alert::draw("danger", "Fehler!", "Es tut uns leid, die Nachricht konnte leider nicht abgeschickt werden.","",4200);
43 }
die
Definition: block-user.php:27
static encodeChars($string)
convert german special chars and vowels into legal html
Definition: sys.php:1089
$sql
Definition: message-new.php:32
if(!isset($db)) $msg_date
Definition: message-new.php:18
$msg_to
Definition: message-new.php:19
$msg_body
Definition: message-new.php:20
$toUID
Definition: message-new.php:23
$fromUID
Definition: message-new.php:21
print $tourdates date