<?php
require_once('zly_captcha.class.php');
if(zly_captcha::check()): ?>
<b style="color:green;">Captcha Ok!</b>
<? else: ?>
<b style="color:red;">Captcha Bad!</b>
<? endif; ?>
<form action="" method="POST">
<!-- -->
<div id="captcha_base64" style="display:block;">
<img alt="captcha" src="<?= zly_captcha::image_base64(); ?>" width="150" height="50" />
<div><a href="" id="captcha_switch">can't see image</a></div>
</div>
<!-- -->
<div id="captcha_simple" style="display:none;">
<img alt="captcha" src="zly_captcha.php?i=<?= zly_captcha::salt() ?>" width="150" height="50" />
</div>
<!-- -->
<label for="captcha">captcha</label>
<input type="text" name="captcha" id="captcha" value="" />
<input type="hidden" name="captcha_token" id="captcha_token" value="<?= zly_captcha::token() ?>" />
<input type="submit" />
<!-- -->
<script type="text/javascript">
document.getElementById('captcha_switch').onclick = function(){
document.getElementById('captcha_base64').style.display = 'none';
document.getElementById('captcha_simple').style.display = 'block';
return false;
};
document.getElementById('captcha').focus();
</script>
<!-- -->
</form>
|