after hours and hours of research I leave it to you. I am creating an administrator part for my site in MVC architecture with a .htaccess which redirects everything to a main index.php. I made a classic connection system with a classic hash and some personal ip ban systems to avoid attacks. Until then everything is normal, I use $_SESSION to keep the connection active and my session_start() is called before the site to be sure to be correctly placed.
the problem is that my session resets each time I refresh the page. I did a lot of testing and I affirm that it resets well, I know that it is not from PHP, that I did not misuse my session but that chrome or gandi in one way or another another act on my session and break it to me. For example, when I use chrome in private browsing or firefox or when I'm local I have no problem and the connection goes perfectly well I haven't seen anyone with a similar problem and I don't know what to do, I uninstalled and reinstalled chrome, I reset some cookies, I reset some data but nothing to do, it doesn't change anything.
EDIT: here is some more code in order to be more clear on the problem to show a concrete example of the problem, I made a test file which creates a session and adds 1 each time we refresh the page on chrome it leaves me at 1 but in private browsing it adds me well 1 at each refresh
index.php (of my test project)
<?php
session_start();
// faire un compteur avec $_SESSION["count"] (comment for CoPilot)
if(!isset($_SESSION["count"])){
$_SESSION["count"] = 0;
}
$_SESSION["count"] = 1;
var_dump($_SESSION["count"]);
EDIT: ok, so in private browsing I have this result and $_SESSION["count"] is incremented correctly network pass private nav
but in normal browsing $_SESSION["count"] does not increment and 5 JS scripts are added to the request but I don't know where they come from, it may come from some Google Chrome extension but I have already tested without extension and with and it doesn't change anything, I don't understand why $_SESSION["count"] refuses to increment.
network pass normal nav
CodePudding user response:
I finally solved the problem by resetting my site's cookies, which I thought I had done, but there might still be special cookies that were hindering the connection to the site, unfortunately I did not look at the data that did that but it must probably come from a bad manipulation on my part. I can finally log in
thx all