Guest User

Untitled

a guest
Mar 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.43 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include_once '../assets/conn/conn.php';
  4. // include_once 'connection/server.php';
  5. if(!isset($_SESSION['doctorSession']))
  6. {
  7. header("Location: ../index.php");
  8. }
  9. $usersession = $_SESSION['doctorSession'];
  10. $res=mysqli_query($con,"SELECT * FROM login WHERE username='".$usersession."'");
  11. $userRow=mysqli_fetch_array($res,MYSQLI_ASSOC);
  12. // insert
  13.  
  14.  
  15. if (isset($_POST['register'])) {
  16. $firstname = mysqli_real_escape_string($con,$_POST['firstname']);
  17. $lastname = mysqli_real_escape_string($con,$_POST['lastname']);
  18. $username = mysqli_real_escape_string($con,$_POST['username']);
  19. $password = mysqli_real_escape_string($con,$_POST['password']);
  20. $cnumber = mysqli_real_escape_string($con,$_POST['cnumber']);
  21. $birthdate = mysqli_real_escape_string($con,$_POST['birthdate']);
  22. $sex = mysqli_real_escape_string($con,$_POST['sex']);
  23. $usertype = mysqli_real_escape_string($con,$_POST['usertype']);
  24. $status = "Active";
  25.  
  26.  
  27. $query = " INSERT INTO login (username, password, fname, lname, cnumber, birthdate, sex, status, usertype) VALUES ('$username', '$password', '$firstname', '$lastname', '$cnumber', '$birthdate', '$sex', '$status', '$usertype' ) ";
  28. $result = mysqli_query($con, $query);
  29. // echo $result;
  30. if( $result )
  31. {
  32. ?>
  33. <script type="text/javascript">
  34. alert('Registration Completely Processed');
  35. </script>
  36. <?php
  37. }
  38. else
  39. {
  40. ?>
  41. <script type="text/javascript">
  42. alert('username already taken / number already registered');
  43. </script>
  44. <?php
  45. }
  46.  
  47. }
  48. ?>
  49. <!DOCTYPE html>
  50. <html lang="en">
  51. <head>
  52. <meta charset="utf-8">
  53. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  54. <meta name="viewport" content="width=device-width, initial-scale=1">
  55. <meta name="description" content="">
  56. <meta name="author" content="">
  57. <title>Welcome Dr <?php echo $userRow['fname'];?> <?php echo $userRow['lname'];?></title>
  58. <!-- Bootstrap Core CSS -->
  59. <!-- <link href="assets/css/bootstrap.css" rel="stylesheet"> -->
  60. <link href="assets/css/material.css" rel="stylesheet">
  61. <!-- Custom CSS -->
  62. <link href="assets/css/sb-admin.css" rel="stylesheet">
  63. <link href="assets/css/time/bootstrap-clockpicker.css" rel="stylesheet">
  64. <link href="assets/css/style.css" rel="stylesheet">
  65. <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet">
  66. <!-- Special version of Bootstrap that only affects content wrapped in .bootstrap-iso -->
  67. <link rel="stylesheet" href="https://formden.com/static/cdn/bootstrap-iso.css" />
  68.  
  69. <!--Font Awesome (added because you use icons in your prepend/append)-->
  70. <link rel="stylesheet" href="https://formden.com/static/cdn/font-awesome/4.4.0/css/font-awesome.min.css" />
  71.  
  72. <!-- Inline CSS based on choices in "Settings" tab -->
  73. <style>.bootstrap-iso .formden_header h2, .bootstrap-iso .formden_header p, .bootstrap-iso form{font-family: Arial, Helvetica, sans-serif; color: black}.bootstrap-iso form button, .bootstrap-iso form button:hover{color: white !important;} .asteriskField{color: red;}</style>
  74.  
  75. <!-- Custom Fonts -->
  76. </head>
  77. <body>
  78. <div id="wrapper">
  79.  
  80. <!-- Navigation -->
  81. <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
  82. <!-- Brand and toggle get grouped for better mobile display -->
  83. <div class="navbar-header">
  84. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
  85. <span class="sr-only">Toggle navigation</span>
  86. <span class="icon-bar"></span>
  87. <span class="icon-bar"></span>
  88. <span class="icon-bar"></span>
  89. </button>
  90. <a class="navbar-brand" href="doctordashboard.php">Welcome Dr <?php echo $userRow['fname'];?> <?php echo $userRow['lname'];?></a>
  91. </div>
  92. <!-- Top Menu Items -->
  93. <ul class="nav navbar-right top-nav">
  94.  
  95.  
  96. <li class="dropdown">
  97. <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> <?php echo $userRow['fname']; ?> <?php echo $userRow['lname']; ?><b class="caret"></b></a>
  98. <ul class="dropdown-menu">
  99. <li>
  100. <a href="doctorprofile.php"><i class="fa fa-fw fa-user"></i> Profile</a>
  101. </li>
  102.  
  103. <li class="divider"></li>
  104. <li>
  105. <a href="logout.php?logout"><i class="fa fa-fw fa-power-off"></i> Log Out</a>
  106. </li>
  107. </ul>
  108. </li>
  109. </ul>
  110. <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
  111. <div class="collapse navbar-collapse navbar-ex1-collapse">
  112. <ul class="nav navbar-nav side-nav">
  113. <li>
  114. <a href="doctordashboard.php"><i class="fa fa-fw fa-dashboard"></i> Dashboard</a>
  115. </li>
  116. <li>
  117. <a href="addschedule.php"><i class="fa fa-fw fa-table"></i> Doctor Schedule</a>
  118. </li>
  119. <li>
  120. <a href="patientlist.php"><i class="fa fa-fw fa-edit"></i> Patient List</a>
  121. </li>
  122. <li class="active">
  123. <a href="addmember.php"><i class="fa fa-fw fa-user "></i> Employee List</a>
  124.  
  125. </li>
  126. </ul>
  127. </div>
  128. <!-- /.navbar-collapse -->
  129. </nav>
  130. <!-- navigation end -->
  131.  
  132. <div id="page-wrapper">
  133. <div class="container-fluid">
  134.  
  135. <div class="row">
  136. <div class="col-lg-12">
  137. <h2 class="page-header">
  138. Employee List
  139. </h2>
  140. <ol class="breadcrumb">
  141. <li class="active">
  142. <i class="fa fa-calendar"></i> Patient List
  143. </li>
  144. </ol>
  145. </div>
  146. </div>
  147.  
  148. <!-- panel start -->
  149. <div class="panel panel-primary filterable">
  150.  
  151.  
  152. <!-- panel heading starat -->
  153. <div class="panel-heading">
  154. <h3 class="panel-title">List of Doctor(s) and Assistant(s)</h3>
  155. <div class="pull-right">
  156. </div>
  157. </div>
  158. <!-- panel heading end -->
  159.  
  160. <div class="panel-body">
  161. <!-- panel content start -->
  162. <!-- Table -->
  163. <table class="table table-hover table-bordered">
  164. <thead>
  165. <tr class="filters">
  166. <th><input type="text" class="form-control" placeholder="Id" disabled></th>
  167. <th><input type="text" class="form-control" placeholder="Password" disabled></th>
  168. <th><input type="text" class="form-control" placeholder="Full Name" disabled></th>
  169. <th><input type="text" class="form-control" placeholder="Contact Number" disabled></th>
  170. <th><input type="text" class="form-control" placeholder="Sex" disabled></th>
  171. <th><input type="text" class="form-control" placeholder="Status" disabled></th>
  172. <th><input type="text" class="form-control" placeholder="Date" disabled></th>
  173. <th><input type="text" class="form-control" placeholder="Address" disabled></th>
  174. <th><input type="text" class="form-control" placeholder="Job" disabled></th>
  175. </tr>
  176. </thead>
  177.  
  178. <?php
  179. $result=mysqli_query($con,"SELECT * FROM login WHERE usertype = 'doctor' OR usertype = 'assistant'");
  180. while ($userRow=mysqli_fetch_array($result)) {
  181. echo "<tbody>";
  182. echo "<tr>";
  183. echo "<td>" . $userRow['username'] . "</td>";
  184. echo "<td>" . $userRow['password'] . "</td>";
  185. echo "<td>" . $userRow['lname'], $userRow['fname']. "</td>";
  186. echo "<td>" . $userRow['cnumber'] . "</td>";
  187. echo "<td>" . $userRow['sex'] . "</td>";
  188. echo "<td>" . $userRow['status'] . "</td>";
  189. echo "<td>" . $userRow['birthdate'] . "</td>";
  190. echo "<td>" . $userRow['address'] . "</td>";
  191. echo "<td>" . $userRow['usertype'] . "</td>";
  192. echo "<form method='POST'>";
  193. ?>
  194. <!--<td width="100">
  195. <a rel="tooltip" title="Edit" id="e<?php echo $userRow['username']; ?>" href="#edit<?php echo $userRow['username']; ?>" data-toggle="modal" class="btn btn-success"><i class="icon-pencil icon-large"></i></a>-->
  196. <?php include('edit_user.php'); ?>
  197. </td>
  198. <td> <a href="#edit<?php echo $userRow['username'];?>" data-toggle="modal" class="btn btn-warning"><span class="glyphicon glyphicon-edit"></span>Edit</a><?php include('edit_user.php');?></td>
  199.  
  200. <?php
  201. //echo "<td class='text-center'><input type='checkbox' name='enable' id='enable' value='".$userRow['username']."' onclick='check(".$userRow['username'].",this.checked);' ".$checked."></td>";
  202.  
  203. }
  204. echo "</tr>";
  205. echo "</tbody>";
  206. echo "</table>";
  207. echo "<div class='panel panel-default'>";
  208. echo "<div class='col-md-offset-3 pull-right'>";
  209. echo "<button class='btn btn-primary'><a href='#' data-toggle='modal' data-target='#myModal' style='color:white!important;'>ADD MEMBER</a></button>";
  210. echo "</div>";
  211. echo "</div>";
  212. ?>
  213. <!-- panel content end -->
  214. <!-- panel end -->
  215. </div>
  216. </div>
  217. <!-- panel start -->
  218. </div>
  219. </div>
  220. <!-- /#wrapper -->
  221.  
  222. <!-- modal container start -->
  223. <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  224. <div class="modal-dialog" role="document">
  225. <div class="modal-content">
  226. <!-- modal content -->
  227. <div class="modal-header">
  228. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  229. <h3 class="modal-title">Registration Form</h3>
  230. </div>
  231. <!-- modal body start -->
  232. <div class="modal-body">
  233.  
  234. <!-- form start -->
  235. <div class="container" id="wrap">
  236. <div class="row">
  237. <div class="col-md-6">
  238.  
  239. <form action="<?php $_PHP_SELF ?>" method="POST" accept-charset="utf-8" class="form" role="form">
  240.  
  241. <div class="row">
  242. <div class="col-xs-6 col-md-6">
  243. <input type="text" name="firstname" value="" class="form-control input-lg" placeholder="First Name" required />
  244. </div>
  245. <div class="col-xs-6 col-md-6">
  246. <input type="text" name="lastname" value="" class="form-control input-lg" placeholder="Last Name" required />
  247. </div>
  248. </div>
  249.  
  250. <input type="number" name="cnumber" value="" class="form-control input-lg" placeholder="Contact Number" />
  251. <input type="text" name="username" value="" class="form-control input-lg" placeholder="Username" required />
  252. <input type="password" name="password" value="" class="form-control input-lg" placeholder="Password" required />
  253. <input type="password" name="confirm_password" value="" class="form-control input-lg" placeholder="Confirm Password" required/>
  254.  
  255. <div class="row">
  256. <div class="col-xs-6 col-md-6">
  257. <label>Birthdate</label>
  258. <br>
  259. <input type="date" name="birthdate" required />
  260. </div>
  261. <div class="col-xs-6 col-md-6">
  262. <label>Gender: </label>
  263. <br>
  264. <label class="radio-inline">
  265. <input type="radio" name="sex" value="male" required/>Male
  266. </label>
  267. <label class="radio-inline" >
  268. <input type="radio" name="sex" value="female" required/>Female
  269. </label>
  270. </div>
  271. </div>
  272. <div class="row"><br>
  273. <div class="col-xs-6 col-md-6">
  274. <label>Job: </label>
  275. <br>
  276. <label class="radio-inline">
  277. <input type="radio" name="usertype" value="doctor" required/>Doctor
  278. </label>
  279. <label class="radio-inline" >
  280. <input type="radio" name="usertype" value="assistant" required/>Assistant
  281. </label>
  282. </div>
  283. </div>
  284. <br />
  285. <button class="btn btn-lg btn-primary btn-block signup-btn" type="submit" name="register" id="register">ADD MEMBER</button>
  286. </form>
  287.  
  288. </div>
  289. </div>
  290. </div>
  291. </div>
  292. </div>
  293. </div>
  294. </div>
  295. <!-- modal end -->
  296. <!-- modal container end -->
  297.  
  298.  
  299.  
  300.  
  301. <!-- jQuery -->
  302. <script src="../customer/assets/js/jquery.js"></script>
  303. <script src="../customer/assets/js/jquery.min.js"></script>
  304. <!-- Bootstrap Core JavaScript -->
  305. <script src="../patient/assets/js/bootstrap.min.js"></script>
  306. <script src="assets/js/bootstrap-clockpicker.js"></script>
  307. <!-- Latest compiled and minified JavaScript -->
  308. <!-- script for jquery datatable start-->
  309. <!-- Include Date Range Picker -->
  310. </body>
  311. </html>
  312.  
  313. <div class="modal fade" id="edit<?php echo $userRow['username'];?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  314. <div class="modal-dialog">
  315. <div class="modal-content">
  316. <div class="modal-header">
  317. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  318. <center><h4 class="modal-title" id="myModalLabel"> Edit Member </h4></center>
  319. </div>
  320. <div class="modal-body">
  321. <?php
  322. $edit = mysqli_query($con, "SELECT * FROM login WHERE username = '" .$userRow['username']."'");
  323. $eRow = mysqli_fetch_array($edit);
  324. ?>
  325. <div class = "container-fluid">
  326. <form class="form-horizontal" method = "POST"">
  327. <div class="controls">
  328. <input type="hidden" id="inputEmail" name="id" value="<?php echo $row['username']; ?>" required>
  329. <input type="text" required name="username" value="<?php echo $userRow['username']; ?>" required>
  330. </div>
  331.  
  332. <div class = "row">
  333. <div class = "col-xs-6 col-md-6">
  334. <label style = "position:relative; top:7px;">First Name</label>
  335. <input type = "text" name = "firstname" class = "form-control" value = "<?php echo $eRow['fname']?>"></input>
  336. </div>
  337. <div class = "col-xs-6 col-md-6">
  338. <label style = "position:relative; top:7px;">Last Name</label>
  339. <input type = "text" name = "lastname" class = "form-control" value = "<?php echo $eRow['lname']?>"></input>
  340. </div>
  341. <div class = "col-xs-6 col-md-12">
  342. <label style = "position:relative; top:7px;">Address</label>
  343. <input type = "text" name = "address" class = "form-control" value = "<?php echo $eRow['address']?>"></input>
  344. </div>
  345. </div>
  346. <div class = "row">
  347. <div class = "col-xs-6 col-md-6">
  348. <label style = "position:relative; top:7px;">Contact Number</label>
  349. <input type = "text" name = "cnumber" class = "form-control" value = "<?php echo $eRow['cnumber']?>"></input>
  350. </div>
  351. <div class = "col-xs-6 col-md-6">
  352. <label style = "position:relative; top:7px;">Status</label><br>
  353. <select name="status" style = "margin-top:12px;" required>
  354. <option>Active</option>
  355. <option>Inactive</option>
  356. </select>
  357. </div>
  358. </div>
  359. </div>
  360. </div>
  361. <div class = "modal-footer">
  362. <button type = "button" class = "btn btn-default" data-dismiss="modal"><span class = "glyphicon glyphicon-remove"></span>&nbsp;Cancel</button>
  363. <button type="submit" name = "edit" class="btn btn-success"><i class="icon-save icon-large"></i>&nbsp;Save</button>
  364. </div>
  365. </form>
  366. </div>
  367. </div>
  368. </div>
  369. </div>
  370. </div>
  371.  
  372.  
  373. <?php
  374. if (isset($_POST['edit']))
  375. {
  376.  
  377. $firstname = $_POST['firstname'];
  378. $lastname = $_POST['lastname'];
  379. $address = $_POST['address'];
  380. $cnumber = $_POST['cnumber'];
  381. $status = $_POST['status'];
  382.  
  383. if ( $cnumber == $rows1['cnumber'])
  384. {
  385.  
  386. ?>
  387. <script type="text/javascript">
  388. alert('Number already registered');
  389. </script>
  390.  
  391. <?php
  392. }
  393. else
  394. {
  395. $res = mysqli_query($con, "UPDATE login SET fname = '$firstname', lname = '$lastname', address = '$address', cnumber = '$cnumber', status = '$status' WHERE username = '" .$userRow['username']. "'");
  396.  
  397. ?>
  398. <script>
  399. alert("Update Complete");
  400. window.location="addmember.php";
  401. </script>
Add Comment
Please, Sign In to add comment