-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdb.php
More file actions
28 lines (25 loc) · 774 Bytes
/
db.php
File metadata and controls
28 lines (25 loc) · 774 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
<?php
// Only modify session settings if the session isn't started yet
if (session_status() === PHP_SESSION_NONE) {
$lifetime = 30 * 24 * 60 * 60; // 30 days
ini_set('session.gc_maxlifetime', $lifetime);
session_set_cookie_params([
'lifetime' => $lifetime,
'path' => '/',
'secure' => false, // true if using HTTPS
'httponly' => true,
'samesite' => 'Lax'
]);
session_start();
}
// Database connection
$host = "localhost";
$user = "root"; // change if needed
$pass = ""; // set your MySQL root password here
$db = "lab_automation";
$conn = mysqli_connect($host, $user, $pass, $db);
// Check connection
if (!$conn) {
die("Database connection failed: " . mysqli_connect_error());
}
?>