Function checkStr($byVal,$chkStr){
return addslashes($chkStr);
}
Function UncheckStr($Str){
return stripslashes($Str);
}
Function HTMLEncode($reString){//转换HTML代码
return htmlspecialchars($reString);
}
Function GetZhais($StrURL){
$q=mysql_query("select count(*) as Zhais from zhai where fromurl='".$StrURL."'");
$a=mysql_fetch_array($q);
$GetZhais=$a[Zhais];
return $GetZhais;
}
function sub($str,$num){
$temp_j=0;
$temp_num=$num;
for($i=0;$i if(ord(substr($str,$i,1))>0xa0) $temp_j++;
if($temp_j%2!=0) $temp_num--;
$str=substr($str,0,$temp_num);
return $str;
}
Function Getreads($Strid){
$query=mysql_query("select reads from zhai where id='$Strid'");
$arr=mysql_fetch_array($query);
$Getreads=$arr[reads];
return $Getreads;
}
Function gettags($userid){
if($userid=="") $userid="匿名";
$sql="select tag,num from tags where userid='$userid' order by num desc";
$query=mysql_query($sql);
while ($arr=mysql_fetch_array($query)){
$Strtag.="".$arr[tag]."(".$arr[num].")";
}
return $Strtag;
}
?>