-
Notifications
You must be signed in to change notification settings - Fork 1
/
visitor.php
296 lines (257 loc) · 9.6 KB
/
visitor.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
NOT USED
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>New Visitor</title>
<style>
body{font-family:Sans-Serif;}
canvas{position:absolute; left: -9999em;}
#button{background-color: Yellow; color: Red; padding: 3px 10px; cursor:pointer; display: inline-block; border-radius: 5px;}
#mandatory{background-color: Green; color: Red; padding: 3px 10px; cursor:pointer; display: inline-block; border-radius: 5px;}
#preview{margin: 20px 0;}
label{display: block;}
</style>
<link rel="stylesheet" type="text/css" href="css/view.css" media="all">
<link rel="stylesheet" href="css/zdnet.css">
<link rel="stylesheet" href="css/parsley.css">
<!--
<link rel="stylesheet" href="js/parsley.js">
-->
<link rel="stylesheet" href="js/parsley.min.js">
<script type="text/javascript" src="js/view.js"></script>
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.4.js"></script>
<script type="text/javascript" src="js/block.js"></script>
</head>
<body id="main_body" >
<img id="top" src="images/top.png" alt="">
<?php
require_once("common.php");
display_menu();
?>
<div id="form_container">
<h1><a>New Visitor</a></h1>
<!--
<form id="new_visitor" name="new_visitor" class="appnitro" method="post" action="new_visitor.php" data-parsley-validate>
-->
<form id="new_visitor" name="new_visitor" class="appnitro" method="post" action="visitor_action.php">
<div class="form_description">
<h2>New Visitor Form</h2>
<p>Please enter details carefully. Visitors are tracked by their name and contact number</p>
<p><a href="find.php">Returning Visitors, click here</a></p>
</div>
<ul >
<!--- take pic -->
<div id="main">
<video id="video"></video>
<h1>Instructions</h1>
</div>
<div>
<li id="li_1" >
<a id="button">Smile and click here to take a picture :-)</a>
</li>
<!-- target for the canvas-->
<div id="canvasHolder" width="160" height="120"></div>
<!--preview image captured from canvas-->
<img id="preview" src="images/placeholder-hi.png" width="160" height="120" />
<!--
<form method="post" action="new_visitor.php">
-->
<input id="picinfo_hidden" type="hidden" name="picinfo_hidden" type="text" value="" />
<!--
<input id="picinfo" name= "picinfo" class="element text small" type="text" maxlength="255" value=""/>
<input id="submit" class="button_text" type="submit" name="submit" value="Submit" />
<label>base64 image:</label>
-->
<!--
<input id="imageToForm" type="text" />
-->
<!--
</form>
-->
</div>
<script>
var video;
var dataURL;
//http://coderthoughts.blogspot.co.uk/2013/03/html5-video-fun.html - thanks :)
function setup() {
navigator.myGetMedia = (navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
navigator.myGetMedia({ video: true }, connect, error);
}
function connect(stream) {
video = document.getElementById("video");
video.src = window.URL ? window.URL.createObjectURL(stream) : stream;
video.play();
}
function error(e) { console.log(e); }
addEventListener("load", setup);
function captureImage() {
var canvas = document.createElement('canvas');
canvas.id = 'hiddenCanvas';
//add canvas to the body element
document.body.appendChild(canvas);
//add canvas to #canvasHolder
document.getElementById('canvasHolder').appendChild(canvas);
var ctx = canvas.getContext('2d');
canvas.width = video.videoWidth / 2;
canvas.height = video.videoHeight / 2;
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
//save canvas image as data url
dataURL = canvas.toDataURL();
//set preview image src to dataURL
document.getElementById('preview').src = dataURL;
// place the image value in the text box
//document.getElementById('imageToForm').value = dataURL;
//document.getElementById('picinfo').value = dataURL;
document.getElementById('picinfo_hidden').value = dataURL;
}
//Bind a click to a button to capture an image from the video stream
var el = document.getElementById("button");
el.addEventListener("click", captureImage, false);
</script>
<!--- stop take pic -->
<div>
<li id="li_2" >
<label class="description" for="element_1">Name *</label>
<input id="name" name= "name" class="element text medium" type="text" maxlength="32" value="" placeholder="(Full Name Please)" required autofocus="autofocus"/>
</li>
</div>
<!--
<div>
<li id="li_3" >
<label class="description" for="element_91">Gender</label>
<select class="element select smaller" id="gender" name="gender">
<option value="0" selected="selected" >Male</option>
<option value="1" >Female</option>
</select>
</li>
</div>
-->
<!--
<div>
<li id="li_4" >
<label class="description" for="element_44">Age</label>
<input id="age" name="age" class="element text small" type="text" maxlength="3" value=""/>
</li>
</div>
-->
<div>
<li id="li_5" >
<label class="description" for="element_2">Total Number of Visitors *</label>
<input id="num_visitors" name="num_visitors" class="element text small" type="text" maxlength="3" value="1" placeholder="Enter total number of visitors"/>
</li>
</div>
<div>
<li id="li_6" >
<label class="description" for="element_10">Phone Number *</label>
<!--
<input id="phone_num" name="phone_num" class="element text small" type="text" value="" placeholder="9886110220" data-parsley-type="digits" required/>
-->
<input id="phone_num" name="phone_num" class="element text small" type="text" value="" placeholder="9886110220" data-parsley-type="digits" required data-required="true" data-rangelength="[10,11]
data-trigger="keyup" title="code consist of 10 numeric characters for cell OR 11 numeric characters for landline with std code."><br>
</li>
</div>
<div>
<li id="li_7" >
<label class="description" for="element_4">Vehicle Registration Number </label>
<input id="vehicle_reg_num" name="vehicle_reg_num" class="element text small" type="text" maxlength="255" value="" placeholder="KA01ME1234"/>
</li>
</div>
<div>
<li id="li_8" >
<label class="description" for="element_9">Block *</label>
<select class="element select small" id="block" name="block" required>
<!--
<option value="" selected="selected"></option>
-->
<?php
require_once("common_lib.php");
$display_dummy_option = true;
display_block_options("block.ini", $display_dummy_option);
?>
</select>
</li>
</div>
<div>
<li id="li_81" >
<label class="description" id="label_block_other" style='display:none'>Specify where exactly:</label>
<input type="text" name="block_other" id="block_other" style='display:none'/>
</li>
</div>
<div>
<li id="li_9" >
<label class="description" for="element_8">Flat Number:</label>
<span id='flat_span'>
<select name="flat_num" style='display:block'>
<option value="0">All</option>
</select>
</span>
</li>
</div>
<div>
<li id="li_10" >
<label class="description" for="element_6">To Meet *</label>
<input id="to_meet" name="vto_meet" class="element text medium" type="text" maxlength="32" value="" placeholder= "Barrack Obama" required/>
</li>
</div>
<div>
<li id="li_11" >
<label class="description" for="element_7">Purpose </label>
<!--
<input id="purpose" name="purpose" class="element text medium" type="text" maxlength="128" value="" placeholder="(optional)"/>
-->
<select class="element select small" id="purpose" name="purpose" required>
<!--
<option value="" selected="selected"></option>
-->
<?php
require_once("common_lib.php");
$display_dummy_option = true;
display_purpose_options("purpose.ini", $display_dummy_option);
?>
</select>
</li>
</div>
<div>
<li id="li_12" >
<label class="description" for="element_19">From Address/Area </label>
<input id="address" name="address" class="element text medium" type="text" maxlength="255" value="" placeholder="(optional)"/>
</li>
</div>
<!--
<div>
<li id="li_13" >
<label class="description" for="element_8">Comments </label>
<textarea id="comments" name="comments" class="element textarea small"></textarea>
</li>
</div>
<div>
<li id="li_14" >
<label class="description" for="element_8">Vehicle Description</label>
<textarea id="comments" name="comments" class="element textarea small"></textarea>
<input id="vehicle_desc" name="vehicle_desc" class="element text medium" type="text" maxlength="255" value=""/>
</li>
</div>
-->
<div>
<li id="li_15" >
<li class="buttons">
<input type="hidden" name="form_id" value="826681" />
<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
<button type="reset" value="Reset">Reset</button>
</li>
</ul>
</form>
<div id="footer">
Generated by <a href="http://www.phpform.org">pForm</a>
</div>
</div>
<img id="bottom" src="images/bottom.png" alt="">
</body>
</html>