Make editChatroomMessage.php work with new db method
This commit is contained in:
@@ -10,10 +10,11 @@ $username = $post['username'] ?? '';
|
||||
|
||||
if (!preg_match('/^[ a-zA-Z0-9!@#\$%\^&\*\(\)_\+\-=\[\]\{\};\':",\.<>\/\?\\\\|`~]+$/', $content)) exit;
|
||||
|
||||
$conn = newConnection();
|
||||
$conn0 = newConnection(0);
|
||||
$conn1 = newConnection(1);
|
||||
|
||||
$stmt = $conn->prepare("SELECT * FROM users WHERE token = ? AND username = ?");
|
||||
$stmt->bind_param("ss", $token, $username);
|
||||
$stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
||||
$stmt->bind_param("s", $username);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
$row = $result->fetch_assoc();
|
||||
@@ -21,11 +22,21 @@ if (!$row) exit;
|
||||
$stmt->close();
|
||||
|
||||
$user_id = $row["id"];
|
||||
|
||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
||||
$stmt2->bind_param("si", $token, $user_id);
|
||||
$stmt2->execute();
|
||||
$result2 = $stmt2->get_result();
|
||||
$row2 = $result2->fetch_assoc();
|
||||
if (!$row2) exit;
|
||||
$stmt2->close();
|
||||
|
||||
$content = base64_encode($content);
|
||||
|
||||
$stmt = $conn->prepare("UPDATE chats SET content = ? WHERE userId = ? AND id = ?");
|
||||
$stmt = $conn1->prepare("UPDATE chats SET content = ? WHERE userId = ? AND id = ?");
|
||||
$stmt->bind_param("sii", $content, $user_id, $id);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
|
||||
$conn->close();
|
||||
$conn0->close();
|
||||
$conn1->close();
|
||||
Reference in New Issue
Block a user