img_rand.php
来自「bbs server linux平台下软件源码」· PHP 代码 · 共 41 行
PHP
41 行
<?php// numric auth. hehe.. by hightman@hightman.net// $Id: img_rand.php,v 1.1 2003/07/09 03:47:55 kcn Exp $$radix = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";$maxlen = 4;mt_srand();$fpath = "img_rand/" . mt_rand(0, 6) . ".jpg";$font = $_SERVER['DOCUMENT_ROOT'] . "/test/font_rand/" . mt_rand(0, 18) . ".ttf";$im = ImageCreateFromJPEG($fpath); // width=200 height=10$color = ImageColorAllocate($im, 0, 0, 0);$len = $maxlen;$bwidth = 200 / $maxlen;$rand_str = "";while ($len) { $len --; $i = mt_rand(0, 34); $j = mt_rand(20, 30); $x = 170 - $len * $bwidth; $y = 15 + $j; $angle = $i - 15; Imagettftext($im, $j, $i - 15, $x, $y, $color, $font, $radix[$i]); $rand_str .= $radix[$i];}session_set_cookie_params(3600);session_start();$_SESSION['num_auth'] = str_replace(" ", "", $rand_str);header("Content-Type: image/jpeg");ImagePng($im);ImageDestroy($im);exit();?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?