-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsession.php
41 lines (34 loc) · 1002 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
$servername = "travolla.hm";
$username = "travolla";
$passworddb = "SeaBoat909";
$dbname = "travolla_main";
// Lea's local DB connection
/* $servername = "localhost";
$username = "travolla_main";
$passworddb = "travolla_main";
$dbname = "travolla_main"; */
//Create connection to the database;
$mysqli = new MySQLi($servername, $username, $passworddb, $dbname);
// Check connection
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
//echo "Connected successfully";
if (!isset($_SESSION)) {
session_start();
}
if(isset($_SESSION['loggedin'])){
$user_check = $_SESSION['user'];
$session_sql = $mysqli->prepare("SELECT name FROM users WHERE name = ?");
$session_sql->bind_param("s", $user_check);
$session_sql->execute();
$session_sql->bind_result($users);
$session_sql->fetch();
$login_session = $users;
$session_sql ->close();
}
if(!isset($login_session)){
mysqli_close($mysqli);
}
?>