doctor can now be stored in the database, renamed a file to show its purpose
This commit is contained in:
+2
-2
@@ -53,8 +53,8 @@
|
|||||||
|
|
||||||
<div id="licenseDiv">
|
<div id="licenseDiv">
|
||||||
<br>
|
<br>
|
||||||
<label for="licno">License Number:</label>
|
<label for="licensenum">License Number:</label>
|
||||||
<input class="form-control" type="number" id="licno" name="licno" placeholder="Ex. 123456789 " inputmode="numeric">
|
<input class="form-control" type="number" id="licensenum" name="licensenum" placeholder="Ex. 123456789 " inputmode="numeric">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
+2
-2
@@ -88,7 +88,7 @@ if (!isset($_SESSION["isAdmin"])) {
|
|||||||
include 'admintables.php';
|
include 'admintables.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script src="assets/vendors/js/vendor.bundle.base.js"></script>
|
<!-- <script src="assets/vendors/js/vendor.bundle.base.js"></script>
|
||||||
<script src="assets/vendors/jquery-bar-rating/jquery.barrating.min.js"></script>
|
<script src="assets/vendors/jquery-bar-rating/jquery.barrating.min.js"></script>
|
||||||
<script src="assets/vendors/chart.js/Chart.min.js"></script>
|
<script src="assets/vendors/chart.js/Chart.min.js"></script>
|
||||||
<script src="assets/vendors/flot/jquery.flot.js"></script>
|
<script src="assets/vendors/flot/jquery.flot.js"></script>
|
||||||
@@ -103,7 +103,7 @@ if (!isset($_SESSION["isAdmin"])) {
|
|||||||
<script src="assets/js/settings.js"></script>
|
<script src="assets/js/settings.js"></script>
|
||||||
<script src="assets/js/todolist.js"></script>
|
<script src="assets/js/todolist.js"></script>
|
||||||
<script src="assets/js/dashboard.js"></script>
|
<script src="assets/js/dashboard.js"></script>
|
||||||
<script src="assets\js\a.js"></script>
|
<script src="assets\js\a.js"></script> -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
function togglePasswordVisibility(inputId, iconId) {
|
// edit this js file, separate the functions inside
|
||||||
|
|
||||||
|
function togglePasswordVisibility(inputId, iconId) {
|
||||||
var passwordField = document.getElementById(inputId);
|
var passwordField = document.getElementById(inputId);
|
||||||
var eyeIcon = document.getElementById(iconId);
|
var eyeIcon = document.getElementById(iconId);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>Login</title>
|
<title>Login</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
@@ -13,11 +12,11 @@
|
|||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
||||||
|
|
||||||
<link rel="stylesheet" href="/loginassets/css/style.css">
|
<link rel="stylesheet" href="/loginassets/css/style.css">
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<!-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> -->
|
||||||
<script src="loginassets\js\1.js"></script>
|
<script src="/loginassets/js/login.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="img js-fullheight" style="background-image: url(loginassets/images/bg.jpg);">
|
<body class="img">
|
||||||
<section class="ftco-section">
|
<section class="ftco-section">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
|||||||
@@ -8190,7 +8190,9 @@ h1, h2, h3, h4, h5,
|
|||||||
.img {
|
.img {
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center center; }
|
background-position: center center;
|
||||||
|
background-image: url(/loginassets/images/bg.jpg);
|
||||||
|
}
|
||||||
|
|
||||||
.login-wrap {
|
.login-wrap {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
+64
-12
@@ -7,30 +7,36 @@ if (!isset($_SESSION['isAdmin'])) {
|
|||||||
header('Location: login.php');
|
header('Location: login.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST["btnSaveUser"])) {
|
if (isset($_POST["btnSaveUser"]))
|
||||||
|
{
|
||||||
$pw1 = $_POST['userPass'];
|
$pw1 = $_POST['userPass'];
|
||||||
$pw2 = $_POST['confirmUserPass'];
|
$pw2 = $_POST['confirmUserPass'];
|
||||||
|
|
||||||
if ($pw1 == $pw2) {
|
if ($pw1 == $pw2)
|
||||||
|
{
|
||||||
$fname = $_POST['fname'];
|
$fname = $_POST['fname'];
|
||||||
$mname = $_POST['mname'];
|
$mname = $_POST['mname'];
|
||||||
$lname = $_POST['lname'];
|
$lname = $_POST['lname'];
|
||||||
$address = $_POST['address'];
|
$address = $_POST['address'];
|
||||||
$phonenum = $_POST['phonenum'];
|
$phonenum = $_POST['phonenum'];
|
||||||
$userpos = $_POST['UserPos'];
|
$userpos = $_POST['UserPos'];
|
||||||
|
$licensenum = $_POST['licensenum'];
|
||||||
|
$specialization = $_POST['specialization'];
|
||||||
$username = $_POST['username'];
|
$username = $_POST['username'];
|
||||||
$password = $_POST['userPass'];
|
$password = $_POST['userPass'];
|
||||||
|
|
||||||
// Hash the password
|
// Hash the password
|
||||||
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
|
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
if ($userpos == 'isSec') {
|
if ($userpos == 'isSec')
|
||||||
|
{
|
||||||
// Insert data into tblsec
|
// Insert data into tblsec
|
||||||
$sql = "INSERT INTO tblsec (fname, mname, lname, phonenum, address)
|
$sql = "INSERT INTO tblsec (fname, mname, lname, phonenum, address)
|
||||||
VALUES ('$fname', '$mname', '$lname', '$phonenum', '$address')";
|
VALUES ('$fname', '$mname', '$lname', '$phonenum', '$address')";
|
||||||
$result = mysqli_query($conn, $sql);
|
$result = mysqli_query($conn, $sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result)
|
||||||
|
{
|
||||||
// Get the userid of the last inserted row in tblsec
|
// Get the userid of the last inserted row in tblsec
|
||||||
$secIDFK = mysqli_insert_id($conn);
|
$secIDFK = mysqli_insert_id($conn);
|
||||||
|
|
||||||
@@ -38,24 +44,70 @@ if (isset($_POST["btnSaveUser"])) {
|
|||||||
$sql2 = "INSERT INTO tbluserroles (isSec, secIDFK) VALUES (1, $secIDFK)";
|
$sql2 = "INSERT INTO tbluserroles (isSec, secIDFK) VALUES (1, $secIDFK)";
|
||||||
$result2 = mysqli_query($conn, $sql2);
|
$result2 = mysqli_query($conn, $sql2);
|
||||||
|
|
||||||
if ($result2) {
|
if ($result2)
|
||||||
|
{
|
||||||
$tbluserroleroleid = mysqli_insert_id($conn);
|
$tbluserroleroleid = mysqli_insert_id($conn);
|
||||||
// Insert user authentication data into tbluserauth with hashed password
|
// Insert user authentication data into tbluserauth with hashed password
|
||||||
$sql1 = "INSERT INTO tbluserauth (username, password, tbluserroles_roleid)
|
$sql3 = "INSERT INTO tbluserauth (username, password, tbluserroles_roleid)
|
||||||
VALUES ('$username', '$hashedPassword', $tbluserroleroleid)";
|
VALUES ('$username', '$hashedPassword', $tbluserroleroleid)";
|
||||||
$result1 = mysqli_query($conn, $sql1);
|
$result3 = mysqli_query($conn, $sql3);
|
||||||
|
|
||||||
if ($result1) {
|
if ($result3)
|
||||||
|
{
|
||||||
header("Location: adminindex.php?msg=New record created successfully");
|
header("Location: adminindex.php?msg=New record created successfully");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
echo "Failed to insert user authentication data: " . mysqli_error($conn);
|
echo "Failed to insert user authentication data: " . mysqli_error($conn);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
echo "Failed to insert user role data: " . mysqli_error($conn);
|
echo "Failed to insert user role data: " . mysqli_error($conn);
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
echo "Failed to insert secretary data: " . mysqli_error($conn);
|
echo "Failed to insert secretary data: " . mysqli_error($conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ($userpos == 'isDoc')
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO tbldoctor (fname, mname, lname, specialization, licensenum, phonenum, address)
|
||||||
|
VALUES ('$fname', '$mname', '$lname', '$specialization', '$licensenum', '$phonenum', '$address')";
|
||||||
|
|
||||||
|
$result = mysqli_query($conn, $sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$doctorIDFK = mysqli_insert_id($conn);
|
||||||
|
$sql2 = "INSERT INTO tbluserroles (isDoc, doctorIDFK) VALUES (1, $doctorIDFK)";
|
||||||
|
$result2 = mysqli_query($conn, $sql2);
|
||||||
|
if ($result2)
|
||||||
|
{
|
||||||
|
$tbluserroleroleid = mysqli_insert_id($conn);
|
||||||
|
// Insert user authentication data into tbluserauth with hashed password
|
||||||
|
$sql3 = "INSERT INTO tbluserauth (username, password, tbluserroles_roleid)
|
||||||
|
VALUES ('$username', '$hashedPassword', $tbluserroleroleid)";
|
||||||
|
$result3 = mysqli_query($conn, $sql3);
|
||||||
|
|
||||||
|
if ($result3)
|
||||||
|
{
|
||||||
|
header("Location: adminindex.php?msg=New record created successfully");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "Failed to insert user authentication data: " . mysqli_error($conn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "Failed to insert user role data: " . mysqli_error($conn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "Failed to insert doctor data: " . mysqli_error($conn);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user