author | František Kučera <franta-hg@frantovo.cz> |
Mon Apr 05 18:44:10 2010 +0200 (2010-04-05) | |
changeset 87 | 27ddd3691997 |
child 145 | 0efefbf5f8b6 |
permissions | -rw-r--r-- |
franta-hg@83 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
franta-hg@83 | 2 |
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" |
franta-hg@83 | 3 |
xmlns:c="http://java.sun.com/jsp/jstl/core" |
franta-hg@83 | 4 |
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" |
franta-hg@83 | 5 |
xmlns:fn="http://java.sun.com/jsp/jstl/functions" |
franta-hg@83 | 6 |
xmlns:nk="urn:jsptagdir:/WEB-INF/tags/nekurak" |
franta-hg@83 | 7 |
version="2.0"> |
franta-hg@83 | 8 |
|
franta-hg@83 | 9 |
<jsp:directive.page contentType="application/xhtml+xml"/> |
franta-hg@83 | 10 |
|
franta-hg@83 | 11 |
<!-- <lokalizace> --> |
franta-hg@83 | 12 |
<c:if test="${param.jazyk != null}"> |
franta-hg@83 | 13 |
<fmt:setLocale value="${param.jazyk}" scope="session"/> |
franta-hg@83 | 14 |
</c:if> |
franta-hg@83 | 15 |
<fmt:setBundle basename="cz.frantovo.nekurak.preklady" scope="application"/> |
franta-hg@83 | 16 |
<!-- </lokalizace> --> |
franta-hg@83 | 17 |
|
franta-hg@83 | 18 |
<nk:stranka titulek="Kaptcha"> |
franta-hg@83 | 19 |
|
franta-hg@83 | 20 |
<h1><c:out value="Kaptcha – ukázka"/></h1> |
franta-hg@83 | 21 |
|
franta-hg@83 | 22 |
<c:choose> |
franta-hg@83 | 23 |
<c:when test="${param.akce == 'odeslat'}"> |
franta-hg@83 | 24 |
<p>Odeslané údaje:</p> |
franta-hg@83 | 25 |
|
franta-hg@83 | 26 |
<p>Políčko 1: <c:out value="${param.policko1}"/></p> |
franta-hg@83 | 27 |
<p>Políčko 2: <c:out value="${param.policko2}"/></p> |
franta-hg@83 | 28 |
<p>Kaptcha: <c:out value="${param.kaptcha}"/></p> |
franta-hg@83 | 29 |
|
franta-hg@83 | 30 |
<p>Očekávaná hodnota: <c:out value="${sessionScope['KAPTCHA_SESSION_KEY']}"/></p> |
franta-hg@83 | 31 |
|
franta-hg@83 | 32 |
<c:choose> |
franta-hg@83 | 33 |
<c:when test="${sessionScope['KAPTCHA_SESSION_KEY'] == param.kaptcha}"> |
franta-hg@83 | 34 |
<p class="informacniHlaska">Správně opsaný kód z obrázku.</p> |
franta-hg@83 | 35 |
</c:when> |
franta-hg@83 | 36 |
<c:otherwise> |
franta-hg@83 | 37 |
<p class="chybovaHlaska">Špatně obsaný kód z obrázku.</p> |
franta-hg@83 | 38 |
</c:otherwise> |
franta-hg@83 | 39 |
</c:choose> |
franta-hg@83 | 40 |
|
franta-hg@83 | 41 |
|
franta-hg@83 | 42 |
|
franta-hg@83 | 43 |
</c:when> |
franta-hg@83 | 44 |
<c:otherwise> |
franta-hg@83 | 45 |
<!-- Zobrazíme uživateli registrační formulář. --> |
franta-hg@83 | 46 |
<p>Nějaký formulář, který chceme ochránit proti spamu:</p> |
franta-hg@83 | 47 |
<form method="post" action="kaptcha.jsp?akce=odeslat"> |
franta-hg@83 | 48 |
<fieldset> |
franta-hg@83 | 49 |
<label>Políčko 1: <input type="text" name="policko1" maxlength="255"/></label><br/> |
franta-hg@83 | 50 |
<label>Políčko 2: <input type="text" name="policko2" maxlength="255"/></label><br/> |
franta-hg@83 | 51 |
</fieldset> |
franta-hg@83 | 52 |
<fieldset> |
franta-hg@83 | 53 |
<!-- Kaptcha --> |
franta-hg@83 | 54 |
<img src="kaptcha.jpg" alt="ochrana proti spamu" id="kaptchaIMG" title="klikněte pro vygenerování nového obrázku"/><br/> |
franta-hg@83 | 55 |
<script type="text/javascript"> |
franta-hg@83 | 56 |
$(function(){ |
franta-hg@83 | 57 |
$('#kaptchaIMG').click(function () { $(this).attr('src', 'kaptcha.jpg?' + Math.floor(Math.random()*100) ); }) |
franta-hg@83 | 58 |
}); |
franta-hg@83 | 59 |
</script> |
franta-hg@83 | 60 |
|
franta-hg@83 | 61 |
<label>Opište: <input type="text" name="kaptcha" maxlength="255"/></label><br/> |
franta-hg@83 | 62 |
</fieldset> |
franta-hg@83 | 63 |
<fieldset> |
franta-hg@83 | 64 |
<button value="submit">Odeslat</button> |
franta-hg@83 | 65 |
</fieldset> |
franta-hg@83 | 66 |
</form> |
franta-hg@83 | 67 |
</c:otherwise> |
franta-hg@83 | 68 |
</c:choose> |
franta-hg@83 | 69 |
|
franta-hg@83 | 70 |
</nk:stranka> |
franta-hg@83 | 71 |
|
franta-hg@83 | 72 |
</jsp:root> |