-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession.php
More file actions
34 lines (28 loc) · 874 Bytes
/
session.php
File metadata and controls
34 lines (28 loc) · 874 Bytes
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
27
28
29
30
31
32
33
34
<?php
session_start();// Starting Session
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$servername = "localhost";
$username = "id3529688_root";
$password = "root1234";
$dbname = "id3529688_proj_users";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Storing Session
$user_check=$_SESSION['login_user'];
// SQL Query To Fetch Complete Information Of User
$ses_sql="select * from user_login where uname='$user_check'";
$result = $conn->query($ses_sql);
//$row = $result->fetch_assoc();
while($row = $result->fetch_assoc())
{
$login_session =$row['fname'];
}
if(!isset($login_session)){
$conn->close();
header('Location: index.php'); // Redirecting To Home Page
}
?>