-
Notifications
You must be signed in to change notification settings - Fork 1
/
user_profile.php
155 lines (143 loc) · 5.85 KB
/
user_profile.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
<?php
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>My Profile - DigitalCovid19</title>
<meta name="description" content="My Profile - DigitalCovid19">
<meta name="keywords" content="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:url" content=" "/>
<meta property="og:type" content="website" />
<meta property="og:title" content=""/>
<meta property="og:description" content="" />
<meta property="og:image" content="img/logo.jpg" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="js/main.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-storage.js"></script>
</head>
<body>
<?php require_once 'layout/head.php'; ?>
<div class="container-fluid mt-5 pt-5 pb-5">
<div class="row pt-4">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3 pl-4 pr-4 pb-4">
<div class="shadow-sm border userbox">
<a class="fnt-green" href="user.php"><i class="fas fa-poll"></i> Dashboard</a><br>
<hr>
<a class="fnt-green" href="user_profile.php"><i class="fas fa-user"></i> Profile</a><br>
<hr>
<a class="fnt-green" href="user_symptoms.php"><i class="fas fa-heartbeat"></i> My Symptoms</a><br>
<hr>
<a class="fnt-green" href="user_transports.php"><i class="fas fa-bus-alt"></i> My Transports</a><br>
<hr>
<a class="fnt-green" href="user_events.php"><i class="fas fa-calendar-alt"></i> My Events</a><br>
<hr>
<a class="fnt-green" href="user_network.php"><i class="fas fa-users"></i> My Network</a><br>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-9 pl-2 pr-2">
<h2 class="fnt-green">My Profile Details</h2><br>
<div class="loginbox pl-4 pr-4">
<form>
<div class="form-group">
<input required readonly type="text" name="name" id="name" tabindex="1" class="form-control" placeholder="Name" value="">
</div>
<div class="form-group">
<input required readonly type="text" name="nic" id="nic" tabindex="1" class="form-control" placeholder="NIC Number" value="">
</div>
<div class="form-group">
<input required readonly type="email" name="email" id="email" tabindex="1" class="form-control" placeholder="Email Address" value="">
</div>
<div class="form-group">
<input required readonly type="text" name="mobile" id="mobile" tabindex="1" class="form-control" placeholder="Mobile" value="">
</div>
<div class="form-group text-left">
<button type="button" id="btn_editform" tabindex="4" class="btn btn-green">Edit</button>
<button type="button" name="save-submit" id="btn_saveform" tabindex="5" class="btn btn-green hidden" value="save-submit">Save Details</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container-fluid bg-light">
<div class="row pt-5 pb-5 pl-2 pr-2">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 fnt-green">
<h1><b>Download our app </b></h1>
</div>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-6 fnt-green pt-1">
<p class="text-justify">You can download android/iso app from follow links. Then register and update your information this will usefull for prevent the virus spreding in sri lanka</p>
</div>
<div class="col-xs-12 col-sm-12 col-md-2 col-lg-3">
<a href=""><img src="img/playstore.png" alt="playstore" class="img-fluid"></a>
</div>
<div class="col-xs-12 col-sm-12 col-md-2 col-lg-3">
<a href=""><img src="img/appstore.png" alt="appstore" class="img-fluid"></a>
</div>
</div>
</div>
<!-- Footer -->
<footer>
<?php require_once 'layout/footer.php'; ?>
</footer>
<script>
var heroReference=firebase.database().ref().child("users");
heroReference.on("value",function(snapshot){
snapshot.forEach(function(childsnapshot){
var person=childsnapshot.val();
if(currentUser.email==person.email){
$("#name").val(person.username);
$("#nic").val(person.nic);
$("#email").val(person.email);
$("#mobile").val(person.mobile);
}
});
});
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
var email = user.email;
currentUser=user;
} else {
window.location.href="index.php";
}
});
$("#btn_editform").click(function()
{
$("#name").removeAttr('readonly');
$("#mobile").removeAttr('readonly');
});
$("#btn_saveform").click(function()
{
var detail ={
email:$("#email").val(),
mobile:$("#mobile").val(),
nic:$("#nic").val(),
username:$("#name").val()
}
addDetail(detail);
});
function addDetail(d){
if( d.nic==""){
window.alert("User are not updated please try Again")
}else{
firebase.database().ref('users/' + d.nic).set(d);
$("#name").attr('readonly','readonly');
$("#mobile").attr('readonly','readonly');
$("#nic").attr('readonly','readonly');
$("#email").attr('readonly','readonly');
window.location.href="user_profile.php";
}
}
</script>
</body>
</html>