-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.php
More file actions
50 lines (41 loc) · 1.23 KB
/
server.php
File metadata and controls
50 lines (41 loc) · 1.23 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
44
45
46
47
48
49
50
<!DOCTYPE HTML>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php
if(isset($_POST['x'],$_POST['y'],$_POST['direction'],$_POST['time'],$_POST['condition'],$_POST['volume'],$_POST['uid'])){
$db = mysqli_connect('127.0.0.3', 'db388648_1', 'MMMIinfo', 'db388648_1');
if ($db->connect_error) {
die('Failed to connect: '.$db->connect_error);
}
$table;
//Determine into which table to write
if($_POST['condition'] == "a.") {
$table = "ConditionA";
} elseif ($_POST['condition'] == "b.") {
$table = "ConditionB";
} elseif ($_POST['condition'] == "t.") {
$table = "TestExperiments";
}
//uid, id, condition, xrot, yrot, direction, time, volume, timestamp
$query = "INSERT INTO " . $table . " VALUES (
\"" . $_POST['uid'] . "\",
NULL,
\"" . $_POST['condition'] . "\",
" . $_POST['x'] . ",
" . $_POST['y'] . ",
\"" . $_POST['direction'] . "\",
" . $_POST['time'] . ",
\"" . $_POST['volume'] . "\",
NULL
)";
$result = $db->query($query);
if (!$result) {
die('INSERT failed: '.$db->error);
}
$db->close();
}
?>
</body>
</html>