mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -05:00
mt_rand
This commit is contained in:
parent
a92ebae59f
commit
e84a1e1451
@ -322,7 +322,7 @@ if (!function_exists('display_captcha'))
|
|||||||
{
|
{
|
||||||
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
$str = '';
|
$str = '';
|
||||||
for ($i = 0;$i < 8;$i++)
|
for ($i = 0;$i < 4;$i++)
|
||||||
{
|
{
|
||||||
$str.= substr($pool, mt_rand(0, strlen($pool) - 1) , 1);
|
$str.= substr($pool, mt_rand(0, strlen($pool) - 1) , 1);
|
||||||
}
|
}
|
||||||
@ -335,9 +335,9 @@ if (!function_exists('display_captcha'))
|
|||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
$length = strlen($word);
|
$length = strlen($word);
|
||||||
$angle = ($length >= 6) ? rand(-($length - 6) , ($length - 6)) : 0;
|
$angle = ($length >= 6) ? mt_rand(-($length - 6) , ($length - 6)) : 0;
|
||||||
$x_axis = rand(6, (360 / $length) - 16);
|
$x_axis = mt_rand(6, (360 / $length) - 16);
|
||||||
$y_axis = ($angle >= 0) ? rand($img_height, $img_width) : rand(6, $img_height);
|
$y_axis = ($angle >= 0) ? mt_rand($img_height, $img_width) : mt_rand(6, $img_height);
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
// Create image
|
// Create image
|
||||||
@ -408,13 +408,13 @@ if (!function_exists('display_captcha'))
|
|||||||
if ($use_font == FALSE)
|
if ($use_font == FALSE)
|
||||||
{
|
{
|
||||||
$font_size = 5;
|
$font_size = 5;
|
||||||
$x = rand(0, $img_width / ($length / 3));
|
$x = mt_rand(0, $img_width / ($length / 3));
|
||||||
$y = 0;
|
$y = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$font_size = 16;
|
$font_size = 16;
|
||||||
$x = rand(0, $img_width / ($length / 1.5));
|
$x = mt_rand(0, $img_width / ($length / 1.5));
|
||||||
$y = $font_size + 2;
|
$y = $font_size + 2;
|
||||||
}
|
}
|
||||||
for ($i = 0;$i < strlen($word);$i++)
|
for ($i = 0;$i < strlen($word);$i++)
|
||||||
@ -422,13 +422,13 @@ if (!function_exists('display_captcha'))
|
|||||||
|
|
||||||
if ($use_font == FALSE)
|
if ($use_font == FALSE)
|
||||||
{
|
{
|
||||||
$y = rand(0, $img_height / 2);
|
$y = mt_rand(0, $img_height / 2);
|
||||||
imagestring($im, $font_size, $x, $y, substr($word, $i, 1) , $text_color);
|
imagestring($im, $font_size, $x, $y, substr($word, $i, 1) , $text_color);
|
||||||
$x+= ($font_size * 2);
|
$x+= ($font_size * 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$y = rand($img_height / 2, $img_height - 3);
|
$y = mt_rand($img_height / 2, $img_height - 3);
|
||||||
imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
|
imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
|
||||||
$x+= $font_size;
|
$x+= $font_size;
|
||||||
}
|
}
|
||||||
|
@ -107,8 +107,8 @@
|
|||||||
<label for="captcha">Spam Protection
|
<label for="captcha">Spam Protection
|
||||||
<span class="instruction">Type in the characters displayed in the picture.</span>
|
<span class="instruction">Type in the characters displayed in the picture.</span>
|
||||||
</label>
|
</label>
|
||||||
<img class="captcha" src="<?php echo site_url('view/captcha'); ?>" alt="captcha" />
|
<img class="captcha" src="<?php echo site_url('view/captcha'); ?>?<?php echo date('U', mktime()); ?>" alt="captcha" width="110" height="25" />
|
||||||
<input value="<?php if(isset($title_set)){ echo $title_set; }?>" type="text" id="title" name="title" tabindex="2" maxlength="32" />
|
<input value="<?php if(isset($captcha_set)){ echo $captcha_set; }?>" type="text" id="captcha" name="captcha" tabindex="2" maxlength="32" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user