I'm working on my security coding. The login.php page starts with:
Opening the page throws these errors:
The functions.php page code pertaining to the lines quoted above:
I'm thinking that most of my issue here has to do with the $secure=SECURE; I've also tried $secure=true; and that gives me an internal server error saying 500.shtml is not found. Any ideas? I'm stuck.
Thanks!
Code:
<?php
ini_set('display_errors','On');
error_reporting(E_ALL);
include_once 'php/db_connect.php';
include_once 'php/functions.php';
sec_session_start();
if (login_check($mysqli) == true) {
$logged = 'in';
} else {
$logged = 'out';
}
?>
Opening the page throws these errors:
Notice: Use of undefined constant SECURE - assumed 'SECURE' in /home/mediqw5/public_html/php/functions.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at /home/mediqw5/public_html/php/functions.php:7) in /home/mediqw5/public_html/php/functions.php on line 14
The functions.php page code pertaining to the lines quoted above:
Code:
function sec_session_start() {
$session_name = 'sec_session_id'; // Set a custom session name
$secure = SECURE;
// This stops JavaScript being able to access the session id.
$httponly = true;
// Forces sessions to only use cookies.
if (!ini_set('session.use_only_cookies', 1)) {
header("php/error.php?err=Could not initiate a safe session (ini_set)");
exit();
}
// Gets current cookies params.
$cookieParams = session_get_cookie_params();
session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httponly);
// Sets the session name to the one set above.
session_name($session_name);
session_start(); // Start the PHP session
session_regenerate_id(); // regenerated the session, delete the old one.
}
I'm thinking that most of my issue here has to do with the $secure=SECURE; I've also tried $secure=true; and that gives me an internal server error saying 500.shtml is not found. Any ideas? I'm stuck.
Thanks!