Comments (26)
i am using this for more than 14 years, as well as thousands of others. i am sorry it is not working out for you
from zebra_session.
now you are replying!
from zebra_session.
no, i am not :)
from zebra_session.
if you don't like to gif anny support about your code way you are on github?
and fine if it works for you but not for anyone else! every time there wil be create a news session without anny reason and rendum time and the unix time is not expired!
from zebra_session.
this is my last reply to you: my code is on github because of version control. i am 100% giving support for anyone finding issues with any of my libraries. what you are saying indicates that you have no idea what you are doing, haven't read the documentation, nor have any idea what open source is. open source is about choice. both for you and for me
from zebra_session.
so there is my issue of you can read!
I have used your session class as described in your documentation!
after some time there is a news session wit the same hash but difrant session_id without data!
from zebra_session.
but if you dont like to help or something else I keep posting the class will not word for everyone else waste his time for testing it!
from zebra_session.
If there is no activity, PHP sessions expire after a number of minutes, depending on your server's configuration. There's a method for getting your server's settings.
from zebra_session.
please don't threaten me. read the docs, try the examples, be cool or i'll report and block you
from zebra_session.
I want only fix this issue and if none answers only when I almost giving up it will not help!
[session.gc_maxlifetime] => 1440 seconds (24 minutes)
[session.gc_probability] => 1000
[session.gc_divisor] => 1000
[probability] => 100%
And if you like I build a website for corona helpers for free and it will be nice if thy can be logged in and not every time lost there session
from zebra_session.
call
ini_set('session.gc_probability', 1);
as the first thing in your script
from zebra_session.
Thanks, I have added but the result stays on [session.gc_probability] => 1000 it this correct?
from zebra_session.
yes. but the probability now should be 0.1%
from zebra_session.
i don't know what else could there be. are you sure you are not calling session_regenerate_id
on every request?
from zebra_session.
oka probability still 100%
no I dont use session_regenerate_id, I have your code after mysql conection and after that I have your class.
after users haved logged in I check if some variables exists in the session and thats it
from zebra_session.
my configuration
Directadmin, CentOS 8, PHP 7.3, 10.4.12-MariaDB, Nginx
from zebra_session.
it looks like ini_set
is not working, so you'll have to change it in php.ini
. search for session.gc_probability
and set it to 1
from zebra_session.
I have chacked php.ini but its already on 1
https://waadhoekevoorelkaar.nl/phpinfo.php
from zebra_session.
...i don't know then...
if you say that session.gc_probability
is still1000 then it means that something changes it by the time you instantiate this class.
why aren't you trying using PHP's own session handler?
from zebra_session.
I want to store the sessions in mysql, I used 2 servers load balancing and 1 mysql server.
from zebra_session.
try disabling your load balancer and leave only a single server
from zebra_session.
i am pretty sure that this is the issue - there is a different session id on each of the servers and you will have to find a way to make sure that the session id is the same regardless on the server the user is on
from zebra_session.
I am working on this for 3 days and also have test it to disabled the load balancing and running form a single server.
also tested to set 365 days the cookie_lifetime and gc_maxlifetime bit also that will not works.
I am now update the php version to 7.4 maybe it will helps.
from zebra_session.
for testing form the public_html clear php file without anny changes or other libraries.
this is correct richt ?
error_reporting(E_ALL);ini_set("display_errors", 'On');
// start session handler
$sql_host = '';
$sql_dbname = '';
$sql_user = '';
$sql_pass = '';
// create connection string
$dsn = 'mysql:host=' . $sql_host . ';dbname=' . $sql_dbname . ';charset=utf8mb4';
// try to connect to the MySQL server using PDO
try {$pdo = new PDO($dsn, $sql_user, $sql_pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,));}
catch (\PDOException $e) {throw new \PDOException($e->getMessage(), (int)$e->getCode());}
// secure the sessions
ini_set('session.gc_probability', 1);
// include the Zebra_Session class
require '../conf/Zebra_Session.php';
// instantiate the Zebra_Session class
$session = new Zebra_Session($pdo, 'sEcUr1tY_c0dE', '', true, false, 1000);
// end session handler
// current session settings
print_r('<pre><strong>Current session settings:</strong><br><br>');
print_r($session->get_settings());
print_r('</pre>');
print_r('<pre>');
print_r($_SESSION);
print_r('</pre>');
// add some values to the session
$_SESSION['value1'] = 'hello';
$_SESSION['value2'] = 'world';
phpinfo();
phpinfo();```
result
Current session settings:
Array
(
[session.gc_maxlifetime] => 1440 seconds (24 minutes)
[session.gc_probability] => 1000
[session.gc_divisor] => 1000
[probability] => 100%
)
Array
(
[users_id] => 1
[remote_addr_id] => 1
[fingerprint] => {Yp8&���
�.��)�W���v��/�Ǵ
�?�Ή�"�f�9rjڜ)�~���.rj��=����OG�(�t
[last_logged_in] => 1584804553
[remote_addr] => 217.101.130.169
[http_user_agent] => Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
[value1] => hello
[value2] => world
)
from zebra_session.
yes, looks right.
try with the default values of
$session = new Zebra_Session($pdo, 'sEcUr1tY_c0dE');
from zebra_session.
Thanks awesome it seems working for now also with load balancing.
Thank you so much for appreciating that you want to help and I don't mean to upset you just wanted a solution to the problem.
ini_set('session.gc_probability', 1); is the same as change 1000 to 1 (I found also the answer asked in another item)
$session = new Zebra_Session($pdo, 'sEcUr1tY_c0dE', '', true, false, 1000);
[session.gc_maxlifetime] => 1440 seconds (24 minutes)
[session.gc_probability] => 1000
[session.gc_divisor] => 1000
[probability] => 100%
$session = new Zebra_Session($pdo, 'sEcUr1tY_c0dE');
[session.gc_maxlifetime] => 1440 seconds (24 minutes)
[session.gc_probability] => 1
[session.gc_divisor] => 1000
[probability] => 0.1%
from zebra_session.
Related Issues (20)
- Prepare statements a must!
- HUGE number of session rows HOT 2
- request: anti-dos
- Support on postgresql
- explanation request HOT 1
- session data missing after renew session in database HOT 1
- Empty Session HOT 13
- Are there any reason you don't use SessionHandlerInterface class? HOT 1
- Can't connect Zebra Session with PDO? HOT 7
- transition to PDO ? HOT 11
- If calling die(), will the session get closed/lock get released or not? HOT 2
- Question: session_id($id) does not change sid HOT 1
- get_lock doesn't work HOT 3
- Logging Out Users HOT 6
- keep session even if browser is close HOT 1
- How to show alert when session is expired? HOT 14
- zebra_session could be use in AWS ALB? HOT 2
- session_start gives an unkown error HOT 2
- Session Lifetime of 0 (zero) Behaves Differently on PHP 8 - Expires Immediately HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zebra_session.