-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
153 lines (119 loc) · 5.4 KB
/
index.php
File metadata and controls
153 lines (119 loc) · 5.4 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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
include_once("config.php");
// If Client ID is provided, save it in session and try to authenticate
$fb_client_id = '';
if (isset($_POST['client_id']) && trim($_POST['client_id']) != "") {
// Register Client ID in the Session
$fb_client_id = safe(trim($_POST['client_id']));
$_SESSION['fb_client_id'] = $fb_client_id;
// Redirect to Fitbit for OAuth2
header("Location: $config_oauth_url?response_type=token&scope=$config_scope&redirect_url=$config_redirect_uri&expires_in=$config_expires_sec&client_id=$fb_client_id");
exit;
}
if (isset($_SESSION['fb_client_id'])) {
$fb_client_id = $_SESSION['fb_client_id'];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Fitbit Heart Rate Intraday Data</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Bootstrap Script -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<!-- header -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="./"><strong>Fitbit Heart Rate Intraday Data</strong></a>
</div>
</div>
</nav> <!-- /header -->
<div style='height:100px;'>
</div>
<div class="container">
<div class="row">
<div class="col-md-3 bg-info">
<form action="index.php" method="post">
<div class="form-group">
<label for="exampleInputEmail1">Fitbit Client ID</label>
<input type="text" class="form-control" name="client_id" id="client_id" placeholder="Enter Fitbit Client ID" value="<?php echo $fb_client_id; ?>">
</div>
<button type="submit" class="btn btn-primary">Connect with Fitbit</button>
</form>
<div>
<P> </P>
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
<a href='https://youtu.be/_H5fFtsrfeU' target=_blank><strong>How to get Client ID?</strong></a>
</div>
<hr>
<div class="well">
<h4><span class="label label-default">Configuration Used</span></h4>
<dl>
<dt>Scope</dt>
<dd><?php echo $config_scope; ?><BR><BR></dd>
<dt>Redirect URL</dt>
<dd><?php echo $config_redirect_uri; ?><BR><BR></dd>
<dt>Expires in</dt>
<dd><?php echo $config_expires_sec; ?> Seconds</dd>
</dl>
</div> <!-- /well -->
</div> <!-- /col-md-3 client id form -->
<div class="col-md-9 ">
<h4>About Fitbit Intraday Heart Rate Service</h4>
Through the Fitbit App, you can view heartrate information only in 5-minute intervals. However, your tracker is capturing your heartrate every few seconds.
<P>
The service available on this website allows you to connect to the Fitbit website and get your Intraday Heart Rate Data. You can:
<ul>
<li> Get detailed heartrate data from Fitbit Website
<li> View the data on a chart and export it to an image
<li> Export the data in Excel format
</ul>
<P>More information on why this service was created is available at
<ul>
<li> <a href="https://exain.wordpress.com/2017/07/26/fitbit-intraday-heartbeat-tracking-with-code">https://exain.wordpress.com/2017/07/26/fitbit-intraday-heartbeat-tracking-with-code</a>
</ul>
</P>
<P>
The code is open source and you can setup a service for yourself on your server. Download it from GitHub at
<ul>
<li> <a href="https://github.com/technotablet/fitbit">https://github.com/technotablet/fitbit</a>
</ul>
</p>
<hr>
<h4>Privacy Information</h4>
<p>
The heartrate information is sensitive and not something you would want to disclose to anyone. Fitbit also prevents third party developers from accessing the heartrate data. By using this service, you
<ul>
<li> Setup a special developer account at Fitbit and generate your own credentials.
<li> Do not provide any identifiable information except a 'Client ID', which cannot be linked to your account, and you can also delete it from the Fitbit Website.
<li> Authenticate only through your Fitbit credentials.
<li> Save the heartrate data along with your Client ID on this website, also to enable historical data review.
<li> Have an option to setup your own service on your server without sharing data with anyone.
</ul>
</P>
</div> <!-- /col-md-9 about -->
</div> <!-- /row -->
<hr>
© 2017 Vivek Kapoor, <a href='https://exain.wordpress.com'>https://exain.wordpress.com</a>
</div> <!-- /container -->
<script>
$("#client_id").focus();
</script>
</body>
</html>