--=REKLAMA=--
Ta strona przeznaczona jest dla projektantów Joomla/Mambo, którzy chcą wykorzystać Security Images w swoim kodzie.
Dotyczy Joomla 1.0! Poniższy materiał odnosi się do rozszerzeń Joomla 1.0 |
Stosowanie tego systemu jest bardzo proste…
W kodzie strony, którą widzi użytkownik tylko 3 linie są niezbędne:
1. Włączenie biblioteki komponentu:
<?php if (file_exist($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php')) { include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?> ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); } ?>
2. w miejscu, w którym ma się pojawić Captcha, trzeba wstawić następującą linię:
<?php echo insertSecurityImage("security_refid"); ?>
3. Poniższy kod wstawia tekst pomocy i pole, w którym użytkownik będzie wprowadzać kod.
<?php echo getSecurityImageText("security_try"); ?>
Linia w punkcie 3 jest, w niektórych przypadkach, zależna od ilości miejsca w warstwie prezentacyjnej HTML. Możesz ją zastąpić następującymi:
<?php echo getSecurityImageTextHeader(); ?>
Efektem będzie etykieta: "Wpisz, odczytany kod"
<?php echo getSecurityImageTextHelp(); ?>
Efektem będzie etykieta: "Prosżę o nowy obraz&hellip"
<?php echo getSecurityImageField("security_try"); ?>
Wstawia na stronie pole formularza, do którego użytkownik wpisuje kod z obrazka.
Kod powyżej wstawia obraz i tekst. Twoja strona zwykle przesyła informację do przetworzenia na serwerze. 2 ostatnie linie są wstawiane między znaczniki HTML <form> </form>
W kodzie przygotowującym dane na serwerze tylko 2 linie są wymagane&hellip
<php if if (file_exist($mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php')) { include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php'); } $checkSecurity = checkSecurityImage($security_refid, $security_try); ?>
Jeśli użytkownik wprowadzi poprawny kod, wówczas $checkSecurity = true
Dostosowania kodu Joomla! do korzystania z Security Images wymaga kilku poprawek:
Otwórz plik components\com_registration\registration.html.php.
Zmodyfikuj funkcję registerForm($option, $useractivation) (ok. linii 54):
<tr> <td> <?php echo _PROMPT_EMAIL; ?> </td> <td> <input type="text" name="confirmEmail" class="inputbox" size="40" /> </td> </tr> <?php //security image by www.waltercedric.com global $mosConfig_absolute_path; if (file_exists ($mosConfig_absolute_path . '/administrator/components/com_securityimages/patches/registration.lostPassForm.php')) { require_once ($mosConfig_absolute_path .'/administrator/components/com_securityimages/patches/registration.lostPassForm.php'); } //end security image by www.waltercedric.com ?> <tr> <td colspan="2"> <input type="hidden" name="option" value="<?php echo $option;?>" /> <input type="hidden" name="task" value="sendNewPass" /> <input type="submit" class="button" value="<?php echo _BUTTON_SEND_PASS; ?>" /> </td> </tr>
Otwórz plik components\com_registration\registration.html.
Zmodyfikuj funkcję registerForm($option, $useractivation) (ok. linii 164):
<tr> <td> <?php echo _REGISTER_VPASS; ?> * </td> <td> <input class="inputbox" type="password" name="password2" size="40" value="" /> </td> </tr> <?php //security image by www.waltercedric.com global $mosConfig_absolute_path; if (file_exists($mosConfig_absolute_path .'/administrator/components/com_securityimages/patches/registration.html.registerForm.php')) { require_once($mosConfig_absolute_path .'/administrator/components/com_securityimages/patches/registration.html.registerForm.php'); } //end security image by www.waltercedric.com ?> <tr> <td colspan="2"> </td> </tr>
Otwórz plik \components\com_registration\registration.php.
Po linii 61 dodaj kod:
$checkusername = mosGetParam( $_POST, 'checkusername', '' ); $checkusername = $database->getEscaped( $checkusername ); $confirmEmail = mosGetParam( $_POST, 'confirmEmail', ''); $confirmEmail = $database->getEscaped( $confirmEmail ); //securityimages by www.waltercedric.com global $mosConfig_absolute_path; if (file_exists($mosConfig_absolute_path .'/administrator/components/com_securityimages/patches/registration.SendNewPass.php')) { include_once ($mosConfig_absolute_path .'/administrator/components/com_securityimages/patches/registration.SendNewPass.php'); } //end security images by www.waltercedric.com $query = "SELECT id"
Otwórz plik \components\com_registration\registration.php.
Po linii 123 (nr linii - po dodaniu kodu z pkt1) dodaj kod:
function saveRegistration( $option ) { global $database, $acl; global $mosConfig_sitename, $mosConfig_live_site, $mosConfig_useractivation, $mosConfig_allowUserRegistration; global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_mailfrom, $mosConfig_fromname; if ($mosConfig_allowUserRegistration=='0') { mosNotAuth(); return; } //securityimages by www.waltercedric.com global $mosConfig_absolute_path; if (file_exists ($mosConfig_absolute_path .'/administrator/components/com_securityimages/patches/registration.SaveRegistration.php')) { include_once($mosConfig_absolute_path .'/administrator/components/com_securityimages/patches/registration.SaveRegistration.php'); } //end security images by www.waltercedric.com $row = new mosUser( $database ); if (!$row->bind( $_POST, 'usertype' )) { echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; exit(); }
Otwórz plik includes\joomla.php.
Po linii 610 dodaj kod:
$passwd = md5( $passwd ); $bypost = 1; } $remember = mosGetParam( $_POST, 'remember', '' ); //securityimages by www.waltercedric.com global $mosConfig_absolute_path; if (file_exists($mosConfig_absolute_path .'/administrator/components/com_securityimages/patches/joomla.login.php')) { include_once($mosConfig_absolute_path .'/administrator/components/com_securityimages/patches/joomla.login.php'); } //end security images by www.waltercedric.com if (!$username || !$passwd) { echo "<script> alert(\""._LOGIN_INCOMPLETE."\"e; window.history.go(-1); </script>\n"; exit(); } else {