-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave.php
More file actions
24 lines (23 loc) · 751 Bytes
/
Copy pathsave.php
File metadata and controls
24 lines (23 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
require_once('./db.php');
if (empty($_SESSION['login'])) {
echo "Login is needed!";
} else {
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname;charset=utf8", $username, $password, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"));
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("UPDATE ejson_content SET json=:postjson WHERE id = :id");
$stmt->bindParam(':postjson', json_decode(json_encode($_POST["json"])));
$stmt->bindParam(':id', $_POST["id"]);
// $stmt->bindParam(':postjson', $_POST["json"]);
$stmt->execute();
// $stmt->setFetchMode(PDO::FETCH_ASSOC);
echo "Saved";
}
catch(PDOException $e)
{
echo "Error: " . $e->getMessage();
}
$conn = null;
}
?>