-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave-engine.php
More file actions
43 lines (25 loc) · 1.37 KB
/
save-engine.php
File metadata and controls
43 lines (25 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
if((isset($_COOKIE['log-id-cookie'])) && $_COOKIE['log-statue-cookie'] == 1) {
$id = $_COOKIE['log-id-cookie'];
$jGraph = $_POST['graph'];
$title = $_POST['title'];
$count = $_POST['count'];
$id = mb_convert_encoding ( $id, "UTF-8",mb_detect_encoding($id));
$jGraph = mb_convert_encoding ( $jGraph, "UTF-8",mb_detect_encoding($jGraph));
$title = mb_convert_encoding ( $title, "UTF-8",mb_detect_encoding($title));
$mysqli= new mysqli('magic.philosophy.ubc.ca', 'root', 'PhiloMagic2015!', 'whately');
// check connection
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$stmt1 = $mysqli -> prepare("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
$stmt1 -> execute();
$stmt = $mysqli -> prepare("UPDATE `graph` SET `id`=?,`graph`=? WHERE `title`=?");
$stmt -> bind_param('sss', $id, $jGraph, $title);
$stmt -> execute();
$stmt->close();
setcookie('saved-graph-cookie', $count);
echo "<script>window.location.href='http://magic.philosophy.ubc.ca/argumentMapping/graph.php';</script>";
}
?>