summaryrefslogtreecommitdiff
path: root/includes/model/Message_model.php
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-12-28 13:44:56 +0100
committerPhilip Häusler <msquare@notrademark.de>2014-12-28 13:44:56 +0100
commit6bede2fd229395f34c321a37efa2ea93e7b1a7ba (patch)
treea20c74d5bdddae9e1ec9a988e1ba468371a4a995 /includes/model/Message_model.php
parenta6ab81b834fe91b0f0704a7db33e377c8dc63a23 (diff)
harden the sql queries
Diffstat (limited to 'includes/model/Message_model.php')
-rw-r--r--includes/model/Message_model.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/includes/model/Message_model.php b/includes/model/Message_model.php
index 1e1923e8..7bae0dd4 100644
--- a/includes/model/Message_model.php
+++ b/includes/model/Message_model.php
@@ -14,7 +14,7 @@ function Message_ids() {
* ID
*/
function Message($id) {
- $message_source = sql_select("SELECT * FROM `Messages` WHERE `id`=" . sql_escape($id) . " LIMIT 1");
+ $message_source = sql_select("SELECT * FROM `Messages` WHERE `id`='" . sql_escape($id) . "' LIMIT 1");
if ($message_source === false)
return false;
if (count($message_source) > 0)
@@ -38,8 +38,8 @@ function Message_send($id, $text) {
$text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($text));
$to = preg_replace("/([^0-9]{1,})/ui", '', strip_tags($id));
- if (($text != "" && is_numeric($to)) && (sql_num_query("SELECT * FROM `User` WHERE `UID`=" . sql_escape($to) . " AND NOT `UID`=" . sql_escape($user['UID']) . " LIMIT 1") > 0)) {
- sql_query("INSERT INTO `Messages` SET `Datum`=" . sql_escape(time()) . ", `SUID`=" . sql_escape($user['UID']) . ", `RUID`=" . sql_escape($to) . ", `Text`='" . sql_escape($text) . "'");
+ if (($text != "" && is_numeric($to)) && (sql_num_query("SELECT * FROM `User` WHERE `UID`='" . sql_escape($to) . "' AND NOT `UID`='" . sql_escape($user['UID']) . "' LIMIT 1") > 0)) {
+ sql_query("INSERT INTO `Messages` SET `Datum`='" . sql_escape(time()) . "', `SUID`='" . sql_escape($user['UID']) . "', `RUID`='" . sql_escape($to) . "', `Text`='" . sql_escape($text) . "'");
return true;
} else {
return false;