Revision 747
Added by thorn over 17 years ago
| captcha.php | ||
|---|---|---|
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
if(!function_exists('call_captcha')) {
|
| 82 |
function call_captcha() {
|
|
| 82 |
function call_captcha($action='all') {
|
|
| 83 | 83 |
global $MOD_CAPTCHA; |
| 84 | 84 |
$t = time(); |
| 85 | 85 |
$_SESSION['captcha_time'] = $t; |
| 86 |
|
|
| 87 |
switch(CAPTCHA_TYPE) {
|
|
| 88 |
// one special case |
|
| 89 |
case 'text': // text-captcha |
|
| 90 |
?><table class="captcha_table"><tr> |
|
| 91 |
<td class="text_captcha"><?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?></td> |
|
| 92 |
<td><input type="text" name="captcha" maxlength="50" style="width:150px" /></td> |
|
| 93 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_QUEST']; ?></td> |
|
| 94 |
</tr></table><?php |
|
| 95 |
break; |
|
| 96 |
// two special cases |
|
| 97 |
case 'calc_text': // calculation as text |
|
| 98 |
?><table class="captcha_table"><tr> |
|
| 99 |
<td class="text_captcha"><?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?> = </td> |
|
| 100 |
<td><input type="text" name="captcha" maxlength="10" style="width:20px" /></td> |
|
| 101 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></td> |
|
| 102 |
</tr></table><?php |
|
| 103 |
break; |
|
| 104 |
case 'calc_image': // calculation with image (old captcha) |
|
| 105 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
|
| 106 |
?><table class="captcha_table"><tr> |
|
| 107 |
<td class="image_captcha"><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td><td> = </td> |
|
| 108 |
<td><input type="text" name="captcha" maxlength="10" style="width:20px" /></td> |
|
| 109 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></td> |
|
| 110 |
</tr></table><?php |
|
| 111 |
break; |
|
| 112 |
// normal images |
|
| 113 |
case 'ttf_image': // captcha with varying background and ttf-font |
|
| 114 |
case 'old_image': // old captcha |
|
| 115 |
?><table class="captcha_table"><tr> |
|
| 116 |
<td class="image_captcha"><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td> |
|
| 117 |
<td><input type="text" name="captcha" maxlength="10" style="width:50px" /></td> |
|
| 118 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; ?></td> |
|
| 119 |
</tr></table><?php |
|
| 120 |
break; |
|
| 86 |
|
|
| 87 |
if($action=='all') {
|
|
| 88 |
switch(CAPTCHA_TYPE) {
|
|
| 89 |
// one special case |
|
| 90 |
case 'text': // text-captcha |
|
| 91 |
?><table class="captcha_table"><tr> |
|
| 92 |
<td class="text_captcha"><?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?></td> |
|
| 93 |
<td><input type="text" name="captcha" maxlength="50" style="width:150px" /></td> |
|
| 94 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_QUEST']; ?></td> |
|
| 95 |
</tr></table><?php |
|
| 96 |
break; |
|
| 97 |
// two special cases |
|
| 98 |
case 'calc_text': // calculation as text |
|
| 99 |
?><table class="captcha_table"><tr> |
|
| 100 |
<td class="text_captcha"><?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?> = </td> |
|
| 101 |
<td><input type="text" name="captcha" maxlength="10" style="width:20px" /></td> |
|
| 102 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></td> |
|
| 103 |
</tr></table><?php |
|
| 104 |
break; |
|
| 105 |
case 'calc_image': // calculation with image (old captcha) |
|
| 106 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
|
| 107 |
?><table class="captcha_table"><tr> |
|
| 108 |
<td class="image_captcha"><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td><td> = </td> |
|
| 109 |
<td><input type="text" name="captcha" maxlength="10" style="width:20px" /></td> |
|
| 110 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></td> |
|
| 111 |
</tr></table><?php |
|
| 112 |
break; |
|
| 113 |
// normal images |
|
| 114 |
case 'ttf_image': // captcha with varying background and ttf-font |
|
| 115 |
case 'old_image': // old captcha |
|
| 116 |
?><table class="captcha_table"><tr> |
|
| 117 |
<td class="image_captcha"><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td> |
|
| 118 |
<td><input type="text" name="captcha" maxlength="10" style="width:50px" /></td> |
|
| 119 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; ?></td> |
|
| 120 |
</tr></table><?php |
|
| 121 |
break; |
|
| 122 |
} |
|
| 123 |
} elseif($action=='image') {
|
|
| 124 |
switch(CAPTCHA_TYPE) {
|
|
| 125 |
case 'text': // text-captcha |
|
| 126 |
case 'calc_text': // calculation as text |
|
| 127 |
include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); |
|
| 128 |
break; |
|
| 129 |
case 'calc_image': // calculation with image (old captcha) |
|
| 130 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
|
| 131 |
case 'ttf_image': // captcha with varying background and ttf-font |
|
| 132 |
case 'old_image': // old captcha |
|
| 133 |
echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; |
|
| 134 |
break; |
|
| 135 |
} |
|
| 136 |
} elseif($action=='input') {
|
|
| 137 |
switch(CAPTCHA_TYPE) {
|
|
| 138 |
case 'text': // text-captcha |
|
| 139 |
?><input type="text" name="captcha" maxlength="50" style="width:150px" /><?php |
|
| 140 |
break; |
|
| 141 |
case 'calc_text': // calculation as text |
|
| 142 |
?><input type="text" name="captcha" maxlength="10" style="width:20px" /><?php |
|
| 143 |
break; |
|
| 144 |
case 'calc_image': // calculation with image (old captcha) |
|
| 145 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
|
| 146 |
?><input type="text" name="captcha" maxlength="10" style="width:20px" /><?php |
|
| 147 |
break; |
|
| 148 |
// normal images |
|
| 149 |
case 'ttf_image': // captcha with varying background and ttf-font |
|
| 150 |
case 'old_image': // old captcha |
|
| 151 |
?><input type="text" name="captcha" maxlength="10" style="width:50px" /><?php |
|
| 152 |
break; |
|
| 153 |
} |
|
| 154 |
} elseif($action=='text') {
|
|
| 155 |
switch(CAPTCHA_TYPE) {
|
|
| 156 |
// one special case |
|
| 157 |
case 'text': // text-captcha |
|
| 158 |
echo $MOD_CAPTCHA['VERIFICATION_INFO_QUEST']; |
|
| 159 |
break; |
|
| 160 |
// two special cases |
|
| 161 |
case 'calc_text': // calculation as text |
|
| 162 |
echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; |
|
| 163 |
break; |
|
| 164 |
case 'calc_image': // calculation with image (old captcha) |
|
| 165 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
|
| 166 |
echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; |
|
| 167 |
break; |
|
| 168 |
// normal images |
|
| 169 |
case 'ttf_image': // captcha with varying background and ttf-font |
|
| 170 |
case 'old_image': // old captcha |
|
| 171 |
echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; |
|
| 172 |
break; |
|
| 173 |
} |
|
| 121 | 174 |
} |
| 122 | 175 |
} |
| 123 | 176 |
} |
Also available in: Unified diff
CAPTCHA: added parameter to call_captcha (can be one of: 'image', 'input' or 'text')