PDA

Zobacz pełną wersję : Sesja i securimage captcha



Frostbourn
14-12-2014, 15:30
Witam

Chcialem dodac captcha do jednego z modulow kontaktowych na mojej stronie. Pobralem ostatnia wersje securimage, zaimplementowalem i wszystko dziala poprawnie poza tym ze captcha nawet podczas wpisania poprawnego kodu nigdy nie jest poprawna.

Na stronie tworcy znalazlem takie oto wytlumaczenie problemu http://www.phpcaptcha.org/faq/:



If the variable names are the same this may be due to a problem with the PHP session that is used to keep track of the user and what their code is. It is possible that the session was not started or more likely that the session name being used in securimage_show.php differs from the session name used in the script that does the code validation. It is common for other software platforms (forums, content management systems, form processors etc.) to use a session name other than the PHP default. If this is the case, you must determine what session name is used by the software and use the same session name in securimage_show.php and securimage_play.php.


A non-default session name can be passed to Securimage so it can share a session with another software platform with the following code: $img->session_name = 'your_session_name';


To by wyjasnialo dlaczego captcha zawsze zwraca false. Probowalem edytowac obydwa pliki o ktorych jest mowa powyzej jednak nie wiem jak pobrac sesje z Joomli, aby wpisana poprawnie captcha wysylala formularz.

Bede z gory wdzieczny za wszystkie wskazowki dotyczace rozwiazania owego problemu.



securimage_show.php


require_once dirname(__FILE__) . '/securimage.php';


$img = new Securimage();


if (!empty($_GET['namespace'])) $img->setNamespace($_GET['namespace']);




$img->show();



securimage_play.php


require_once dirname(__FILE__) . '/securimage.php';


$options = array(
'use_database' => true,
'database_name' => '',
'database_user' => '',
'database_driver' => Securimage::SI_DRIVER_MYSQL
);


$img = new Securimage();


if (!empty($_GET['namespace'])) $img->setNamespace($_GET['namespace']);


$img->outputAudioFile();