-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAntiTheft.html
327 lines (301 loc) · 14.9 KB
/
AntiTheft.html
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Include meta tag to ensure proper rendering and touch zooming -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Include jQuery Mobile stylesheets -->
<link href="css/themes/Color.css" rel="stylesheet" />
<link href="css/themes/jquery.mobile.icons.min.css" rel="stylesheet" />
<link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css">
<!-- Include the jQuery library -->
<script src="js/jquery-1.11.3.min.js"></script>
<!-- Include the jQuery Mobile library -->
<script src="js/jquery.mobile-1.4.5.min.js"></script>
<style>
::-webkit-input-placeholder { /* WebKit, Blink, Edge */
color: #e0dada;
}
</style>
</head>
<body>
<div data-role="page" id="pageone" data-theme="c">
<div data-role="header">
<h1>Welcome to ISecure App</h1>
<div data-role="navbar">
<ul>
<li><a href="iReacedAdmin.html" rel="external" data-transition="slidefade" data-icon="search">IReached</a></li>
<li><a href="SpyEye.html" rel="external" data-transition="slidefade" data-icon="eye">SpyEye</a></li>
<li><a href="AntiTheft.html" rel="external" data-transition="slidefade" data-icon="user">AntiTheft</a></li>
<li><a href="index.html" rel="external" data-transition="slidefade" data-icon="power">Signout</a></li>
</ul>
</div>
</div>
<div data-role="main" class="ui-content">
<a href="#dialogEmergency" data-rel="popup" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-plus ui-btn-icon-left ui-btn-c" data-position-to="window"> Add Emergency Number</a>
<a href="#dialogTheft" data-rel="popup" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-plus ui-btn-icon-left ui-btn-c" data-position-to="window">Add Your SIM ID</a>
<div data-role="popup" id="dialogTheft">
<a href="#" data-role="button" data-theme="a" onclick="CloseAllTheft()" data-icon="delete" data-iconpos="notext" class="ui-btn-left">Close</a>
<div data-role="header">
<h1>Anti-Theft</h1>
</div>
<div data-role="main" class="ui-content">
<input class="required" type="text" name="txtTheftNumber" id="txtTheftNumber"
placeholder="Enter Sim No">
<a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-plus ui-btn-icon-left ui-btn-c" id="btnTheftAddNum">Add Your SIM ID</a>
<a onclick="OpenTheft()" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-bullets ui-btn-icon-left ui-btn-c" id="btnViewAllTheft">
View All
</a>
<a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-delete ui-btn-icon-left ui-btn-c" id="btnTheftDeleteAll">Delete All</a>
</div>
</div>
<div data-role="popup" id="dialogEmergency">
<a href="#" data-role="button" data-theme="a" onclick="CloseAllEmergency()" data-icon="delete" data-iconpos="notext" class="ui-btn-left">Close</a>
<div data-role="header">
<h1>Add Emergency Number</h1>
</div>
<div data-role="main" class="ui-content">
<input class="required" type="number" name="number" id="number"
placeholder="Enter Sim ID">
<a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-plus ui-btn-icon-left ui-btn-c" id="btnAddNum">Add Number</a>
<a onclick="Open()" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-bullets ui-btn-icon-left ui-btn-c" id="btnViewAll">
View All
</a>
<a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-delete ui-btn-icon-left ui-btn-c" id="btnDeleteAll">Delete All</a>
</div>
</div>
<div data-role="popup" id="dialogEmergencyAll">
<a href="#" onclick="return MainScreen();" data-role="button" data-theme="a" data-icon="back" data-iconpos="notext" class="ui-btn-left"></a>
<div data-role="header">
<h1>Show Emergency Number</h1>
</div>
<div data-role="main" class="ui-content">
<p id="showEmergency"></p>
</div>
</div>
<!-- Add Sim section -->
<div data-role="popup" id="dialogTheftAll">
<a href="#" onclick="return MainScreenTheft();" data-role="button" data-theme="a" data-icon="back" data-iconpos="notext" class="ui-btn-left"></a>
<div data-role="header">
<h1>Show SIM Number</h1>
</div>
<div data-role="main" class="ui-content">
<p id="showTheft"></p>
</div>
</div>
</div>
<div data-role="footer" data-position="fixed">
<h1>@Copyright 2019</h1>
</div>
</div>
<script>
function Open() {
$('#dialogEmergency').popup('close');
$("#dialogEmergency").bind({
popupafterclose: function (event, ui) {
$("#dialogEmergencyAll").popup("open");
}
});
}
function MainScreen() {
$('#dialogEmergencyAll').popup('close');
$("#dialogEmergencyAll").bind({
popupafterclose: function (event, ui) {
$("#dialogEmergency").popup("open");
}
});
return false;
}
function CloseAllEmergency() {
$('#dialogEmergency').unbind();
$('#dialogEmergencyAll').popup('close');
$('#dialogEmergency').popup('close');
}
function OpenTheft() {
$('#dialogTheft').popup('close');
$("#dialogTheft").bind({
popupafterclose: function (event, ui) {
$("#dialogTheftAll").popup("open");
}
});
}
function MainScreenTheft() {
$('#dialogTheftAll').popup('close');
$("#dialogTheftAll").bind({
popupafterclose: function (event, ui) {
$("#dialogTheft").popup("open");
}
});
return false;
}
function CloseAllTheft() {
$('#dialogTheft').unbind();
$('#dialogTheftAll').popup('close');
$('#dialogTheft').popup('close');
}
$(document).ready(function () {
var createStatement = "CREATE TABLE IF NOT EXISTS app_Emergency (id INTEGER PRIMARY KEY AUTOINCREMENT, EmergencyNumber TEXT)";
var insertStatement = "INSERT INTO app_Emergency (EmergencyNumber) VALUES (?)";
var deleteSatement = "Delete from app_Emergency"
var selectStatement = "Select * from app_Emergency";
var dropStatement = "DROP TABLE app_Emergency";
var createStatementTheft = "CREATE TABLE IF NOT EXISTS app_Theft (id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT, SIMID TEXT)";
var insertStatementTheft = "INSERT INTO app_Theft (Name, SIMID) VALUES (?, ?)";
var deleteSatementTheft = "Delete from app_Theft"
var selectStatementTheft = "Select * from app_Theft";
var dropStatementTheft = "DROP TABLE app_Theft";
var db = openDatabase("SecureDb", "1.0", "App I Secure", 200000); // Open SQLite Database
var dataset;
var DataType;
var success;
function dropTable() // Function Call when Drop Button Click.. Talbe will be dropped from database.
{
//db.transaction(function (tx) { tx.executeSql(dropStatement, [], null, onError); });
db.transaction(function (tx) { tx.executeSql(dropStatementTheft, [], null, onError); });
}
function initDatabase() // Function Call When Page is ready.
{
try {
if (!window.openDatabase) // Check browser is supported SQLite or not.
{
ShowMessage('Databases are not supported in this mobile.');
}
else {
// alert('db Initialized.')
createTable(); // If supported then call Function for create table in SQLite
}
}
catch (e) {
if (e == 2) {
// Version number mismatch.
ShowMessage("Invalid database version.");
} else {
ShowMessage("Unknown error " + e + ".");
}
return;
}
}
function insertRecord() {
db.transaction(function (tx) {
tx.executeSql(insertStatement, [$('#number').val()], onSuccess, onError);
});
}
initDatabase(); // call to initialize database
///////////////////////////////////////////////////////////////////
////// Emergency Section
$('#btnAddNum').click(function () {
if ($('#number').val() != "" && $('#number').val().length == 11) {
success = "Inserted Successfully."
insertRecord();
}
else {
ShowMessage("Enter valid.");
}
});
$('#btnViewAll').click(function () {
db.transaction(function (tx) {
tx.executeSql(selectStatement, [], function (tx, result) {
dataset = result.rows;
//alert(dataset.length);
var data = "";
if (dataset.length == 0) {
$('#showEmergency').html('There is no data to show.');
}
else {
for (var i = 0; i < dataset.length; i++) {
data += 'Number: ' + result.rows.item(i).EmergencyNumber + '<br /><br />';
}
$('#showEmergency').html(data);
}
});
});
});
$('#btnDeleteAll').click(function () {
success = "Record Deleted.";
db.transaction(function (tx) {
tx.executeSql(deleteSatement, [], onSuccess, onError);
});
});
///////////////////////////////////////////////////////////////////
////// Theft Section
$('#btnTheftAddNum').click(function () {
if ($('#txtTheftNumber').val() != "") {
success = "Inserted Successfully."
db.transaction(function (tx) {
tx.executeSql(selectStatementTheft, [], function (tx, result) {
dataset = result.rows;
var data = "";
if (dataset.length == 0) {
var ID = ((Math.random() * 100000000000000000) + 10000000000000000).toString();
db.transaction(function (tx) {
tx.executeSql(insertStatementTheft, [$('#txtTheftNumber').val(), ID], onSuccess, onError);
});
}
else {
var ID = result.rows.item(0).SIMID;
db.transaction(function (tx) {
tx.executeSql(insertStatementTheft, [$('#txtTheftNumber').val(), ID], onSuccess, onError);
});
}
});
});
}
else {
ShowMessage("Enter valid.");
}
});
$('#btnViewAllTheft').click(function () {
db.transaction(function (tx) {
tx.executeSql(selectStatementTheft, [], function (tx, result) {
dataset = result.rows;
var data = "";
if (dataset.length == 0) {
$('#showTheft').html('There is no data to show.');
}
else {
for (var i = 0; i < dataset.length; i++) {
data += 'ID: ' + result.rows.item(i).SIMID + '<br />';
data += 'Name: ' + result.rows.item(i).Name + '<br /><br />';
}
$('#showTheft').html(data);
}
});
});
});
$('#btnTheftDeleteAll').click(function () {
success = "Record Deleted.";
db.transaction(function (tx) {
tx.executeSql(deleteSatementTheft, [], onSuccess, onError);
});
});
///////////////////////////////////////////////////////////////////
function onError(tx, error) // Function for Hendeling Error...
{
ShowMessage("dbError: " + error.message);
}
function onSuccess(tx, error) // Function for Hendeling Success...
{
$('#txtTheftNumber').val("");
$('#number').val("");
ShowMessage(success);
}
function createTable() // Function for Create Table in SQLite.
{
db.transaction(function (tx) { tx.executeSql(createStatement, [], null, onError); });
db.transaction(function (tx) { tx.executeSql(createStatementTheft, [], null, onError); });
}
///// Message function
function ShowMessage(message) {
$.mobile.loading('show',
{
theme: "a", text: (message),
textonly: true, textVisible: true
});
setTimeout(function () {
$.mobile.loading('hide');
}, 2000);
}
});
</script>
</body>
</html>