-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupload.php
More file actions
16 lines (16 loc) · 731 Bytes
/
upload.php
File metadata and controls
16 lines (16 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
include ('config.php');
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST["id"]) && isset($_POST["txt"])) {
$tx = $_POST["txt"];
$id = $_POST["id"];
$sql = 'SELECT text FROM sharecode WHERE id = "' . $id . '";';
$result = $conn->query($sql);
if ($tx != "" && $result->num_rows == 0)
$sql = 'INSERT INTO `sharecode`(`id`, `text`, `last_edit`) VALUES("' . $id . '","' . $tx . '","' . time() . '");';
else if ($tx == "")
$sql = 'DELETE FROM `sharecode` WHERE id ="' . $id . '";';
else
$sql = 'UPDATE sharecode SET text = "' . $tx . '", last_edit = "' . time() . '" WHERE id ="' . $id . '";';
$conn->query($sql);
}
?>