Home > Backend Development > PHP Tutorial > Writing a chat room using PHP and ACCESS (10)_PHP tutorial

Writing a chat room using PHP and ACCESS (10)_PHP tutorial

WBOY
Release: 2016-07-21 16:02:43
Original
1077 people have browsed it

func.php3
代码如下:
function suiji($max)
{
        srand((double)microtime()*1000000);
        $x=rand();
        $y=getrandmax();
        $r=$x/$y*($max-1);
        $r=round($r++);
        return $r;
}

function StrOccurs($sStr, $sFind){
        $sTemp=$sStr;
        $iLen=strlen($sFind);
        $iCount=0;
        while (true){
                if (strstr($sTemp, $sFind))
                        break;
                else
                        $sTemp = instr($sTemp,strpos($sTemp,$sFind)+$iLen);
                        $iCount++;
                }
        }
        return $iCount;
}

function StrDupl($sStr, $iCnt){
        $ret="";
        for($i=1;$i<=$iCnt;$i++)
                $ret.=$sStr;
        return $ret;
}

function DelQuot($sStr){
        $s=str_replace(chr(124),"¦",$sStr);
        $s=str_replace(chr(39),"´",$s);
        $s=str_replace(chr(34),""",$s);
        return s;
}

function DelTag($sStr){
        $bNeed="False";
        $sOther=strtoupper($sStr);
        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"        if ($bNeed!="True" || !strstr($sOther,"FONT-SIZE:")) $bNeed="True";
        if ($bNeed=="True")
                return str_replace(">",">",str_replace("<","<",$sStr));
        else
                return $sStr;
}

function AddLost($sStr){
        $ret=$sStr;
        $ret.=StrDupl(">", (StrOccurs(strtoupper($ret), "<") - StrOccurs(strtoupper($ret), ">")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
$ret.=StrDupl("", (StrOccurs(strtoupper($ret), "")));
        $ret.=StrDupl("", (StrOccurs(strtoupper($ret), ""))) ;
         $ret.=StrDupl("", (StrOccurs(strtoupper($ret), "") )); ")));
         return $ret;
}
?>


[The copyright of this article is jointly owned by the author and Aosuo.com. If you need to reprint, please indicate Author and source]



http://www.bkjia.com/PHPjc/316531.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316531.htmlTechArticlefunc.php3 The code is as follows: ?php function suiji($max) { srand((double)microtime()* 1000000); $x=rand(); $y=getrandmax(); $r=$x/$y*($max-1); $r=round($r++); return $r; } function StrOcc. ..
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template