In your PHP code displaying the form, can be a Pat template or a html code
1. Include my library in page scope if (file_exist($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php')) {<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?> } $packageName = 'securityChooseUniqueKeyName';
2. At the position where You want the Captcha image to be inserted
<?php echo insertSecurityImage($packageName); ?> 3. This insert the help text and the input box where the user will have to enter his text
<?php echo getSecurityImageText($packageName); ?> Line at point 3. can be, in some case, depending how much space You have in the presentation HTML layer, replace with
//will be replace at runtime, depending on user locale //with "Please Enter what You see:" <?php echo getSecurityImageTextHeader(); ?> //will be replace at run time, depending on user locale with //"If You do not see ...Hit reload" <?php echo getSecurityImageTextHelp(); ?> //will be replace at run time with the input box <?php echo getSecurityImageField($packageName); ?> The code above insert the image, and the text, You page normally submit information to the server for processing. Most of the time, the last 2 lines are inserted in a <form> </form> HTML tags
In the server code where you process the data... Few lines are required...
if (file_exist($mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php')) {include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php'); } $packageName = 'securityChooseUniqueKeyName'; $security_refid = mosGetParam( $_POST, $packageName.'_refid', '' ); $security_try = mosGetParam( $_POST, $packageName.'_try', '' ); $security_reload = mosGetParam( $_POST, $packageName.'_reload', '' ); $checkSecurity = checkSecurityImage($security_refid, $security_try);
If the has entered the right text then $checkSecurity = true
|