2
I’m using this sessionHandler as my sessionHandler
.
The problem is that since I am using it I cannot initialize/close the session.
index php.
include_once( 'sessionHandler.php' );
$sessionHandler = new SessionSaveHandler(USER_NAME, PASSWORD, HOST, DATA_BASE,
"session", "my_session_name");
if(!isset($_SESSION['id']))
include_once 'login.php';
login.php
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
include_once 'verifica.php';
}
?>
<form id="login-form" class="form-signin" method="post" action="">
<label for="username">Username</label>
<input id="username" name="username" type="text"/>
<label for="password">Password</label>
<input id="password" name="password" type="password"/>
</form>
php checks.
//se a password e o login fizerem match:
$_SESSION['id'] = $id; //retornado da query sql.
...
header('Location: index.php');
Would it be possible for you to isolate the problem exactly as in the other topic? I mean, create the BD with that structure and implement Handler with Mysqli native functions instead of a third party class?
– Bruno Augusto
@I inaugurate my class
SessionSaveHandler
is exactly the same as yours on the second attempt.– Jorge B.
No, it’s not. I didn’t use a third-party class to operate Mysqli, my constructor had much more arguments, you removed the property Sessionsavehandler::$table which is used in 4 of the 6 stages of the session. That’s not counting what may have been tampered with in what you haven’t shown.
– Bruno Augusto
@Brunoaugusto is right. I will test with his example without changing anything.
– Jorge B.
@Brunoaugusto continues to be the same. When first loading index.php creates an empty session and then does not change when logging in and does not log in.
– Jorge B.
I suggest you edit the question and show me everything you’re doing. Where, when and how is Initiating Sessionhandler to record, to read and remove, because I tested here again, with and without redirects, with and without session names, and everything worked perfectly, write, read and delete.
– Bruno Augusto
I edited the question @Brunoaugusto
– Jorge B.
And the error logs?
– Bruno Augusto
Gives nothing. Just doesn’t fill in the field
data
table– Jorge B.
I’m sorry, but I insist there must be something else you haven’t shown here. I even reproduced your example, with this structure of includes and got a positive return through a var_dump() additionally placed on index php. for debugging.
– Bruno Augusto
Let’s go continue this discussion in chat.
– Jorge B.
@Brunoaugusto sees my answer.
– Jorge B.