Welcome Guest, Not a member yet? Register   Sign In
trying to run function just once
#14

(This post was last modified: 06-22-2021, 08:42 PM by John_Betong.)

I use native PHP session_start() which is called in app/Controllers/BaseController.php

Once called $_SESSIONS remain active all the time a user is logged in and the session is dropped (I think when a user logs out.). Try checking to see if $_SESSION['RUNONCE'] has been set.

File:  /app/Controllers/BaseController.php

PHP Code:
//=======================================================
public function initController
(
 
RequestInterface  $request
 
ResponseInterface $response
 
LoggerInterface  $logger
)
{
  session_start();
  $_SESSION['RUNONCE'] = $_SESSION['RUNONCE'] ?? 0;
  $_SESSION['RUNONCE'] = ++$_SESSION['RUNONCE'];

// Do Not Edit This Line
parent::initController($request$response$logger);
...
... 

Edit:
Just tried setting the script in index.php and it also works OK
Reply


Messages In This Thread
trying to run function just once - by richb201 - 06-21-2021, 09:06 AM
RE: trying to run function just once - by ikesela - 06-21-2021, 07:10 PM
RE: trying to run function just once - by paliz - 06-22-2021, 04:19 AM
RE: trying to run function just once - by John_Betong - 06-22-2021, 08:14 PM
RE: trying to run function just once - by craig - 06-23-2021, 03:26 AM
RE: trying to run function just once - by paliz - 06-24-2021, 02:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB