59943

Session Time out in PHP or Processmaker

Question:

How to do a session time out in php or processmaker(BPM)?

I refered most forum and wikis but that didn't solved my problem.

Please let me know.

Answer1:

On ProcessMaker you have to change the following parameters on your <strong>php.ini</strong> in order to modify the session time out

<ul><li>session.gc_maxlifetime </li> <li>session.cache_expire</li> <li>session.cache_limiter</li> </ul>

This will work from version <strong>2.5RC1 (Release Candidate)</strong> which is available to be downloaded on the <a href="http://sourceforge.net/projects/processmaker/files/ProcessMaker/2.5/2.5-RC1/" rel="nofollow">ProcessMaker sourceforge page</a>

Hope this also helps you.

<a href="/questions/tagged/processmaker" class="post-tag" title="show questions tagged 'processmaker'" rel="nofollow">processmaker</a>

Answer2:

Store the last time the user made a request

<?php $_SESSION['timeout'] = time(); ?>

In subsequent request, check how long ago they made their previous request (10 minutes in this example)

<?php if ($_SESSION['timeout'] + 10 * 60 < time()) { // session timed out } else { // session ok } ?>

Extracted from <a href="https://stackoverflow.com/questions/3068744/php-session-timeout" rel="nofollow">here</a>

Answer3:

this are well explained in previous post. see the link below <a href="https://stackoverflow.com/questions/3068744/php-session-timeout" rel="nofollow">PHP Session timeout</a>

and

<a href="https://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes" rel="nofollow">How do I expire a PHP session after 30 minutes?</a>

Answer4:

Include this code in the start of your php scripts:

<?php if(!isset($_SESSION)){@session_start();} if (isset($_SESSION['timeout']) and $_SESSION['timeout'] + 1800 < time()) { session_unset(); session_destroy(); } else { $_SESSION['timeout'] = time(); } ?>

The first line checks if there is a session, and if there is no session it creates it.

The @ sign in front of the session_start() is to suppress any warnings or notices that the session_start() might throw. Nothing important for this code at all, and you can remove it.

The next line checks if the $_SESSION['timeout'] variable exist and if it contains a value more than 30 minutes in to the past from the current time.

The first time you run the script it will not exist, so if you check its value when it does not exist it will give you a notice or warning message if this is enabled in your php.ini file.

If it does not exist we skip to the else and have it created, and we add the current time().

Now the value of 1800 is 30 minutes in seconds. 30 * 60 is another common way to write this to make it easier to read.

If the if is true, the user have been inactive for more than 30 minutes. If it is less than 30 minutes or the first time the script is running, it will skip to the else and update the timeout variable.

Recommend

  • What is dotnet5.4 and net451 in class library?
  • Issue in dynamic table creation
  • can I have 2 different datasources in groovy with different privileges
  • Encode/decode AMR
  • VBA: How can I keep only the date values from a string?
  • How to wrap UTF-8 encoded C++ std::strings with Swig in C#?
  • Using a support vector classifier with polynomial kernel in scikit-learn
  • Simple script doesn't show anything on the Output in LuaEdit
  • Solving multiple interface implementation
  • ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn&
  • Hibernate - Cannot connect to DB
  • Grid creating extra spacing that I don't want
  • Getting IIS6 to play nice with WordPress Pretty Permalinks
  • Update varbinary(MAX) field in SQLServer 2012 Lost Last 4 bits
  • in batch how do i use taskkill properly
  • C# Excel interop - how to test if interop object is still working and performing a task?
  • Why does java tzupdater add leap seconds?
  • Clear activity stack before launching another activity
  • Email verification using google app script and google forms
  • Refering to the class itself from within a class mehod in Objective C
  • formatting the colorbar ticklabels with SymLogNorm normalization in matplotlib
  • Cannot connect to cassandra from Spark
  • How do I change content of ComboFieldEditor?
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Trying to switch camera back to front but getting exception
  • htaccess rewriting URLs with multiple forward slashes
  • Symfony2: How to get request parameter
  • Display Images one by one with next and previous functionality
  • Weird JavaScript statement, what does it mean?
  • Web-crawler for facebook in python
  • Do I've to free mysql result after storing it?
  • A cron job substitute?
  • SQL merge duplicate rows and join values that are different
  • log4net write single file for each call to log.info
  • Getting error when using KSoap library to consume .NET web services
  • -fvisibility=hidden not passed by compiler for Debug builds
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF