| new Captcha () | ใช้สร้าง Object ของ Library Captcha |
|---|---|
| render() | ใช้คืนค่า captcha |
| valid() | ใช้ตรวจสอบว่าค่าที่ post มาตรงกับ captcha หรือไม่ |
| valid_count() | ใช้กำหนดค่า หรือ คืนค่า ว่ามีการ valid แล้วทั้งหมดกี่ครั้ง |
| invalid_count() | ใช้กำหนดค่า หรือ คืนค่า ว่ามีการ invalid แล้วทั้งหมดกี่ครั้ง |
| reset_count() | ใช้ล้าง session ของการนับจำนวน valid และ in-valid |
| การกำหนด ลักษณะของ captcha | ให้กำหนดใน folder "system/config/captcha.php" |
| style | ใช้กำหนดรูปแบบของ captcha โดยมีค่าที่เป็นไปได้ คือ basic, alpha, word, math, riddle |
| width | ใช้กำหนด ความกว้าง ของ captcha |
| height | ใช้กำหนด ความสูง ของ captcha |
| complexity | ใช้กำหนด จำนวนตัวอักษร ของ captcha |
| fontpath | ใช้กำหนด path ของ font ที่จะใช้ใน captcha |
method:new Captcha ();
return type:Object
content:ใช้สร้าง Object ของ Library Captcha
example:$captcha = new Captcha ();
method:render ();
return type:string
content:ใช้คืนค่า captcha
example:$captcha = new Captcha (); echo $captcha->render ();
method:valid ( key_post );
return type:boolean
content:ใช้ตรวจสอบว่าค่าที่ post มาตรงกับ captcha หรือไม่
example:$captcha = new Captcha (); if ( $captcha->valid ( "1234" ) ) { echo "validate captcha"; }
method:valid_count ( new_count, invalid );
return type:void, int
content:ใช้กำหนดค่า ( ในกรณีที่ new_count ไม่เท่ากับ null ) หรือคืนค่า ( ในกรณีที่ไม่กำหนดค่า new_count ) ว่ามีการ valid แล้วทั้งหมดกี่ครั้ง ( ถูกเก็บใน session )
example:$captcha = new Captcha (); $num_valid = $captcha->valid_count ();
method:invalid_count ( new_count, invalid );
return type:void, int
content:ใช้กำหนดค่า ( ในกรณีที่ new_count ไม่เท่ากับ null ) หรือคืนค่า ( ในกรณีที่ไม่กำหนดค่า new_count ) ว่ามีการ in-valid แล้วทั้งหมดกี่ครั้ง ( ถูกเก็บใน session )
example:$captcha = new Captcha (); $num_invalid = $captcha->invalid_count ();
method:reset_count ();
return type:void
content:ใช้ล้าง session ของการนับจำนวน valid และ in-valid
example:$captcha = new Captcha (); $captcha->reset_count ();
subject:การกำหนด ลักษณะของ captcha
content:การกำหนด ลักษณะของ captcha ให้กำหนดใน folder "system/config/captcha.php"
variable:$config["default"]["style"] = value;
return type:void
content:ใช้กำหนดรูปแบบของ captcha โดยมีค่าที่เป็นไปได้ คือ basic, alpha, word, math, riddle
example:$config["default"]["style"] = "math";
variable:$config["default"]["width"] = value;
return type:void
content:ใช้กำหนด ความกว้าง ของ captcha
example:$config["default"]["width"] = "150";
variable:$config["default"]["height"] = value;
return type:void
content:ใช้กำหนด ความสูง ของ captcha
example:$config["default"]["height"] = "50";
variable:$config["default"]["complexity"] = value;
return type:void
content:ใช้กำหนด จำนวนตัวอักษร ของ captcha
example:$config["default"]["complexity"] = 4;
variable:$config["default"]["fontpath"] = value;
return type:12
content:ใช้กำหนด path ของ font ที่จะใช้ใน captcha
example:$config["default"]["fontpath"] = APPPATH."/font.ttf";