-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetinfo.php
executable file
·87 lines (74 loc) · 2.24 KB
/
getinfo.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
<?php
include('mysql.php');
$sql="SELECT Number, Divedate, Divetime, Depth, City, Place, Buddy, Watertemp, Comments, Profile, ProfileInt FROM DL_Logbook WHERE Number=$_GET[id]";
$result=mysql_query($sql);
$data=mysql_fetch_array($result);
$date = new DateTime($data[Divedate]);
$p_date = $date->format("jS M Y");
echo "<h1>#$data[Number] - $data[Place], $data[City]</h1>";
echo "<p><b>Date :</b> $p_date <b>Depth :</b> $data[Depth] meters <b>Divetime :</b> $data[Divetime] minutes</p>";
//start echo buddies
echo "<p><b>Buddy :</b> ";
$i=0;
while ($i<strlen($data[Buddy])){
if ($data[Buddy][$i]==','){
echo "<a href=\"?buddy=$Buddy\" target=\"_self\" class=\"buddy\">$Buddy</a>, ";
$i=$i+2; $Buddy="";
}
$Buddy=$Buddy.$data[Buddy][$i];
$i++;
}
echo "<a href=\"?buddy=$Buddy\" target=\"_self\" class=\"buddy\">$Buddy</a>";
echo " ";
//end echo buddies
if ($data[Watertemp]!=NULL)
echo "<b>Water Temperature :</b> $data[Watertemp] °C";
echo "</p>";
if ($data[Profile]!="") {
$profileData_str = str_split($data[Profile],6); //profile data as array of strings
$incr = $data[ProfileInt]/60; //time interval between depth readings
echo "<p><b>Profile :</b></p>";
echo "<div id=\"profile\"></div>\n";
echo "<script type=\"text/javascript\">\n";
echo "var d1 = [];\n";
$time=0;$depth=0;
echo "d1.push([$time, $depth]);\n";
$time+=$incr;
foreach ($profileData_str as $i => $str) { //loop through array of strings
if (($i%2)==0) {
$depth = -(floatval($str)/1000);
echo "d1.push([$time, $depth]);\n";
$time+=$incr;
} else {
//discard odd i values
}
}
//$maxD = (intval($data[Depth]/5)+1)*5;
$maxD = intval($data[Depth])+1;
echo "$.jqplot('profile', [d1], {
series:[{showMarker:false}],
axesDefaults:{
tickOptions:{
textColor: '#FFFFFF'
}
},
axes:{
xaxis:{
min:0,
max:$data[Divetime]
},
yaxis:{
max:0,
min:-$maxD
}
},
grid:{
background: '#616D7E',
gridLineColor: '#95B9C7'
}
});";
echo "</script>\n";
}
if ($data[Comments]!="")
echo "<p><b>Comments :</b> $data[Comments]</p>";
?>