gusucode.com > weenCompany闻名企业网站系统 4.0.0 繁体中英文 UTF8源码程序 > includes/vvc.php
<?php define('IN_WEENCOMPANY', true); $rootpath = "../"; // ########################### LOAD WEENCOMPANY CORE ############################ include($rootpath . 'includes/core.php'); // ################################ FETCH VVCID ################################ $vvcid = isset($_POST['vvcid']) ? $_POST['vvcid'] : (isset($_GET['vvcid']) ? $_GET['vvcid'] : null); if(isset($vvcid) && is_numeric($vvcid)) { $verification_code = $DB->query_first("SELECT verifycode FROM " . TABLE_PREFIX . "vvc WHERE vvcid = $vvcid"); if(strlen($verification_code[0]) > 0) { /*header*/ Header("Content-Type: image/png"); $imwidth = 220; $imheight = 40; /* set up image, the first number is the width and the second is the height */ $im = ImageCreate($imwidth, $imheight); $background_color = ImageColorAllocate ($im, 255, 255, 255); $text_color = ImageColorAllocate ($im, 160, 119, 6); $border_color = ImageColorAllocate ($im, 154, 154, 154); //strip any spaces that may have crept in //end-user wouldn't know to type the space! :) $code = str_replace(" ", "", $verification_code[0]); $x=0; $stringlength = strlen($code); for ($i = 0; $i< $stringlength; $i++) { $x = $x + (rand (8, 35)); $y = rand (2, 10); $font = rand (2,25); $single_char = substr($code, $i, 1); imagechar($im, $font, $x, $y, $single_char, $text_color); } imagerectangle ($im, 2, 2, $imwidth-2, $imheight-2, $border_color); /* output to browser*/ ImagePNG($im); ImageDestroy($im); } } ?>