xhulio Posted November 9, 2021 Share Posted November 9, 2021 <?php include_once 'psl-config.php'; 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) === FALSE) { header("Location: ../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. } Quote Link to comment https://forums.phpfreaks.com/topic/314187-hello-everyone-i-have-a-probem-to-start-a-session-after-i-upgraded-the-domain-to-73-the-content-down-is-my-functionphp/ Share on other sites More sharing options...
ginerjm Posted November 9, 2021 Share Posted November 9, 2021 (edited) include_once 'psl-config.php'; 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) === FALSE) { header("Location: ../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. } Ok - you seem to be retrieving the pre-set cookie param from the ini file settings and re-setting them to the same values. Do I not understand what the manual is telling me? After that you set your own custom name for your session and then starting it up. I don't understand what your topic title is saying so what is the problem here? Edited November 9, 2021 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/314187-hello-everyone-i-have-a-probem-to-start-a-session-after-i-upgraded-the-domain-to-73-the-content-down-is-my-functionphp/#findComment-1591886 Share on other sites More sharing options...
xhulio Posted November 9, 2021 Author Share Posted November 9, 2021 Hello thank you very much for your response and for your time. Look the situation is like this because I don't have so much experience in PHP. It is one online quiz in one subdomain that work fine with PHP version 7.1 but when I change to PHP 7.3 the quiz.php file doesn't work it shows an error like this Could not initiate a safe session (ini_set) in Firefox ( in chrome show blank page). The other pages works fine even I log in or I can register for that quiz, but when I try to take the quiz and click there to open the page shows me an error , that I think is because of some changes in PHP 7.3 related with this part of functions.php Quote Link to comment https://forums.phpfreaks.com/topic/314187-hello-everyone-i-have-a-probem-to-start-a-session-after-i-upgraded-the-domain-to-73-the-content-down-is-my-functionphp/#findComment-1591889 Share on other sites More sharing options...
ginerjm Posted November 9, 2021 Share Posted November 9, 2021 Check the manual for the changes that 7.3 have made and see if any of them apply to your code. Why are you doing a custom session anyway if you are so new to PHP? Quote Link to comment https://forums.phpfreaks.com/topic/314187-hello-everyone-i-have-a-probem-to-start-a-session-after-i-upgraded-the-domain-to-73-the-content-down-is-my-functionphp/#findComment-1591892 Share on other sites More sharing options...
xhulio Posted November 9, 2021 Author Share Posted November 9, 2021 Intern work . Thank you very much I will check manually Quote Link to comment https://forums.phpfreaks.com/topic/314187-hello-everyone-i-have-a-probem-to-start-a-session-after-i-upgraded-the-domain-to-73-the-content-down-is-my-functionphp/#findComment-1591893 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.