if (empty($UserID)) {
array_push($errors,"UserID is required");
code...
}
if (empty($Password)) {
array_push($errors,"Password is required");
# code...
}
if (count ($errors)== 0) {
$Password=md5($Password);
$query="SELECT * FROM patients WHERE UserID=('$UserID')AND Password=('$Password')";
$result=mysqli_query($mysqli,$query);
if (mysqli_num_rows($result) ==1 ) {
$_SESSION['UserID']=$UserID;
$_SESSION['success']="you are now logged in";
header('location:../presentaionlayer/patient/index.php');
} else{
array_push($errors,"The ID/Password not correct");
if (empty($DoctorID2)) {
array_push($errors,"Doctor ID is required");
code...
}
if (empty($DoctorPassword2)) {
array_push($errors,"Password is required");
# code...
}
if (count ($errors)== 0) {
$queryD="SELECT * FROM doctor WHERE DoctorID=('$DoctorID2')AND password=('$DoctorPassword2')";
$resultD=mysqli_query($mysqli,$queryD);
if (mysqli_num_rows($resultD) ==1 ) {
$_SESSION['DoctorID']=$DoctorID2;
$_SESSION['success']="you are now logged in";
header('location:../presentaionlayer/doctor/index2.php');
} else{
array_push($errors,"The ID/Password not correct");
}
}
}
$doctorprofile=isset($_SESSION['DoctorID']);
$querydoctor="SELECT * FROM doctor WHERE DoctorID=('$doctorprofile')";
$resultdoctor= mysqli_query($mysqli, $querydoctor);
$colD= mysqli_fetch_assoc($resultdoctor);
if (empty($adminID)) {
array_push($errors,"Admin ID is required");
code...
}
if (empty($adminpassword)) {
array_push($errors,"Password is required");
# code...
}
if (count ($errors)== 0) {
$queryA="SELECT * FROM admin WHERE AdminID=('$adminID')AND adminpassword=('$adminpassword')";
$resultA=mysqli_query($mysqli,$queryA);
if (mysqli_num_rows($resultA) ==1 ) {
$_SESSION['AdminID']=$adminID;
$_SESSION['success']="you are now logged in";
header('location:../presentaionlayer/admin/index3.php');
} else{
array_push($errors,"The ID/Password not correct");
}
}
}
if (isset($_POST['sendfeedback'])) {
$feedback2 = $mysqli -> real_escape_string($_POST['feedx']);
$sqlfeed = "INSERT INTO feedback (pID,feedback) VALUES ('$userprofile','$feedback2') ";
<?php include('../datalayer/server.php') ?>
<!DOCTYPE html>
Patient Login
<?php
session_start(); $errors=array();
$mysqli = new mysqli("localhost","root","","registration");
if ($mysqli -> connect_errno) { echo "Failed to connect to MySQL: " . $mysqli -> connect_error; exit(); }
if (isset($_POST['Register'])) {
}
if (empty($Username)) { array_push($errors,"UserName is required");
code...
}
if (empty($Address)) { array_push($errors,"Address is required");
code...
}
if (empty($ContactNumber)) { array_push($errors,"Contact Number is required");
code...
}
if (empty($Email)) { array_push($errors,"Email is required");
code...
}
if (empty($Password)) { array_push($errors,"Password is required");
code...
}
if (empty($bloodtype)) { array_push($errors,"Bloodtype is required");
code...
}
if(count($errors)==0){
printf("%d Row inserted.\n", $mysqli->affected_rows);
} if(move_uploaded_file($_FILES['']))
$_SESSION['UserID']=$UserID; $_SESSION['success']="you are now logged in"; header('location:../presentaionlayer/patient/index.php');
}
}
if (isset($_POST['Login'])) {
if (empty($UserID)) { array_push($errors,"UserID is required");
code...
} if (empty($Password)) { array_push($errors,"Password is required");
header('location:../presentaionlayer/patient/index.php'); } else{ array_push($errors,"The ID/Password not correct");
} }
if (isset($_GET['logout'])) {
$query="SELECT * FROM patients WHERE UserID=('$userprofile')"; $result= mysqli_query($mysqli, $query); $col= mysqli_fetch_assoc($result);
if (isset($_POST['Login2'])) {
if (empty($DoctorID2)) { array_push($errors,"Doctor ID is required");
code...
} if (empty($DoctorPassword2)) { array_push($errors,"Password is required");
} else{ array_push($errors,"The ID/Password not correct");
} }
$doctorprofile=isset($_SESSION['DoctorID']); $querydoctor="SELECT * FROM doctor WHERE DoctorID=('$doctorprofile')"; $resultdoctor= mysqli_query($mysqli, $querydoctor); $colD= mysqli_fetch_assoc($resultdoctor);
if (isset($_GET['logout'])) {
if (isset($_POST['treatmentHistory'])) { header('../presentaionlayer/patient/myinfo.php'); ?>
<?php
if (isset($_POST['Login3'])) {
if (empty($adminID)) { array_push($errors,"Admin ID is required");
code...
} if (empty($adminpassword)) { array_push($errors,"Password is required");
} else{ array_push($errors,"The ID/Password not correct");
} }
if (isset($_POST['sendfeedback'])) { $feedback2 = $mysqli -> real_escape_string($_POST['feedx']);
$sqlfeed = "INSERT INTO feedback (pID,feedback) VALUES ('$userprofile','$feedback2') ";
printf("%d Row inserted.\n", $mysqli->affected_rows);
}
}
$mysqli -> close();
?>