首頁
新聞
功能
下載
開發
支援
論壇
文件
搜尋
關於我們
歡迎光臨,
訪客
. 請先
登入
或
註冊一個帳號
.
四月 30, 2025, 01:04:16 上午
19595
文章 在
3865
主題 由
4579
會員
最新註冊會員:
aa123aa1
首頁
說明
搜尋
登入
註冊
LifeType 中文開發論壇
|
開發
|
外掛程式
|
修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
« 上篇主題
下篇主題 »
頁:
[
1
]
列印
作者
主題: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形 (閱讀 28756 次)
twu2
初級會員
文章: 61
修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
於:
十月 16, 2006, 01:33:37 下午 »
在 PHPBB 有一個 Better Captcha MOD, 所產生的識別碼圖形, 並不會像 FreeCap 所產生的那般, 十分難辨識. 而 LifeType 本身的 AuthImage 所產生的圖形, 又太有規律. 所以, 打算讓 AuthImage 產生圖形的方式, 用 Better Captcha 方式來產生.
首先, 先到這兒抓取 Better Captcha. 抓回解開之後, 把 fonts 這個目錄放到 authimage 的目錄下頭. 然後修改 pluginauthimage.class.php 如下:
程式碼:
--- authimage.old/pluginauthimage.class.php
2006-07-05 10:19:57.000000000 +0800
+++ authimage/pluginauthimage.class.php
2006-10-16 14:20:28.744067612 +0800
@@ -8,7 +8,10 @@
define( "AUTHIMAGE_FILE", "/plugins/authimage/authimage.php" );
define( "AUTHIMAGE_BACKGROUND_FOLDER", PLOG_CLASS_PATH."plugins/authimage/backgrounds/" );
-
+// twu2 20061016 begin
+ define( "AUTHIMAGE_FONT_FOLDER", PLOG_CLASS_PATH."plugins/authimage/fonts/" );
+// twu2 20061016 end
+
/**
* Plugin that offers comment authentication image for current blog
* Original Author: Gudlyf http://www.gudlyf.com/index.php?p=376
@@ -93,8 +96,9 @@
function show() {
$authImageUrl = $this->generateImageUrl();
+ //return '<img src="'.$authImageUrl.'" style="vertical-align:middle;" width="70px" height="20px" alt="authimage" />';
if ( $authImageUrl )
- return '<img src="'.$authImageUrl.'" style="vertical-align:middle;" width="70px" height="20px" alt="authimage" />';
+ return '<img src="'.$authImageUrl.'" style="vertical-align:middle;" alt="authimage" />';
else
return 'You don\'t have GD support compiled in, we cannot create an authimage. Please activate GD Support.';
}
@@ -103,6 +107,16 @@
// Delete those cached authimage files that never used
$this->deleteExpiredAuthImage($this->expiredTime);
+// twu2 20061016 begin
+ $code = $this->generateCode();
+ $encrypt = $this->encrypt($code, $this->key);
+ if ( function_exists ( 'ImageGIF' ) )
+
$image_format = 'gif';
+
else
+
$image_format = 'png';
+ $tempFile = $this->cacheFolder."/".$encrypt.".".$image_format;
+
$this->captcha_createimage($code, $image_format, $tempFile);
+/* old method for image
$code = $this->generateCode();
$encrypt = $this->encrypt($code, $this->key);
$background = AUTHIMAGE_BACKGROUND_FOLDER.$this->default;
@@ -125,6 +139,8 @@
} else {
ImageGIF($image, $tempFile);
}
+*/
+// twu2 20061016 end
$temp = fopen($tempFile,"rb");
$buffer = fread($temp,filesize($tempFile));
fclose($temp);
@@ -137,7 +153,10 @@
// Now chmod it so it can be deleted later by the user
chmod($tempFile, 0666);
- header("Content-type: image/gif");
+// twu2 20061016 begin
+ //header("Content-type: image/gif");
+ header("Content-type: image/".$image_format);
+// twu2 20061016 end
echo $buffer;
}
@@ -150,7 +169,14 @@
function generateCode() {
$code = "";
- for($i=0; $i < $this->length; $i++) $code .= rand(0,9);
+// twu2 20061016 begin
+ //for($i=0; $i < $this->length; $i++) $code .= rand(0,9);
+
//$hash = "0123456789";
+
//$hash = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
$hash = "0123456789ABCDEFGHKMNPQRWXYZ";
+
$len = strlen($hash) - 1;
+ for($i=0; $i < $this->length; $i++) $code .= $hash[rand(0,$len)];
+// twu2 20061016 end
return $code;
}
@@ -168,6 +194,135 @@
closedir($handle);
}
}
+
+// twu2 20061016 begin
+ function captcha_createimage($code, $image_format, $tempFile)
+ {
+ $breedte = rand(256, 384);
+ $hoogte = rand(64, 96);
+ $img = imagecreatetruecolor($breedte,$hoogte);
+ $achtergrond = imagecolorallocate($img, $this->captcha_color("bg"), $this->captcha_color("bg"), $this->captcha_color("bg"));
+
+ imagefilledrectangle($img, 0, 0, $breedte-1, $hoogte-1, $achtergrond);
+
$hash = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
$hash_len = strlen($hash);
+ for($g = 0;$g < 30; $g++)
+ {
+
$t = $hash[rand(0, $hash_len)];
+
+ $ypos = rand(0,$hoogte);
+ $xpos = rand(0,$breedte);
+
+ $kleur = imagecolorallocate($img, $this->captcha_color("bgtekst"), $this->captcha_color("bgtekst"), $this->captcha_color("bgtekst"));
+
+ if (!($g % 2))
+
{
+
$scribx = rand(0,($breedte*2));
+
$scriby = rand(0,($hoogte*2));
+
+
$wibblex = rand(0,($breedte*2));
+
$wibbley = rand(0,($hoogte*2));
+
+
imageline($img, rand(0, $scribx-$xpos), rand(0, $scriby+$ypos), rand(0, $wibblex), rand(0, $wibbley), $kleur+$g);
+
imageellipse($img, rand(0, $scribx+$xpos), rand(0, $scriby-$ypos), rand(0, $scriby), rand(0, $scribx), $kleur-$g);
+
}
+
+ imagettftext($img, $this->captcha_size(), $this->captcha_move(), $xpos, $ypos, $kleur, $this->captcha_font(), $t);
+ }
+ $stukje = $breedte / (strlen($code) + 3);
+
+ for($j = 0;$j < strlen($code); $j++)
+ {
+ $tek = $code[$j];
+ $ypos = rand(32,$hoogte-8);
+ $xpos = $stukje * ($j+2);
+
+ $kleur2 = imagecolorallocate($img, $this->captcha_color("tekst"), $this->captcha_color("tekst"), $this->captcha_color("tekst"));
+
+ imagettftext($img, $this->captcha_size(), $this->captcha_move(), $xpos, $ypos, $kleur2, $this->captcha_font() , $tek);
+ }
+
+
if ($image_format == 'gif')
+ imagegif($img, $tempFile);
+
else
+ imagepng($img, $tempFile);
+ imagedestroy($img);
+ }
+
+ /**
+ * Some functions :)
+ * Also orginally written by mastercode.nl
+ **/
+ /**
+ * Function to create a random color
+ * @auteur mastercode.nl
+ * @param $type string Mode for the color
+ * @return int
+ **/
+ function captcha_color($type)
+ {
+ switch($type)
+ {
+ case "bg":
+ $kleur = rand(224,255);
+ break;
+ case "tekst":
+ $kleur = rand(0,127);
+ break;
+ case "bgtekst":
+ $kleur = rand(200,224);
+ break;
+ default:
+ $kleur = rand(0,255);
+ break;
+ }
+ return $kleur;
+ }
+ /**
+ * Function to ranom the size
+ * @auteur mastercode.nl
+ * @return int
+ **/
+ function captcha_size()
+ {
+ $grootte = rand(24,32);
+ return $grootte;
+ }
+ /**
+ * Function to random the posistion
+ * @auteur mastercode.nl
+ * @return int
+ **/
+ function captcha_move()
+ {
+ $draai = rand(-25,25);
+ return $draai;
+ }
+ /**
+ * Function to return a ttf file from fonts map
+ * @auteur mastercode.nl
+ * @return string
+ **/
+ function captcha_font()
+ {
+ $f = @opendir(AUTHIMAGE_FONT_FOLDER);
+ $ar = array();
+ while(($file = @readdir($f)) !== false)
+ {
+ if(!in_array($file,array('.','..')) && eregi('.ttf',$file))
+ {
+ $ar[] = $file;
+ }
+ }
+ if(count($ar))
+ {
+ shuffle($ar);
+ $i = rand(0,(count($ar) - 1));
+ return AUTHIMAGE_FONT_FOLDER . $ar[$i];
+ }
+ }
+// twu2 20061016 end
+
}
?>
patch 可以到這兒抓:
http://www.teatime.com.tw/~tommy/mypatch/lifetype_authimage_better_captcha.patch
我修改了 generateCode() 的部份, 讓出現的字串為數字與大寫的英文字母, 但是把其中幾個比較容易弄錯的字母移除. 如果你想修改出現的字串, 請修改這個 function 內的 $hash 變數值就可以.
已記錄
Tommy 碎碎念...
jerome
新手見習
文章: 42
Re: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
回覆文章 #1 於:
十月 16, 2006, 08:13:17 下午 »
謝謝您!
晚一點試試看
已記錄
歡迎光臨,惡人最多之 BeB
http://beb.anyday.com.tw/
jerome
新手見習
文章: 42
Re: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
回覆文章 #2 於:
十月 16, 2006, 09:32:00 下午 »
twu2 所言的 字形,在這裡可以下載
http://sourceforge.net/project/showfiles.php?group_id=145622&package_id=187309
然後 twu2 兄改的,是 LT 1.1 版用的 AuthImage
不是 1.0x 用的
已記錄
歡迎光臨,惡人最多之 BeB
http://beb.anyday.com.tw/
twu2
初級會員
文章: 61
Re: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
回覆文章 #3 於:
十月 17, 2006, 07:25:15 上午 »
我記得 1.0 到 1.1 中間, plugins 的寫法只有一點點差別.
我改的部份應該是完全沒有動到那些部份. 應該 1.0 的也可以用才對.
已記錄
Tommy 碎碎念...
perlish
新手見習
文章: 19
Re: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
回覆文章 #4 於:
三月 11, 2007, 07:53:34 上午 »
不错的东西
现在spam真的很烦
已記錄
perlish
新手見習
文章: 19
Re: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
回覆文章 #5 於:
三月 11, 2007, 09:16:26 上午 »
1.0的貌似还真用着有问题
我手动patch了一下
之后发现下面错误
Call to undefined function: generateimageurl() in pluginauthimage.class.php on line 89
看来得下个1.1的imageauth回来把这个函数抠出来才行
«
最後編輯時間: 三月 11, 2007, 09:44:23 上午 由 perlish
»
已記錄
perlish
新手見習
文章: 19
Re: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
回覆文章 #6 於:
三月 11, 2007, 09:39:58 上午 »
补上缺少的函数后,还是有问题
Fatal error: Call to undefined function: imagettftext() in
十分奇怪
我下载了authimage 1.1 plugin和lt 1.1.6的代码包回来搜索,没有搜索到这个函数。
google搜索了一下,发现是php内置的函数,继续解决中……
已記錄
perlish
新手見習
文章: 19
Re: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
回覆文章 #7 於:
三月 11, 2007, 10:19:59 上午 »
编译php的时候加如下参数就好了
--with-gd
--enable-gd-native-ttf
--with-png
--with-zlib-dir=/usr/
--with-ttf
--with-jpeg-dir=/usr/
--with-freetype-dir=/usr/
--with-xpm-dir=/usr/X11R6/
这个是debian里的,其他发行版估计位置会不一样
感谢twu2的插件
已記錄
perlish
新手見習
文章: 19
Re: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
回覆文章 #8 於:
三月 11, 2007, 10:28:38 上午 »
这个是我改好的for 1.0的pluginauthimage.class.php文件,有需要的朋友可以直接拿来用了,数字1有时有点难看,我也去掉了
程式碼:
<?php
include_once(
PLOG_CLASS_PATH
.
"class/plugin/pluginbase.class.php"
);
include_once(
PLOG_CLASS_PATH
.
"class/plugin/pluginmanager.class.php"
);
include_once(
PLOG_CLASS_PATH
.
"class/dao/model.class.php"
);
include_once(
PLOG_CLASS_PATH
.
"class/net/rawrequestgenerator.class.php"
);
include_once(
PLOG_CLASS_PATH
.
"class/misc/glob.class.php"
);
include_once(
PLOG_CLASS_PATH
.
"plugins/authimage/class/security/authimagefilter.class.php"
);
define
(
"AUTHIMAGE_FILE"
,
"/plugins/authimage/authimage.php"
);
define
(
"AUTHIMAGE_BACKGROUND_FOLDER"
,
PLOG_CLASS_PATH
.
"plugins/authimage/backgrounds/"
);
// twu2 20061016 begin
define
(
"AUTHIMAGE_FONT_FOLDER"
,
PLOG_CLASS_PATH
.
"plugins/authimage/fonts/"
);
// twu2 20061016 end
/**
* Plugin that offers comment authentication image for current blog
* Original Author: Gudlyf http://www.gudlyf.com/index.php?p=376
* Modified by: Mark Wu
*/
class
PluginAuthImage
extends
PluginBase
{
var
$pluginEnabled
;
var
$default
;
var
$cacheFolder
;
function
PluginAuthImage
()
{
$this
->
PluginBase
();
$this
->
id
=
"authimage"
;
$this
->
author
=
"Mark Wu"
;
$this
->
desc
=
'This plugin offers extra comment authentication for pLog. The idea is inspired by <a href="http://www.gudlyf.com/index.php?p=376">WordPress AuthImage Plugin</a> written by Gudlyf.'
;
$this
->
locales
= Array(
"en_UK"
,
"zh_TW"
,
"zh_CN"
,
"es_ES"
);
$this
->
init
();
}
function
init
()
{
// register the filter
$this
->
registerFilter
(
"AuthImageFilter"
);
$this
->
registerAdminAction
(
"authimage"
,
"PluginAuthImageConfigAction"
);
$this
->
registerAdminAction
(
"updateAuthImageConfig"
,
"PluginAuthImageUpdateConfigAction"
);
$this
->
registerBlogAction
(
"AuthImageShow"
,
"PluginAuthImageShowAction"
);
$menu
=&
Menu
::
getMenu
();
if( !
$menu
->
entryExists
(
"/menu/controlCenter/manageAntiSpamPlugins"
))
$this
->
addMenuEntry
(
"/menu/controlCenter"
,
"manageAntiSpamPlugins"
,
""
,
""
,
true
,
false
);
$this
->
addMenuEntry
(
"/menu/controlCenter/manageAntiSpamPlugins"
,
"AuthImage"
,
"?op=authimage"
,
""
);
}
function
register
()
{
$config
=&
Config
::
getConfig
();
$this
->
cacheFolder
=
$config
->
getValue
(
'temp_folder'
);
$this
->
cacheFolder
=
$this
->
cacheFolder
.
'/authimage/'
.
$this
->
blogInfo
->
getId
();
if( !
File
::
exists
(
$this
->
cacheFolder
)) {
File
::
createDir
(
$this
->
cacheFolder
);
}
$blogSettings
=
$this
->
blogInfo
->
getSettings
();
$this
->
pluginEnabled
=
$blogSettings
->
getValue
(
"plugin_authimage_enabled"
);
$this
->
length
=
$blogSettings
->
getValue
(
"plugin_authimage_length"
);
$this
->
key
=
$blogSettings
->
getValue
(
"plugin_authimage_key"
);
$this
->
default
=
$blogSettings
->
getValue
(
"plugin_authimage_default"
);
}
function
isEnabled
()
{
return
$this
->
pluginEnabled
;
}
function
pluginTemplatePage
(
$template
)
{
$rg
= new
RawRequestGenerator
(
$this
->
blogInfo
);
$rg
->
addParameter
(
"op"
,
"AuthImageShow"
);
$rg
->
addParameter
(
"blogId"
,
$this
->
blogInfo
->
getId
());
$templatePage
=
$rg
->
getIndexUrl
().
$rg
->
getRequest
();
return
$templatePage
;
}
function
show
() {
$authImageUrl
=
$this
->
generateImageUrl
();
$authImage
=
$this
->
pluginTemplatePage
(
"authimage"
);
if (
$authImageUrl
)
return
'<img src="'
.
$authImageUrl
.
'" style="vertical-align:middle;" alt="authimage" />'
;
else
return
' you did not have gd support'
;
}
function
showImage
() {
// twu2 20061016 begin
$code
=
$this
->
generateCode
();
$encrypt
=
$this
->
encrypt
(
$code
,
$this
->
key
);
if (
function_exists
(
'ImageGIF'
) )
$image_format
=
'gif'
;
else
$image_format
=
'png'
;
$tempFile
=
$this
->
cacheFolder
.
"/"
.
$encrypt
.
"."
.
$image_format
;
$this
->
captcha_createimage
(
$code
,
$image_format
,
$tempFile
);
/* $code = $this->generateCode();
$encrypt = $this->encrypt($code, $this->key);
$background = AUTHIMAGE_BACKGROUND_FOLDER.$this->default;
$tempFile = $this->cacheFolder."/".$encrypt.".gif";
if(function_exists ( 'imagecreatefromgif' )){
$image = @imagecreatefromgif($background) or die("Cannot Initialize new GD image stream");
}
else if(function_exists ( 'imagecreatefrompng' )){
$image = @imagecreatefrompng($background) or die("Cannot Initialize new GD image stream");
} else {
die("Server doesn't support GIF or PNG creation. Sorry.");
}
$textColor = imageColorAllocate($image, 0x00, 0x00, 0x00);
ImageString($image, 5, 7, 2, $code, $textColor);
if ( !function_exists ( 'ImageGIF' ) ) {
ImagePNG($image, $tempFile);
} else {
ImageGIF($image, $tempFile);
} */
$temp
=
fopen
(
$tempFile
,
"rb"
);
$buffer
=
fread
(
$temp
,
filesize
(
$tempFile
));
fclose
(
$temp
);
// Now zero-length the file. No need for its content anymore.
$temp
=
fopen
(
$tempFile
,
"w"
);
fwrite
(
$temp
,
NULL
);
fclose
(
$temp
);
// Now chmod it so it can be deleted later by the user
chmod
(
$tempFile
,
0666
);
// twu2 20061016 begin
//header("Content-type: image/gif");
header
(
"Content-type: image/"
.
$image_format
);
// twu2 20061016 end
echo
$buffer
;
}
// encrypt string
function
encrypt
(
$string
,
$key
) {
$plainText
=
$string
.
$key
;
$encodeText
=
md5
(
$plainText
);
return
$encodeText
;
}
function
generateCode
() {
$code
=
""
;
// twu2 20061016 begin
//for($i=0; $i < $this->length; $i++) $code .= rand(0,9);
//$hash = "0123456789";
//$hash = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$hash
=
"03456789ABCDEFGHKMNPQRWXYZ"
;
$len
=
strlen
(
$hash
) -
1
;
for(
$i
=
0
;
$i
<
$this
->
length
;
$i
++)
$code
.=
$hash
[
rand
(
0
,
$len
)];
// twu2 20061016 end
return
$code
;
}
function
deleteExpiredAuthImage
(
$expiretime
) {
$path
=
PLOG_CLASS_PATH
.
$this
->
cacheFolder
;
if (
is_dir
(
$path
) )
{
$handle
=
opendir
(
$path
);
while (
false
!==(
$file
=
readdir
(
$handle
))) {
if (
$file
!=
"."
&&
$file
!=
".."
&&
$file
!=
"index.htm"
) {
$diff
=
time
() -
filectime
(
"
$path
/
$file
"
);
if (
$diff
>
$expiretime
)
unlink
(
"
$path
/
$file
"
);
}
}
closedir
(
$handle
);
}
}
// twu2 20061016 begin
function
captcha_createimage
(
$code
,
$image_format
,
$tempFile
)
{
$breedte
=
rand
(
256
,
384
);
$hoogte
=
rand
(
64
,
96
);
$img
=
imagecreatetruecolor
(
$breedte
,
$hoogte
);
$achtergrond
=
imagecolorallocate
(
$img
,
$this
->
captcha_color
(
"bg"
),
$this
->
captcha_color
(
"bg"
),
$this
->
captcha_color
(
"bg"
));
imagefilledrectangle
(
$img
,
0
,
0
,
$breedte
-
1
,
$hoogte
-
1
,
$achtergrond
);
$hash
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
;
$hash_len
=
strlen
(
$hash
);
for(
$g
=
0
;
$g
<
30
;
$g
++)
{
$t
=
$hash
[
rand
(
0
,
$hash_len
)];
$ypos
=
rand
(
0
,
$hoogte
);
$xpos
=
rand
(
0
,
$breedte
);
$kleur
=
imagecolorallocate
(
$img
,
$this
->
captcha_color
(
"bgtekst"
),
$this
->
captcha_color
(
"bgtekst"
),
$this
->
captcha_color
(
"bgtekst"
));
if (!(
$g
%
2
))
{
$scribx
=
rand
(
0
,(
$breedte
*
2
));
$scriby
=
rand
(
0
,(
$hoogte
*
2
));
$wibblex
=
rand
(
0
,(
$breedte
*
2
));
$wibbley
=
rand
(
0
,(
$hoogte
*
2
));
imageline
(
$img
,
rand
(
0
,
$scribx
-
$xpos
),
rand
(
0
,
$scriby
+
$ypos
),
rand
(
0
,
$wibblex
),
rand
(
0
,
$wibbley
),
$kleur
+
$g
);
imageellipse
(
$img
,
rand
(
0
,
$scribx
+
$xpos
),
rand
(
0
,
$scriby
-
$ypos
),
rand
(
0
,
$scriby
),
rand
(
0
,
$scribx
),
$kleur
-
$g
);
}
imagettftext
(
$img
,
$this
->
captcha_size
(),
$this
->
captcha_move
(),
$xpos
,
$ypos
,
$kleur
,
$this
->
captcha_font
(),
$t
);
}
$stukje
=
$breedte
/ (
strlen
(
$code
) +
3
);
for(
$j
=
0
;
$j
<
strlen
(
$code
);
$j
++)
{
$tek
=
$code
[
$j
];
$ypos
=
rand
(
32
,
$hoogte
-
8
);
$xpos
=
$stukje
* (
$j
+
2
);
$kleur2
=
imagecolorallocate
(
$img
,
$this
->
captcha_color
(
"tekst"
),
$this
->
captcha_color
(
"tekst"
),
$this
->
captcha_color
(
"tekst"
));
imagettftext
(
$img
,
$this
->
captcha_size
(),
$this
->
captcha_move
(),
$xpos
,
$ypos
,
$kleur2
,
$this
->
captcha_font
() ,
$tek
);
}
if (
$image_format
==
'gif'
)
imagegif
(
$img
,
$tempFile
);
else
imagepng
(
$img
,
$tempFile
);
imagedestroy
(
$img
);
}
/**
* Some functions :)
* Also orginally written by mastercode.nl
**/
/**
* Function to create a random color
* @auteur mastercode.nl
* @param $type string Mode for the color
* @return int
**/
function
captcha_color
(
$type
)
{
switch(
$type
)
{
case
"bg"
:
$kleur
=
rand
(
224
,
255
);
break;
case
"tekst"
:
$kleur
=
rand
(
0
,
127
);
break;
case
"bgtekst"
:
$kleur
=
rand
(
200
,
224
);
break;
default:
$kleur
=
rand
(
0
,
255
);
break;
}
return
$kleur
;
}
/**
* Function to ranom the size
* @auteur mastercode.nl
* @return int
**/
function
captcha_size
()
{
$grootte
=
rand
(
24
,
32
);
return
$grootte
;
}
/**
* Function to random the posistion
* @auteur mastercode.nl
* @return int
**/
function
captcha_move
()
{
$draai
=
rand
(-
25
,
25
);
return
$draai
;
}
function
generateImageUrl
()
{
$rg
= new
RawRequestGenerator
(
$this
->
blogInfo
);
$rg
->
addParameter
(
"op"
,
"AuthImageShow"
);
$rg
->
addParameter
(
"blogId"
,
$this
->
blogInfo
->
getId
());
$imageUrl
=
$rg
->
getIndexUrl
().
$rg
->
getRequest
();
if ( !
function_exists
(
'gd_info'
) ) {
// We don't have gd support compiled in, lets
// inform the user about it
return
false
;
}
return
$imageUrl
;
}
/**
* Function to return a ttf file from fonts map
* @auteur mastercode.nl
* @return string
**/
function
captcha_font
()
{
$f
= @
opendir
(
AUTHIMAGE_FONT_FOLDER
);
$ar
= array();
while((
$file
= @
readdir
(
$f
)) !==
false
)
{
if(!
in_array
(
$file
,array(
'.'
,
'..'
)) &&
eregi
(
'.ttf'
,
$file
))
{
$ar
[] =
$file
;
}
}
if(
count
(
$ar
))
{
shuffle
(
$ar
);
$i
=
rand
(
0
,(
count
(
$ar
) -
1
));
return
AUTHIMAGE_FONT_FOLDER
.
$ar
[
$i
];
}
}
// twu2 20061016 end
}
?>
已記錄
jerome
新手見習
文章: 42
Re: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
回覆文章 #9 於:
三月 11, 2007, 01:23:30 下午 »
引用自: perlish 於 三月 11, 2007, 10:28:38 上午
这个是我改好的for 1.0的pluginauthimage.class.php文件,有需要的朋友可以直接拿来用了,
謝謝您!
已記錄
歡迎光臨,惡人最多之 BeB
http://beb.anyday.com.tw/
perlish
新手見習
文章: 19
Re: 修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
«
回覆文章 #10 於:
三月 12, 2007, 07:52:30 上午 »
不客气的
纯粹的体力活 :)
已記錄
頁:
[
1
]
列印
LifeType 中文開發論壇
|
開發
|
外掛程式
|
修改 LifeType 的 AuthImage, 使用 Better Captcha 的圖形
« 上篇主題
下篇主題 »
前往:
請選擇目的地:
-----------------------------
站務
-----------------------------
=> 站務公告
=> 站務建議
=> 帳號與文章刪除
-----------------------------
支援
-----------------------------
=> 安裝與設定
=> 使用與操作
=> 虛擬主機討論
=> Instant LifeType 專區
===> 安裝與設定精華區
===> 使用與操作精華區
===> 虛擬主機討論精華區
===> 虛擬主機商自我推薦區
===> Instant LifeType 精華區
-----------------------------
開發
-----------------------------
=> 外掛程式
=> 模版設計
=> 核心補強
=> 手冊文件
=> 中文相關
===> 外掛程式精華區
===> 模版發表
===> 模版設計精華區
===> 核心補強精華區
===> 手冊文件精華區
===> 中文相關精華區
-----------------------------
測試
-----------------------------
=> LifeType 1.0 測試
=> LifeType 1.1 測試
-----------------------------
部落格應用
-----------------------------
=> 教育部落格
-----------------------------
建議
-----------------------------
=> 要求與建議
=> 發表與交流
=> 網誌文化與業界動態
Powered by SMF 1.1.6
|
SMF © 2006-2008, Simple Machines LLC
載入...