Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include_once '../assets/conn/conn.php';
- // include_once 'connection/server.php';
- if(!isset($_SESSION['doctorSession']))
- {
- header("Location: ../index.php");
- }
- $usersession = $_SESSION['doctorSession'];
- $res=mysqli_query($con,"SELECT * FROM login WHERE username='".$usersession."'");
- $userRow=mysqli_fetch_array($res,MYSQLI_ASSOC);
- // insert
- if (isset($_POST['register'])) {
- $firstname = mysqli_real_escape_string($con,$_POST['firstname']);
- $lastname = mysqli_real_escape_string($con,$_POST['lastname']);
- $username = mysqli_real_escape_string($con,$_POST['username']);
- $password = mysqli_real_escape_string($con,$_POST['password']);
- $cnumber = mysqli_real_escape_string($con,$_POST['cnumber']);
- $birthdate = mysqli_real_escape_string($con,$_POST['birthdate']);
- $sex = mysqli_real_escape_string($con,$_POST['sex']);
- $usertype = mysqli_real_escape_string($con,$_POST['usertype']);
- $status = "Active";
- $query = " INSERT INTO login (username, password, fname, lname, cnumber, birthdate, sex, status, usertype) VALUES ('$username', '$password', '$firstname', '$lastname', '$cnumber', '$birthdate', '$sex', '$status', '$usertype' ) ";
- $result = mysqli_query($con, $query);
- // echo $result;
- if( $result )
- {
- ?>
- <script type="text/javascript">
- alert('Registration Completely Processed');
- </script>
- <?php
- }
- else
- {
- ?>
- <script type="text/javascript">
- alert('username already taken / number already registered');
- </script>
- <?php
- }
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="description" content="">
- <meta name="author" content="">
- <title>Welcome Dr <?php echo $userRow['fname'];?> <?php echo $userRow['lname'];?></title>
- <!-- Bootstrap Core CSS -->
- <!-- <link href="assets/css/bootstrap.css" rel="stylesheet"> -->
- <link href="assets/css/material.css" rel="stylesheet">
- <!-- Custom CSS -->
- <link href="assets/css/sb-admin.css" rel="stylesheet">
- <link href="assets/css/time/bootstrap-clockpicker.css" rel="stylesheet">
- <link href="assets/css/style.css" rel="stylesheet">
- <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet">
- <!-- Special version of Bootstrap that only affects content wrapped in .bootstrap-iso -->
- <link rel="stylesheet" href="https://formden.com/static/cdn/bootstrap-iso.css" />
- <!--Font Awesome (added because you use icons in your prepend/append)-->
- <link rel="stylesheet" href="https://formden.com/static/cdn/font-awesome/4.4.0/css/font-awesome.min.css" />
- <!-- Inline CSS based on choices in "Settings" tab -->
- <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>
- <!-- Custom Fonts -->
- </head>
- <body>
- <div id="wrapper">
- <!-- Navigation -->
- <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
- <!-- Brand and toggle get grouped for better mobile display -->
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand" href="doctordashboard.php">Welcome Dr <?php echo $userRow['fname'];?> <?php echo $userRow['lname'];?></a>
- </div>
- <!-- Top Menu Items -->
- <ul class="nav navbar-right top-nav">
- <li class="dropdown">
- <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>
- <ul class="dropdown-menu">
- <li>
- <a href="doctorprofile.php"><i class="fa fa-fw fa-user"></i> Profile</a>
- </li>
- <li class="divider"></li>
- <li>
- <a href="logout.php?logout"><i class="fa fa-fw fa-power-off"></i> Log Out</a>
- </li>
- </ul>
- </li>
- </ul>
- <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
- <div class="collapse navbar-collapse navbar-ex1-collapse">
- <ul class="nav navbar-nav side-nav">
- <li>
- <a href="doctordashboard.php"><i class="fa fa-fw fa-dashboard"></i> Dashboard</a>
- </li>
- <li>
- <a href="addschedule.php"><i class="fa fa-fw fa-table"></i> Doctor Schedule</a>
- </li>
- <li>
- <a href="patientlist.php"><i class="fa fa-fw fa-edit"></i> Patient List</a>
- </li>
- <li class="active">
- <a href="addmember.php"><i class="fa fa-fw fa-user "></i> Employee List</a>
- </li>
- </ul>
- </div>
- <!-- /.navbar-collapse -->
- </nav>
- <!-- navigation end -->
- <div id="page-wrapper">
- <div class="container-fluid">
- <div class="row">
- <div class="col-lg-12">
- <h2 class="page-header">
- Employee List
- </h2>
- <ol class="breadcrumb">
- <li class="active">
- <i class="fa fa-calendar"></i> Patient List
- </li>
- </ol>
- </div>
- </div>
- <!-- panel start -->
- <div class="panel panel-primary filterable">
- <!-- panel heading starat -->
- <div class="panel-heading">
- <h3 class="panel-title">List of Doctor(s) and Assistant(s)</h3>
- <div class="pull-right">
- </div>
- </div>
- <!-- panel heading end -->
- <div class="panel-body">
- <!-- panel content start -->
- <!-- Table -->
- <table class="table table-hover table-bordered">
- <thead>
- <tr class="filters">
- <th><input type="text" class="form-control" placeholder="Id" disabled></th>
- <th><input type="text" class="form-control" placeholder="Password" disabled></th>
- <th><input type="text" class="form-control" placeholder="Full Name" disabled></th>
- <th><input type="text" class="form-control" placeholder="Contact Number" disabled></th>
- <th><input type="text" class="form-control" placeholder="Sex" disabled></th>
- <th><input type="text" class="form-control" placeholder="Status" disabled></th>
- <th><input type="text" class="form-control" placeholder="Date" disabled></th>
- <th><input type="text" class="form-control" placeholder="Address" disabled></th>
- <th><input type="text" class="form-control" placeholder="Job" disabled></th>
- </tr>
- </thead>
- <?php
- $result=mysqli_query($con,"SELECT * FROM login WHERE usertype = 'doctor' OR usertype = 'assistant'");
- while ($userRow=mysqli_fetch_array($result)) {
- echo "<tbody>";
- echo "<tr>";
- echo "<td>" . $userRow['username'] . "</td>";
- echo "<td>" . $userRow['password'] . "</td>";
- echo "<td>" . $userRow['lname'], $userRow['fname']. "</td>";
- echo "<td>" . $userRow['cnumber'] . "</td>";
- echo "<td>" . $userRow['sex'] . "</td>";
- echo "<td>" . $userRow['status'] . "</td>";
- echo "<td>" . $userRow['birthdate'] . "</td>";
- echo "<td>" . $userRow['address'] . "</td>";
- echo "<td>" . $userRow['usertype'] . "</td>";
- echo "<form method='POST'>";
- ?>
- <!--<td width="100">
- <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>-->
- <?php include('edit_user.php'); ?>
- </td>
- <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>
- <?php
- //echo "<td class='text-center'><input type='checkbox' name='enable' id='enable' value='".$userRow['username']."' onclick='check(".$userRow['username'].",this.checked);' ".$checked."></td>";
- }
- echo "</tr>";
- echo "</tbody>";
- echo "</table>";
- echo "<div class='panel panel-default'>";
- echo "<div class='col-md-offset-3 pull-right'>";
- echo "<button class='btn btn-primary'><a href='#' data-toggle='modal' data-target='#myModal' style='color:white!important;'>ADD MEMBER</a></button>";
- echo "</div>";
- echo "</div>";
- ?>
- <!-- panel content end -->
- <!-- panel end -->
- </div>
- </div>
- <!-- panel start -->
- </div>
- </div>
- <!-- /#wrapper -->
- <!-- modal container start -->
- <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <!-- modal content -->
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- <h3 class="modal-title">Registration Form</h3>
- </div>
- <!-- modal body start -->
- <div class="modal-body">
- <!-- form start -->
- <div class="container" id="wrap">
- <div class="row">
- <div class="col-md-6">
- <form action="<?php $_PHP_SELF ?>" method="POST" accept-charset="utf-8" class="form" role="form">
- <div class="row">
- <div class="col-xs-6 col-md-6">
- <input type="text" name="firstname" value="" class="form-control input-lg" placeholder="First Name" required />
- </div>
- <div class="col-xs-6 col-md-6">
- <input type="text" name="lastname" value="" class="form-control input-lg" placeholder="Last Name" required />
- </div>
- </div>
- <input type="number" name="cnumber" value="" class="form-control input-lg" placeholder="Contact Number" />
- <input type="text" name="username" value="" class="form-control input-lg" placeholder="Username" required />
- <input type="password" name="password" value="" class="form-control input-lg" placeholder="Password" required />
- <input type="password" name="confirm_password" value="" class="form-control input-lg" placeholder="Confirm Password" required/>
- <div class="row">
- <div class="col-xs-6 col-md-6">
- <label>Birthdate</label>
- <br>
- <input type="date" name="birthdate" required />
- </div>
- <div class="col-xs-6 col-md-6">
- <label>Gender: </label>
- <br>
- <label class="radio-inline">
- <input type="radio" name="sex" value="male" required/>Male
- </label>
- <label class="radio-inline" >
- <input type="radio" name="sex" value="female" required/>Female
- </label>
- </div>
- </div>
- <div class="row"><br>
- <div class="col-xs-6 col-md-6">
- <label>Job: </label>
- <br>
- <label class="radio-inline">
- <input type="radio" name="usertype" value="doctor" required/>Doctor
- </label>
- <label class="radio-inline" >
- <input type="radio" name="usertype" value="assistant" required/>Assistant
- </label>
- </div>
- </div>
- <br />
- <button class="btn btn-lg btn-primary btn-block signup-btn" type="submit" name="register" id="register">ADD MEMBER</button>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- modal end -->
- <!-- modal container end -->
- <!-- jQuery -->
- <script src="../customer/assets/js/jquery.js"></script>
- <script src="../customer/assets/js/jquery.min.js"></script>
- <!-- Bootstrap Core JavaScript -->
- <script src="../patient/assets/js/bootstrap.min.js"></script>
- <script src="assets/js/bootstrap-clockpicker.js"></script>
- <!-- Latest compiled and minified JavaScript -->
- <!-- script for jquery datatable start-->
- <!-- Include Date Range Picker -->
- </body>
- </html>
- <div class="modal fade" id="edit<?php echo $userRow['username'];?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <center><h4 class="modal-title" id="myModalLabel"> Edit Member </h4></center>
- </div>
- <div class="modal-body">
- <?php
- $edit = mysqli_query($con, "SELECT * FROM login WHERE username = '" .$userRow['username']."'");
- $eRow = mysqli_fetch_array($edit);
- ?>
- <div class = "container-fluid">
- <form class="form-horizontal" method = "POST"">
- <div class="controls">
- <input type="hidden" id="inputEmail" name="id" value="<?php echo $row['username']; ?>" required>
- <input type="text" required name="username" value="<?php echo $userRow['username']; ?>" required>
- </div>
- <div class = "row">
- <div class = "col-xs-6 col-md-6">
- <label style = "position:relative; top:7px;">First Name</label>
- <input type = "text" name = "firstname" class = "form-control" value = "<?php echo $eRow['fname']?>"></input>
- </div>
- <div class = "col-xs-6 col-md-6">
- <label style = "position:relative; top:7px;">Last Name</label>
- <input type = "text" name = "lastname" class = "form-control" value = "<?php echo $eRow['lname']?>"></input>
- </div>
- <div class = "col-xs-6 col-md-12">
- <label style = "position:relative; top:7px;">Address</label>
- <input type = "text" name = "address" class = "form-control" value = "<?php echo $eRow['address']?>"></input>
- </div>
- </div>
- <div class = "row">
- <div class = "col-xs-6 col-md-6">
- <label style = "position:relative; top:7px;">Contact Number</label>
- <input type = "text" name = "cnumber" class = "form-control" value = "<?php echo $eRow['cnumber']?>"></input>
- </div>
- <div class = "col-xs-6 col-md-6">
- <label style = "position:relative; top:7px;">Status</label><br>
- <select name="status" style = "margin-top:12px;" required>
- <option>Active</option>
- <option>Inactive</option>
- </select>
- </div>
- </div>
- </div>
- </div>
- <div class = "modal-footer">
- <button type = "button" class = "btn btn-default" data-dismiss="modal"><span class = "glyphicon glyphicon-remove"></span> Cancel</button>
- <button type="submit" name = "edit" class="btn btn-success"><i class="icon-save icon-large"></i> Save</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- <?php
- if (isset($_POST['edit']))
- {
- $firstname = $_POST['firstname'];
- $lastname = $_POST['lastname'];
- $address = $_POST['address'];
- $cnumber = $_POST['cnumber'];
- $status = $_POST['status'];
- if ( $cnumber == $rows1['cnumber'])
- {
- ?>
- <script type="text/javascript">
- alert('Number already registered');
- </script>
- <?php
- }
- else
- {
- $res = mysqli_query($con, "UPDATE login SET fname = '$firstname', lname = '$lastname', address = '$address', cnumber = '$cnumber', status = '$status' WHERE username = '" .$userRow['username']. "'");
- ?>
- <script>
- alert("Update Complete");
- window.location="addmember.php";
- </script>
Add Comment
Please, Sign In to add comment