得到2010数据库技术大会门票 (2010-03-30)
今天有幸得到了2010数据库技术大会的门票
虽然属于B类票,但是市场价1000元的门票还是很有诱惑力的!
免费得到 呵呵~~~
特别兴奋,期待已久了,那里面全是腕儿!
不知道4.2日和4.3日有没有时间呢
正好是这周五和这周六。
估计还要请假
反正很想去听课
还很想去吃免费的自助午餐^_^

作为一名coder,此刻我内牛满面 (2010-03-26)
作为一名coder,此刻我内牛满面
转自youku.com:
(十点了,不知道你的code写到了那一行)
从未想过,这些符号,会让人如此着迷
兴奋...高兴...沉默...忧郁...
写code是他的快乐,看code成了我的快乐
喜欢他的认真,却不想他总给自己找压力
(现在你是不是又在跟code较劲啊)
(如果可能我来做你下一行的code好不好)
心酸 (2010-03-21)
今天特别心酸,
本来今天才是妈的生日
周五回家算是给妈妈过了个简单的生日
只买了一些她爱吃菜回去.
今天他们也因为工作没有来
下午看着妈从菜市场买了一些菜回家
手里还提着一兜鸡蛋糕
说是比较便宜,才三块钱一斤
还拿出一个给我吃
当时就觉得心理不好受,很酸
我连一个生日蛋糕也没给妈买
根本没尽到一个做儿子的义务...
等明年的二月初六要好好给妈过一次生日!
封装PHP验证码类 (2010-03-05)
PHP验证码是很常见的应用
下面是一段封装好的类库
方便以后使用
总结一下核心函数:
imagecreate 创建图像;
imagecolorallocate 为图像上色
imagerectangle 创建矩形
imagestring 画字符串
imageline 生成干扰线
imagejpeg 生成JPEG格式
imagedestroy 催婚图像
-
<?php
-
session_start();
-
class checkImage {
-
-
private $config;
-
private $im;
-
private $str;
-
-
function __construct() {
-
$this->config['width'] = 50;
-
$this->config['height'] = 20;
-
$this->config['vcode'] = "vcode";
-
$this->config['type'] = "default";
-
$this->config['length'] = 4;
-
$this->config['interfere'] = 10;
-
$this->str['default'] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
$this->str['string'] = "abcdefghijklmnopqrstuvwxyz";
-
$this->str['int'] = "0123456789";
-
}
-
-
public function init($config=array()){
-
if (!empty($config) && is_array($config)){
-
foreach($config as $key=>$value){
-
$this->config[$key] = $value;
-
}
-
}
-
}
-
-
public function create(){
-
if (!function_exists("imagecreate")){
-
return false;
-
}
-
$this->createImage();
-
}
-
-
private function createImage(){
-
$this->im = imagecreate($this->config['width'],$this->config['height']);
-
imagecolorallocate($this->im, 255, 255, 255);
-
-
$bordercolor= imagecolorallocate($this->im,0,0,0);
-
imagerectangle($this->im,0,0,$this->config['width']-1,$this->config['height']-1,$bordercolor);
-
-
$this->createStr();
-
$vcode = $_SESSION[$this->config['vcode']];
-
$fontcolor = imagecolorallocate($this->im,46,46,46);
-
for($i=0;$i<$this->config['length'];$i++){
-
imagestring($this->im,5,$i*10+6,rand(2,5),$vcode[$i],$fontcolor);
-
}
-
-
$interfere = $this->config['interfere'];
-
$interfere = $interfere>30?"30":$interfere;
-
if (!empty($interfere) && $interfere>1){
-
for($i=1;$i<$interfere;$i++){
-
$linecolor = imagecolorallocate($this->im,rand(0,255),rand(0,255),rand(0,255));
-
$x = rand(1,$this->config['width']);
-
$y = rand(1,$this->config['height']);
-
$x2 = rand($x-10,$x+10);
-
$y2 = rand($y-10,$y+10);
-
imageline($this->im,$x,$y,$x2,$y2,$linecolor);
-
}
-
}
-
header("Pragma:no-cachern");
-
header("Cache-Control:no-cachern");
-
header("Expires:0rn");
-
header("content-type:image/jpegrn");
-
imagejpeg($this->im);
-
imagedestroy($this->im);
-
exit;
-
}
-
-
private function createStr(){
-
if ($this->config['type']=="int"){
-
for($i=1;$i<=$this->config['length'];$i++){
-
$vcode .= rand(0,9);
-
}
-
$_SESSION[$this->config['vcode']] = $vcode;
-
return true;
-
}
-
$len = strlen($this->str[$this->config['type']]);
-
if (!$len){
-
$this->config['type'] = "default";
-
$this->create_str();
-
}
-
for($i=1;$i<=$this->config['length'];$i++){
-
$offset = rand(0,$len-1);
-
$vcode .= substr($this->str[$this->config['type']],$offset,1);
-
}
-
$_SESSION[$this->config['vcode']] = $vcode;
-
return true;
-
}
-
-
}
-
-
$v = new checkImage();
-
//$config['width'] = 50; //验证码宽
-
//$config['height'] = 20; //验证码高
-
//$config['vcode'] = "vcode"; //检查验证码时用的SESSION
-
//$config['type'] = "int"; //验证码展示的类型default:大写字母,string:小写字母,int:数字
-
//$config['length'] = 2; //验证码长度
-
//$config['interfere']= 10; //干扰线强度,范围为1-30,0或空为不起用干扰线
-
//$v->init($config); //配置
-
$v->create();
-
-
?>
-
-
<SCRIPT LANGUAGE="JavaScript">
-
<!--
-
function reloadcode(){
-
var d = new Date();
-
document.getElementById('safecode').src="./vcode.php?t="+d.toTimeString()
-
}
-
//-->
-
</SCRIPT>
-
-
<img src="vcode.php" id="safecode" onclick="reloadcode()">










先进 了。。。