forked from AlphaFrederic94/Hospital-project-on-AWS-cloud
-
Notifications
You must be signed in to change notification settings - Fork 1
/
func2.php
230 lines (203 loc) · 10.2 KB
/
func2.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
<?php
session_start();
// Extract the parts
$hostname = "autorack.proxy.rlwy.net:33282";
$username = "root";
$password = "iWsHxoRjIFPSbGCCZWzJUBNBvYvRSfSJ";
$database = "railway";
// Establish the connection
$con = mysqli_connect($hostname, $username, $password, $database);
// Check connection
if (!$con) {
die("Connection failed: " . mysqli_connect_error());
}
if(isset($_POST['patsub1'])){
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$gender = $_POST['gender'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];
if($password == $cpassword){
$query = "INSERT INTO patreg (fname, lname, gender, email, contact, password, cpassword) VALUES ('$fname', '$lname', '$gender', '$email', '$contact', '$password', '$cpassword')";
$result = mysqli_query($con, $query);
if($result){
$_SESSION['username'] = $fname . " " . $lname;
$_SESSION['fname'] = $fname;
$_SESSION['lname'] = $lname;
$_SESSION['gender'] = $gender;
$_SESSION['contact'] = $contact;
$_SESSION['email'] = $email;
header("Location:admin-panel.php");
}
$query1 = "SELECT * FROM patreg;";
$result1 = mysqli_query($con, $query1);
if($result1){
$row = mysqli_fetch_assoc($result1);
$_SESSION['pid'] = $row['pid'];
}
} else {
header("Location:error1.php");
}
}
if(isset($_POST['update_data'])){
$contact = $_POST['contact'];
$status = $_POST['status'];
$query = "UPDATE appointmenttb SET payment='$status' WHERE contact='$contact';";
$result = mysqli_query($con, $query);
if($result)
header("Location:updated.php");
}
if(isset($_POST['doc_sub'])){
$name = $_POST['name'];
$query = "INSERT INTO doctb (name) VALUES ('$name')";
$result = mysqli_query($con, $query);
if($result)
header("Location:adddoc.php");
}
function display_admin_panel(){
echo '<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
<a class="navbar-brand" href="#"><i class="fa fa-user-plus" aria-hidden="true"></i> Global Hospital</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="logout.php"><i class="fa fa-sign-out" aria-hidden="true"></i>Logout</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"></a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0" method="post" action="search.php">
<input class="form-control mr-sm-2" type="text" placeholder="enter contact number" aria-label="Search" name="contact">
<input type="submit" class="btn btn-outline-light my-2 my-sm-0 btn btn-outline-light" id="inputbtn" name="search_submit" value="Search">
</form>
</div>
</nav>
</head>
<style type="text/css">
button:hover{cursor:pointer;}
#inputbtn:hover{cursor:pointer;}
</style>
<body style="padding-top:50px;">
<div class="jumbotron" id="ab1"></div>
<div class="container-fluid" style="margin-top:50px;">
<div class="row">
<div class="col-md-4">
<div class="list-group" id="list-tab" role="tablist">
<a class="list-group-item list-group-item-action active" id="list-home-list" data-toggle="list" href="#list-home" role="tab" aria-controls="home">Appointment</a>
<a class="list-group-item list-group-item-action" href="patientdetails.php" role="tab" aria-controls="home">Patient List</a>
<a class="list-group-item list-group-item-action" id="list-profile-list" data-toggle="list" href="#list-profile" role="tab" aria-controls="profile">Payment Status</a>
<a class="list-group-item list-group-item-action" id="list-messages-list" data-toggle="list" href="#list-messages" role="tab" aria-controls="messages">Prescription</a>
<a class="list-group-item list-group-item-action" id="list-settings-list" data-toggle="list" href="#list-settings" role="tab" aria-controls="settings">Doctors Section</a>
<a class="list-group-item list-group-item-action" id="list-attend-list" data-toggle="list" href="#list-attend" role="tab" aria-controls="settings">Attendance</a>
</div><br>
</div>
<div class="col-md-8">
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="list-home" role="tabpanel" aria-labelledby="list-home-list">
<div class="container-fluid">
<div class="card">
<div class="card-body">
<center><h4>Create an appointment</h4></center><br>
<form class="form-group" method="post" action="appointment.php">
<div class="row">
<div class="col-md-4"><label>First Name:</label></div>
<div class="col-md-8"><input type="text" class="form-control" name="fname"></div><br><br>
<div class="col-md-4"><label>Last Name:</label></div>
<div class="col-md-8"><input type="text" class="form-control" name="lname"></div><br><br>
<div class="col-md-4"><label>Email id:</label></div>
<div class="col-md-8"><input type="text" class="form-control" name="email"></div><br><br>
<div class="col-md-4"><label>Contact Number:</label></div>
<div class="col-md-8"><input type="text" class="form-control" name="contact"></div><br><br>
<div class="col-md-4"><label>Doctor:</label></div>
<div class="col-md-8">
<select name="doctor" class="form-control" >
<!-- <option value="" disabled selected>Select Doctor</option>
<option value="Dr. Punam Shaw">Dr. Punam Shaw</option>
<option value="Dr. Ashok Goyal">Dr. Ashok Goyal</option> -->
<?php display_docs();?>
</select>
</div><br><br>
<div class="col-md-4"><label>Payment:</label></div>
<div class="col-md-8">
<select name="payment" class="form-control" >
<option value="" disabled selected>Select Payment Status</option>
<option value="Paid">Paid</option>
<option value="Pay later">Pay later</option>
</select>
</div><br><br><br>
<div class="col-md-4">
<input type="submit" name="entry_submit" value="Create new entry" class="btn btn-primary" id="inputbtn">
</div>
<div class="col-md-8"></div>
</div>
</form>
</div>
</div>
</div><br>
</div>
<div class="tab-pane fade" id="list-profile" role="tabpanel" aria-labelledby="list-profile-list">
<div class="card">
<div class="card-body">
<form class="form-group" method="post" action="func.php">
<input type="text" name="contact" class="form-control" placeholder="enter contact"><br>
<select name="status" class="form-control">
<option value="" disabled selected>Select Payment Status to update</option>
<option value="paid">paid</option>
<option value="pay later">pay later</option>
</select><br><hr>
<input type="submit" value="update" name="update_data" class="btn btn-primary">
</form>
</div>
</div><br><br>
</div>
<div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list">...</div>
<div class="tab-pane fade" id="list-settings" role="tabpanel" aria-labelledby="list-settings-list">
<form class="form-group" method="post" action="func.php">
<label>Doctors name: </label>
<input type="text" name="name" placeholder="enter doctors name" class="form-control">
<br>
<input type="submit" name="doc_sub" value="Add Doctor" class="btn btn-primary">
</form>
</div>
<div class="tab-pane fade" id="list-attend" role="tabpanel" aria-labelledby="list-attend-list">...</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<!--Sweet alert js-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.33.1/sweetalert2.all.js"></script>
<script type="text/javascript">
$(document).ready(function(){
swal({
title: "Welcome!",
text: "Have a nice day!",
imageUrl: "images/sweet.jpg",
imageWidth: 400,
imageHeight: 200,
imageAlt: "Custom image",
animation: false
})</script>
</body>
</html>';
}
?>