-
Notifications
You must be signed in to change notification settings - Fork 1
/
session.php
26 lines (24 loc) · 934 Bytes
/
session.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
<?php
// Establishing Connection with Server by passing server_name, user_id, password and database as a parameter
$connection = mysqli_connect("localhost", "root", "", "ihs");
session_start();// Starting Session
// Storing Session
$SSN=$_SESSION['login_user'];
$type=$_SESSION['login_type'];
if ($type == "patient") {
// SQL Query To Fetch Complete Information Of Patient
$ses_sql=mysqli_query($connection, "SELECT SSN, name, surname FROM Patient WHERE SSN='$SSN'");
}
else if ($type == "doctor") {
// SQL Query To Fetch Complete Information Of Doctor
$ses_sql=mysqli_query($connection, "SELECT SSN, name, surname FROM Doctor WHERE SSN='$SSN'");
}
$row = mysqli_fetch_assoc($ses_sql);
$login_session=$row['SSN'];
$first_name=$row['name'];
$surname=$row['surname'];
if(!isset($login_session)){
mysqli_close($connection); // Closing Connection
header('Location: login.php'); // Redirecting To Login Page
}
?>