|
楼主 |
发表于 2009-1-1 21:47:46
|
显示全部楼层
- <?php
- header("content-type:image/gif");
- $uid=$_GET["uid"];
- include_once('data/sql_config.php');
- $dbh = mysql_connect("$dbhost:3306","$dbuser",$dbpw);
- mysql_select_db($dbname);
- $w = 100;
- $h = 12;
- $query ="select * from ".$PW."members where uid=$uid";
- $res = mysql_query($query, $dbh);
- $info =& mysql_fetch_array($res,MYSQL_ASSOC);
- $query ="select * from ".$PW."memberdata where uid=$uid";
- $res = mysql_query($query, $dbh);
- $date =& mysql_fetch_array($res,MYSQL_ASSOC);
- $query ="select value from ".$PW."membercredit where uid=$uid and cid=1";
- $res = mysql_query($query, $dbh);
- $credit=& mysql_fetch_array($res,MYSQL_ASSOC);
- $mid=$info['memberid']+1;
- $query ="select grouppost from ".$PW."usergroups where gid=$mid";
- $res = mysql_query($query, $dbh);
- $group=& mysql_fetch_array($res,MYSQL_ASSOC);
- $usercredit=0.3*$date['postnum']+20*$date['digests']+0.5*$date['rvrc']+$credit['value'];
- $level=$group['grouppost'];
- $im=ImageCreate($w,$h);
- $temp=ImageCreate($w,$h);
- $color=ImageColorAllocate($im,255,255,255);
- ImageFill($im,0,0,$color);
- ImageColorTransparent($im,$color);
- $color2=ImageColorAllocate($im,0,0,0);
- $prec=$usercredit/$level;
- $ove=ImageColorAllocate($im,255,0,0);
- switch ($info['groupid']){
- case 3:
- $ove=ImageColorAllocate($im,255,100,50);
- break;
- case 4:
- $ove=ImageColorAllocate($im,30,50,255);
- break;
- case 5:
- $ove=ImageColorAllocate($im,255,255,30);
- break;
- case 6:
- $ove=ImageColorAllocate($im,150,155,155);
- break;
- case 16:
- $ove=ImageColorAllocate($im,255,50,255);
- break;
- default:
- $ove=ImageColorAllocate($im,50,255,50);
- break;
- }
- for($i=0;$i<$w*$prec;$i++){
- for($j=0;$j<$h;$j++){
- imagesetpixel($im,$i,$j, $ove);
- }
- }
- $size = 10;
- $font = "C:\\\\WINDOWS\\\\Fonts\\\\msyh.ttf";
- $text = "$usercredit/$level";
- $text = iconv("GB2312","UTF-8",$text);
- imagettftext($im,$size,0,3*mb_strlen($text),12,$color2,$font,$text);
- Imagegif($im);
- ImageDestroy($im);
- ?>
复制代码 |
|