📄 view_datapic.php
字号:
<?header("Content-type: image/png");include_once("../public/config.inc.php");/*$cuday=(empty($_REQUEST["viewday"]))?date("Y-m-d"):$_REQUEST["viewday"];if(empty($_REQUEST["viewday"])){ $filename_date=date("Y_m_d");}else{ $filename_date=eregi_replace("-","_",$_REQUEST["viewday"]);}$str_info=($_REQUEST["op"]=="click")?"点击":"弹出";if(!empty($_SESSION["admin_username"]) && !empty($_REQUEST["adsername"])){ $filename="../data/adser/$_REQUEST[adsername]/$_REQUEST[op]_$_REQUEST[adsid]/$filename_date";}else{ $filename="../data/adser/$_SESSION[adser_username]/$_REQUEST[op]_$_REQUEST[adsid]/$filename_date";}$flag_exist=0;for($i=0;$i<24;$i++){ if($i<10){ $si="0".$i; }else{ $si=$i; } $s_filename=$filename."_$si.txt"; if(file_exists($s_filename)){ $flag_exist=1; $data=file($s_filename); $k[$i]=count($data); }}*/$cuday=(empty($_REQUEST["viewday"]))?date("Y-m-d"):$_REQUEST["viewday"];if(!empty($_REQUEST["str"])){ $strnum=base64_decode($_REQUEST["str"]); $k=explode("|",$strnum);}$max_height=max($k);if($max_height==0){ exit();}$avg=round($max_height/5*100)/100;$arr_num=array($max_height,$avg*4,$avg*3,$avg*2,$avg);while(list($i,$v)=each($k)){ $graphValues[$i]=$v/$max_height*$cfg_gdheight;}$intday=strtotime($cuday);//$strday=date("",$intday);//添加图形的值//$graphValues=array(33,68,250,46,2,89,167,33,68,250,46,2,89,167,33,68,250,46,2,89,167);// Define .PNG image$imgWidth=$cfg_gdwidth;$imgHeight=50 + $cfg_gdheight;//创建图像、定义颜色$image=imagecreate($imgWidth, $imgHeight);$colorWhite=imagecolorallocate($image, $cfg_gdbgcolor["R"], $cfg_gdbgcolor["G"], $cfg_gdbgcolor["B"]);$colorGrey=imagecolorallocate($image, $cfg_gdgridcolor["R"], $cfg_gdgridcolor["G"], $cfg_gdgridcolor["B"]);$colorstr=imagecolorallocate($image, $cfg_gdshadowcolor["R"], $cfg_gdshadowcolor["G"], $cfg_gdshadowcolor["B"]);$colorstr1=imagecolorallocate($image, $cfg_gdrimcolor["R"], $cfg_gdrimcolor["G"], $cfg_gdrimcolor["B"]);$colorstr2=imagecolorallocate($image, $cfg_gdbtextcolor["R"], $cfg_gdbtextcolor["G"], $cfg_gdbtextcolor["B"]);$colorstr3=imagecolorallocate($image, $cfg_gdnumcolor["R"], $cfg_gdnumcolor["G"], $cfg_gdnumcolor["B"]);$colorBlue=imagecolorallocate($image, 0, 100, 255);$colorred=imagecolorallocate($image, $cfg_gdcurvecolor["R"], $cfg_gdcurvecolor["G"], $cfg_gdcurvecolor["B"]);$colorBlack=imagecolorallocate($image, $cfg_gdnumsufcolor["R"], $cfg_gdnumsufcolor["G"], $cfg_gdnumsufcolor["B"]);//创建网格for ($i=1; $i<=23; $i++){//坚线 $ii=($i<10)?"0".$i:$i; imageline($image, $i*($cfg_gdwidth-50)/23+10, 0, $i*($cfg_gdwidth-50)/23+10, $cfg_gdheight, $colorGrey); imageline($image, $i*($cfg_gdwidth-50)/23+10, $cfg_gdheight-5, $i*($cfg_gdwidth-50)/23+10, $cfg_gdheight-1, $colorstr1); imagestring($image, 2, $i*($cfg_gdwidth-50)/23+5, 3+$cfg_gdheight, "$ii", $colorBlack);}$j=0;for ($i=1; $i<10; $i++){//横线 imageline($image, 11, $i*$cfg_gdheight/10, $cfg_gdwidth-42, $i*$cfg_gdheight/10, $colorGrey); imageline($image, 11, $i*$cfg_gdheight/10, 13, $i*$cfg_gdheight/10, $colorstr1); if($i % 2 == 1 && $i!=1){ imagestring($image, 2, 17, $i*$cfg_gdheight/10-$cfg_gdheight/10-7, "$arr_num[$j]", $colorBlack); $j++; }elseif($i % 2 == 1 && $i==1){ imagestring($image, 2, 17, 0, "$arr_num[$j]", $colorBlack); $j++; }}//创建图像周围的框imageline($image, 10, 0, 10, $cfg_gdheight, $colorstr1);imageline($image, 10, 0, $cfg_gdwidth-40, 0, $colorstr1);imageline($image, $cfg_gdwidth-40, 0, $cfg_gdwidth-40, $cfg_gdheight, $colorstr1);imageline($image, 10, $cfg_gdheight, $cfg_gdwidth-40, $cfg_gdheight, $colorstr1);//创建折线图for ($i=0; $i<=23; $i++){ if($i<23){ imageline($image, $i*($cfg_gdwidth-50)/23+10, ($cfg_gdheight-$graphValues[$i]), ($i+1)*($cfg_gdwidth-50)/23+10, ($cfg_gdheight-$graphValues[$i+1]), $colorred); } $nh=$cfg_gdheight-12-$graphValues[$i]; if($nh<0){$nh=0;} imagestring($image, 2, $i*($cfg_gdwidth-50)/23+14,$nh, "$k[$i]", $colorstr3);}imagestring($image, 2, 5, $cfg_gdheight+3, "00", $colorBlack);imagestring($image, 3, $cfg_gdwidth-62-40,$cfg_gdheight+29, "$cuday", $colorstr);imagestring($image, 3, $cfg_gdwidth-63-40,$cfg_gdheight+28, "$cuday", $colorstr1);//imagefilledrectangle($image,10,0,40,$cfg_gdheight, $colorBlack);imagestring($image, 5, 6,$cfg_gdheight+26, "http://$cfg_site_url", $colorstr);imagestring($image, 5, 5,$cfg_gdheight+25, "http://$cfg_site_url", $colorstr1);/*imagettftext($image, 14, 90, 30, $cfg_gdheight-7, $colorstr2, "../public/ariblk.ttf", "$cfg_gdbigtext");imagettftext($image, 12, 0, 46, $cfg_gdheight+41, $colorstr, "../public/ariblk.ttf", "http://$code_host_name");imagettftext($image, 12, 0, 45, $cfg_gdheight+40, $colorstr1, "../public/ariblk.ttf", "http://$code_host_name");*///输出图形并清楚内存中的图像imagepng($image);imagedestroy($image);?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -