-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsubmit.php
221 lines (174 loc) · 5.2 KB
/
submit.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
<?php
ini_set('session.cache_limiter','public');
session_cache_limiter(false);
session_start();
// If the session vars aren't set, try to set them with a cookie
if (!isset($_SESSION['usermain'])) {
if (isset($_COOKIE['usermain'])) {
$_SESSION['usermain'] = $_COOKIE['usermain'];
}
}
if((!isset($_SESSION['usermain'])) && (!isset($_COOKIE['usermain'])))
{
$home_url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/login-main.php';
header('Location: ' . $home_url);
}
if (isset($_SESSION['usermain'])) {
}
$id = $_GET['id'];
$dbc = mysqli_connect('localhost','root','','healthcare')
or
die('error connecting to MySql server');
$query = "SELECT * FROM patient_file WHERE p_id='$id'";
$result = mysqli_query($dbc,$query)
or
die('Error querying to mysql server');
while ($row = mysqli_fetch_array($result)) {
if (isset($_POST['submit'])) {
$sreport = $_FILES['sreport']['name'];
$sreport_type = $_FILES['sreport']['type'];
$sreport_size = $_FILES['sreport']['size'];
$comment=$_POST['comment'];
$dname=$_POST['usr'];
$ddept=$_POST['dr'];
if (!empty($sreport)) {
if ($_FILES['sreport']['error'] == 0) {
// Move the file to the target upload folder
$target = 'mfiles/' . $sreport;
if (move_uploaded_file($_FILES['sreport']['tmp_name'], $target)) {
// Connect to the database
// Write the data to the database
$query1 = "UPDATE patient_file SET sreport='$sreport',status='Active',comment='$comment',d_name='$dname',ddept='$ddept',timestamp=NOW() WHERE p_id='$id' ";
mysqli_query($dbc, $query1);
// Confirm success with the user
echo "Information is shared with the primary hospital";
// Clear the score data to clear the form
$sreport = "";
}
else {
echo '<p class="error">Sorry, there was a problem uploading your screen shot image.</p>';
}
}
}
// Try to delete the temporary screen shot image file
@unlink($_FILES['sreport']['tmp_name']);
}
else {
}
?>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="w3.css">
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.backstretch.min.js"></script>
</head>
<style>
body {
background-color: #CCCCCC;
font-family: 'Montserrat', sans-serif;
}
.w3-container
{background-color:rgba(255, 255, 255, 0.49);}
.sessioncolor{
color: #009688;
font-weight: bolder;
padding: 2%;
margin:2%;
}
.text{
margin:2%;
padding:2%;
}
.w3-container {
padding: 0px;
background-color:rgba(255, 255, 255, 0.76);
padding: 1px;
}
a.pull-right {
padding: 2%;
}
button#submit{
padding: 2%;
margin:3%;
}
label{
padding: 2%;
margin:2%;
}
</style>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Page 1</a></li>
<li><a href="#">Page 2</a></li>
<li><?php echo ' <a href="logout.php">Log Out</a><span class="sessioncolor">(' . $_SESSION['usermain'] . ')</span><br/>';
?></li>
</ul>
</div>
</div>
</nav>
<form role=" form" enctype="multipart/form-data" method="post" action="">
<div class="col-md-offset-3 col-md-6 w3-container">
<header class="w3-container w3-teal">
<h3 class="text-center ">Patient Details</h3>
</header>
<table class="w3-table w3-bordered w3-striped">
<thead>
<tr>
<th>Patient Name</th>
<th>Patient Id</th>
<th> View Patient Report</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $row['p_name'];?></td>
<td><?php echo $row['ph_name'];?></td>
<td><?php echo '<a href="' . 'files/' . $row['p_file'] . '" target="_blank" />view file</a>';?> </td>
</tr>
</tr>
</tbody>
</table>
<div class="w3-row-padding w3-margin-top">
<div class=" col-md-12 col-xs-12 col-sm-12 w3-full">
<h4>Advice Patient:</h4> <center><textarea name="comment" rows="5" ></textarea></center>
</div>
<div class=" col-md-12 col-xs-12 col-sm-12 w3-full">
<div class="form-group">
<label for="usr"><h4>Doctor's Name:</h4></label>
<input type="text" class="form-control" id="usr" name="usr">
</div>
<div class="form-group">
<label for="dr"><h4>Doctor's Department:</h4></label>
<input type="text" class="form-control" id="dr" name="dr">
</div>
</div>
</div>
<footer class="w3-container w3-teal w3-margin-top">
<label for="sreport">UPLOAD:<input type="file" name="sreport" id="sreport"></label>
<button class="pull-right btn btn-sucess" name="submit" id="submit">Submit</button>
</footer>
<?php
}
mysqli_close($dbc);
?>
</div>
</form>
<script>
$.backstretch([
"HOSPITALHEART_1stblue.jpg",
"HOSPITALHEART1_midblue.jpg",
"HOSPITALHEART1_lastblue.jpg"
], {
fade: 1050,
duration: 500
});
</script>
</body>
</html>