-
Notifications
You must be signed in to change notification settings - Fork 0
/
table-fina.php
129 lines (113 loc) · 3.26 KB
/
table-fina.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
include 'db-s3-sns.php';
session_start();
if($_SESSION['verify']=='false')
{
header('Location: login1.html');
exit();
}
if(isset($_POST['logout']))
{
$dat=date("Y-m-d h:i:sa");
$cur=new DateTime($dat);
$diff=$cur->diff($_SESSION['time-stamp']);
$duration=(($diff->days * 24 * 60) + ($diff->h * 60) + $diff->i);
//print_r($_SESSION['activity']);
$item = $marshaler->marshalJson('
{ "time-stamp":"'.$_SESSION['time-stamp']->format('Y-m-d H:i:sa').'",
"username": "'.$_SESSION['username'].'",
"status":"'.$_SESSION['status'].'",
"duration(mins)":"'.$duration.'",
"logout":"'.$dat.'",
"activity":"'.$_SESSION['activity'].'"
}
');
$params=[
'TableName'=>'login-users',
'Item'=>$item
];
$dynamodbclient->putItem($params);
session_destroy();
header( "Location: login1.html" );
exit();
}
elseif(isset($_POST['upload']))
{
header("Location: upload.php");
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/table.css">
</head>
<body>
<h2 style="text-align: center;">welcome mr/ms <?php echo $_SESSION['username']; ?> </h2>
<form method="post">
<input type="submit" name="logout" value="logout">
<input type="submit" name="upload" value="upload">
</form>
<table style="width:100%;border: 1px solid lightgray;">
<tr>
<th>ID</th>
<th>RGB</th>
<th>THERMAL</th>
<th>SPECTROSCOPY</th>
<th>ULTRASONIC</th>
</tr>
<?php
$params = [
'TableName' => 'CoconutParametres',
'ProjectionExpression' => '#id,rgb,thermal,spectroscopy,ultrasonic',
'ExpressionAttributeNames'=> [ '#id' => 'id' ]
];
try{
while (true) {
$result = $dynamodbclient->scan($params);
foreach ($result['Items'] as $i) {
$coconut=$marshaler->unmarshalItem($i);
echo "<tr> <td>{$coconut['id']}</td>";
echo "<td>";
$x=0;
foreach ($coconut['rgb'] as $rgb)
{ $x=$x+1;
echo "<a href=$rgb> image$x </a>";
}
echo " $x </td><td>";
$x=0;
foreach ($coconut['thermal'] as $rgb)
{$x=$x+1;
echo "<a href=$rgb> thermal$x </a>";
}
echo " $x</td><td>";
$x=0;
foreach ($coconut['spectroscopy'] as $rgb)
{$x=$x+1;
echo "<a href=$rgb> spectroscopy$x </a>";
}
echo " $x</td><td>";
$x=0;
foreach ($coconut['ultrasonic'] as $rgb)
{$x=$x+1;
echo "<a href=$rgb> ultrasonic$x </a>";
}
echo " $x</td></tr>";
flush();
ob_flush();
}
if (isset($result['LastEvaluatedKey'])) {
$params['ExclusiveStartKey'] = $result['LastEvaluatedKey'];
} else {
break;
}
}
}
catch (DynamoDbException $e) {
echo "Unable to scan:\n";
echo $e->getMessage() . "\n";
}
?>
</table>
</body>
</html>