| wb's profileηщъBlogListsNetwork | Help |
ηщъ流水空空.... |
September 01 决定把空间转移了,放到个人空间去了空人空间 转移了,转到 http://www.33505.net ,MSN的空间太慢,自主性太差,最主要的是,BAIDU,GOOGLE不收录.让这里荒芜,也许10年后再回到这里,夕阳西下,放眼杂草丛生,是否还能回忆起什么. August 24 常用表单验证类,验证EMAIL地址,电话号码等//常用表单验证类 //验证是否为指定长度数字 //验证邮件地址 // 数据入库 转义 特殊字符 传入值可为字符串 或 一维数组 // 数据出库 还原 特殊字符 传入值可为字符串 或 一/二维数组 // 数据显示 还原 数据格式 主要用于内容输出 传入值可为字符串 或 一/二维数组 August 20 php无乱码截取中文字符的函数当用 substr 截取中文字符的时候会出现乱码,当然你如果装了 mb 扩展 用 mb_substr截取就不会出现这种问题,如果你用的是虚拟主机,主机上又没装 mb扩展的话,你可以用下面的函数截取
# Cut chinese string into appointed length
# @param [string] string need deal # @param [start] position to cut from # @param [length] length to cut # @return string function GBsubstr($string, $start, $length) { if(strlen($string)>$length){ $str=null; $len=$start+$length; for($i=$start;$i<$len;$i++){ if(ord(substr($string,$i,1))>0xa0){ $str.=substr($string,$i,2); $i++; }else{ $str.=substr($string,$i,1); } } return $str.'...'; }else{ return $string; } } August 08 MagickWand fro php功能齐全的一个例子<?php /* * Description: The following script demonstrates the inate capabilities of /* General Settings */ $noise_frames = 5; $cnt_down_start = 3; $x_int = $width / 10; $font_size = 30; $swirl_deg_start = 0; $num_morph_frames = 5; /* The number of intermediary frames between images to $logo = 'MagickWand for PHP'; /* The 1st string to be displayed */ $welcome_msg = 'The future awaits...'; /* The 2nd string to be displayed */ $mgck_wnd = NewMagickWand(); /* Create a new MagickWand resource -- "holds" $bg_color= NewPixelWand(); /* Creates a new PixelWand resource -- contains $white = NewPixelWand('white'); /* Does the same as above, except that the $pxl_wnd = NewPixelWand(); $drw_wnd = NewDrawingWand(); /* Creates a new DrawingWand resource -- holds $txt_wnd = NewDrawingWand(); /* The user function checkWandError() checks the return type of API functions for checkWandError(MagickNewImage($mgck_wnd, $width, $height, $bg_color), $mgck_wnd, __LINE__); checkWandError(MagickAddNoiseImage($mgck_wnd, MW_LaplacianNoise), $mgck_wnd, __LINE__); checkWandError(MagickSetImageDelay($mgck_wnd, $noise_delay), $mgck_wnd, __LINE__); /* Retrieve the current image from $mgck_wnd in a new MagickWand, and assign /* Set variables to random values between 0 and 255, for use in an /* Use color values from above to form an ImageMagick color string RGB triple, /* Set the fill color (the color in which shapes and text will be drawn), to /* Add a command to draw a rounded rectangle to the $drw_wnd DrawingWand /* Create a new image, in $pre_morph_wnd, of $width * $height area, with /* Morph the images in $pre_morph_wnd, set their displaytime, and and add /* Free the resources associated with $pre_morph_wnd, since it is no longer /* Set the current active image, in $mgck_wnd's image squence, to the last image. /* Starting from $i = $cnt_down_start, (with $i being decreased by one at each /* Set the PixelWand $pxl_wnd's color to that of the ImageMagick color /* Add commands to draw a $pxl_wnd colored rounded rectangle to $drw_wnd */ $red = mt_rand(0, 255); /* Decrease the size of the next rounded rectange to be drawn */ $x2 -= $x_int; /* Create a new image in $mgck_wnd, and draw $drw_wnd on it */ /* Add commands to draw $i in $white colored text $font_size, horizontally /* Draw $txt_wnd on the just created image in the $mgck_wnd MagickWand */ /* Clear the $txt_wnd DrawingWand of any accumulated commands, and reset the /* Add commands to draw $i, (which now holds a value that is 1 less than the /* Draw $drw_wnd on a new image in $mgck_wnd */ /* The following loop creates a set of images which, when set as animation /* create a new image, draw $drw_wnd on it, set its display time to /* and perform the swirl special effect on it at $swirl_deg. */ /* Following loop ensures that $font_size is */ /* Set the text font size used by $txt_wnd to $font_size */ /* MagickGetStringWidth() returns the width of the specified strings /* If the widths of both strings are within the acceptable limits, end /* Otherwise, decrement the $font_size */ /* Retrieve the current image from $mgck_wnd in a new MagickWand, and assign /* Add commands to the $txt_wnd DrawingWand to draw the $logo string in $white /* Clear $txt_wnd's command list and reset its settings */ /* Draw $welcome_msg in $white at $font_size on another new image in /* Add the first image in $mgck_wnd to $pre_morph_wnd. */ /* Morph the images in $pre_morph_wnd and add them to the end of $mgck_wnd's /* Free the resources associated with $pre_morph_wnd, $drw_wnd and $txt_wnd, /* Sets the output format of $mgck_wnd's image sequence to GIF */ /* Retrieves the mime-type associated with $mgck_wnd's image sequence, and /* Outputs $mgck_wnd's image sequence as a BLOB (Binary Large Object) */ /* Free the resources associated with $mgck_wnd */
if ($result === FALSE && WandHasException($wand)) { return $result; /** /* Set the color used to draw shapes and text with $drw_wnd to $pxl_wnd's /* Set the text font size used by $drw_wnd to $font_size */ /* Set $drw_wnd text gravity (automatic text positioning setting), to /* Add a command to the $drw_wnd DrawingWand to draw the $text string at /** $line = 'program line '.$line.', function line '; checkWandError(MagickNewImage($mgck_wnd, $width, $height, $bg_color), $mgck_wnd, $line.__LINE__); /** drawNewImage($mgck_wnd, $drw_wnd, $width, $height, $bg_color, $line); $line = 'program line '.$line.', function line '; checkWandError(MagickSetImageDelay($mgck_wnd, $delay), $mgck_wnd, $line.__LINE__); /** $line = 'program line '.$line.', function line '; /* Set the current active image in the $mgck_wnd MagickWand to the first /* Perform the morph special effect on $pre_morph_wnd and assign the result /* Set the current active image in the $morph_wnd MagickWand to the first /* Set the current active image in the $morph_wnd MagickWand to the last /* Reset $morph_wnd's image list iterator; this has the effect that the Contrast this behavior to MagickSetFirstIterator()'s, which sets the This is an important distinction -- be careful. MagickSetLastIterator($morph_wnd); /* Add the images in $morph_wnd to the end of $mgck_wnd */ DestroymagickWand($morph_wnd); ?>
August 07 用一个DIV锁定页面<script>
function unlocked() { //oDiv=document.getElementById("bgDiv"); //document.body.removeChild(oDiv);//删除 oDiv=document.getElementById("locked"); oDiv.style.display='none';
} function locked()
{ oDiv=document.getElementById("locked"); oDiv.style.display='block';
/* var sWidth,sHeight; sWidth=screen.width; sHeight=screen.height; mleft=0;
bgObj=parent.document.createElement("div");
bgObj.setAttribute('id','bgDiv'); bgObj.setAttribute("align","center"); bgObj.style.position="absolute"; bgObj.style.top="0"; bgObj.style.background="#cccccc"; bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; bgObj.style.opacity="0.8"; bgObj.style.left=mleft+"px"; bgObj.style.width=1003 + "px"; bgObj.style.height=570 + "px"; bgObj.style.zIndex = "1000"; parent.document.body.appendChild(bgObj);
bgDiv.attachEvent('onclick',unlocked);
*/ } </script>
<table width="200" border="1"> <tr> <td><span onclick="locked()">锁定</span></td> </tr> </table> <div id='locked' onclick='unlocked()' style='position:absolute;width:1000px;height:580px;left:0;top:0;z-index:50;filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=30,finishOpacity=75);background:#000; display:none;' ></div>
|
|||||||
|
|