Verification code class in PHP (one of the verification code function design)

Source: Internet
Author: User

<!--vcode.class.php Content--

<?php
Class Vcode {
Private $width; Wide
Private $height; High
Private $num; Number
Private $code; Verification Code

Construction method, three parameters
function __construct ($width, $height, $num) {
$this->width = $width;
$this->height = $height;
$this->num = $num;
$this->code = $this->createcode (); Call your own method
}

Gets the verification code for the character to be saved in the server
function GetCode () {
return $this->code;
}

Output image
function outimg () {
Create background (color, size, border)
$this->createback ();

stooped (size, font color)


Interference elements (points, lines)

Output image
}

Create a background
Private Function Createback () {

}

Stooped
Private Function outstring () {

}

Setting interference elements
Private Function Setdisturbcolor () {

}

Output image
Private Function printimg () {

}

Generate Authenticode String
Private Function Createcode () {
$codes = "3456789abcdefghijkmnpqrstuvwxyABCDEFGHIJKLMNPQRSTUVWXY";

$code = "";

for ($i =0; $i < $this->num; $i +) {
return random characters
$code. = $codes {rand (0, strlen ($codes)-1)};
}

return $code;
}

}

Verification code class in PHP (one of the verification code function design)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.