PHP Classes

Please, can you add an example with garbage-collection turned on

Recommend this page to a friend!

      HN CAPTCHA  >  All threads  >  Please, can you add an example with...  >  (Un) Subscribe thread alerts  
Subject:Please, can you add an example with...
Summary:Maybe this would help gettin GC to run
Messages:3
Author:Dirk Olten
Date:2011-11-21 10:58:30
Update:2011-11-22 11:43:58
 

  1. Please, can you add an example with...   Reply   Report abuse  
Picture of Dirk Olten Dirk Olten - 2011-11-21 10:58:30
I have problems turning on the garbage-collection (x1).
Please help with an example.
Thanks
:D

  2. Re: Please, can you add an example with...   Reply   Report abuse  
Picture of Horst Nogajski Horst Nogajski - 2011-11-22 11:43:58 - In reply to message 2 from Dirk Olten
Hi,

there is already an example within the package: hn_captcha.x1.example.php

Once more in short:

you have to include the base-class and the extension-class:

require_once("hn_captcha.class.php");
require_once("hn_captcha.class.x1.php");


There are some additional settings in the $CAPTCHA_INIT array when using the GarbageCollector:


'counter_filename' => ''
// string: absolute filename for textfile which stores current counter-value.
!! Needs read- & write-access !!


'prefix' => 'hn_captcha_'
// string: prefix for the captcha-images, is needed to identify the files in shared tempfolders


'collect_garbage_after' => 20
// integer: the garbage-collector run once after this number of script-calls.
Every script call count up the value in counterfile, when reaching this value, the grabage-collector runs and clean all files which are older than ->


'maxlifetime' => 60
// integer: only imagefiles which are older than this amount of seconds will be deleted


After that you can instantiate the class:

$captcha = new hn_captcha_X1 ( $CAPTCHA_INIT );

For more details please view the examplefile ('hn_captcha.x1.example.php').



HTH, otherwise please ask again.
Horst

  3. Re: Please, can you add an example with...   Reply   Report abuse  
Picture of Dirk Olten Dirk Olten - 2011-11-21 10:58:50
I have problems turning on the garbage-collection (x1).
Please help with an example.
Thanks
:D