-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.php
executable file
·46 lines (36 loc) · 3.57 KB
/
controller.php
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
44
45
46
<?php
//print('<script>console.log("PHP Controller");</script>');
//print('PHP Controller');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
print("PHP POST");
if ($_POST["action"] && $_POST["action"] == "updateDatabase") {
// echo "this is a testcard";
$sql = 'UPDATE users SET jsonTasks = ' . $_POST["updatedDatabase"] . ' where userName = "' . $_POST["userName"] . '" and password = "' . $_POST["password"] . '";';
$dbh = new PDO($_POST["DB_CONNSTRING"], $_POST["DB_USERNAME"], $_POST["DB_PASSWORD"]);
$stmt = $dbh->prepare($sql);
$stmt->execute();
$dbh = null;
}
} else if ($_SERVER['REQUEST_METHOD'] == 'GET') {
// print("PHP GET");
if ($_GET["action"] && $_GET["action"] == "getDatabase") {
//echo "this is a testcard";
$sql = 'SELECT jsonTasks from users where userName = "' . $_GET["userName"] . '" and password = "' . $_GET["password"] . '";';
$dbh = new PDO($_GET["DB_CONNSTRING"], $_GET["DB_USERNAME"], $_GET["DB_PASSWORD"]);
$stmt = $dbh->prepare($sql);
$stmt->execute();
$rij = $stmt->fetch(PDO::FETCH_ASSOC);
$dbh = null;
if ($rij) {
// print('yes');
// print($rij['jsonTasks']);
echo $rij['jsonTasks'];
//echo '<script>console.log("PHP Controller");</script>';
//echo "123";
} else {
// print('no');
return '1111011 100010 1100011 1100001 1110100 1100101 1100111 1101111 1110010 1101001 1100101 1110011 100010 111010 1011011 1111011 100010 1101001 1100100 100010 111010 100010 1000111 1100101 1101110 1100101 1110010 1100001 1101100 100010 101100 100010 1100100 1100101 1110011 1100011 1110010 1101001 1110000 1110100 1101001 1101111 1101110 100010 111010 100010 1000111 1100101 1101110 1100101 1110010 1100001 1101100 100010 101100 100010 1100100 1101001 1110011 1110000 1101100 1100001 1111001 1000011 1101111 1101110 1110100 1100101 1101110 1110100 100010 111010 1110100 1110010 1110101 1100101 101100 100010 1110100 1101001 1101101 1100101 1000010 1101100 1101111 1100011 1101011 1110011 100010 111010 1111011 100010 1110100 1101111 1100111 1100111 1101100 1100101 100010 111010 1100110 1100001 1101100 1110011 1100101 101100 100010 1110011 1110100 1100001 1110010 1110100 1010100 1101001 1101101 1100101 100010 111010 1101110 1110101 1101100 1101100 1111101 1111101 1011101 101100 100010 1110100 1100001 1110011 1101011 1110011 1010100 1101111 1000010 1100101 1000101 1111000 1100101 1100011 1110101 1110100 1100101 1100100 100010 111010 1011011 1111011 100010 1110100 1101001 1110100 1101100 1100101 100010 111010 100010 1110000 1100001 1110011 1110100 1100101 1100100 100010 101100 100010 1110101 1101001 1100100 100010 111010 100010 1110101 1101001 1100100 110001 110110 110001 110000 110111 110010 110010 110101 110100 110010 110101 110111 110010 100010 101100 100010 1100011 1100001 1110100 1100101 1100111 1101111 1110010 1111001 100010 111010 100010 1000111 1100101 1101110 1100101 1110010 1100001 1101100 100010 101100 100010 1100011 1101000 1100101 1100011 1101011 1100101 1100100 100010 111010 1100110 1100001 1101100 1110011 1100101 1111101 1011101 101100 100010 1110100 1100001 1110011 1101011 1110011 1001000 1101001 1110011 1110100 1101111 1110010 1111001 100010 111010 1011011 1011101 101100 100010 1110100 1100001 1110011 1101011 1110011 1000100 1100101 1101100 1100101 1110100 1100101 1100100 100010 111010 1011011 1011101 1111101';
}
}
}
?>