源码网,源码论坛,源码之家,商业源码,游戏源码下载,discuz插件,棋牌源码下载,精品源码论坛

 找回密码
 立即注册
查看: 365|回复: 28

[PHP编程] 用PHP和ACCESS写聊天室(十)

[复制链接]

7万

主题

861

回帖

32万

积分

论坛元老

Rank: 8Rank: 8

积分
329525
发表于 2006-10-9 00:00:00 | 显示全部楼层 |阅读模式
func.php3
代码如下:
<?php
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,"<TABLE")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</TABLE")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<SCRIPT")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</SCRIPT")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<BODY")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</BODY")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<HTML")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</HTML")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<HEAD")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</HEAD")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<FORM")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</FORM")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<INPUT")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</INPUT")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<OPTION")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</OPTION")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<SELECT")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</SELECT")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<APPLET")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</APPLET")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<OBJECT")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</OBJECT")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<MENU")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</MENU")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<FRAMESET")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</FRAMESET")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<FRAME")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</FRAME")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<IFRAME")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</IFRAME")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<STYLE")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"</STYLE")) $bNeed="True";
        if ($bNeed!="True" || !strstr($sOther,"<BASE")) $bNeed="True";
        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("</FONT>", (StrOccurs(strtoupper($ret), "<FONT") - StrOccurs(strtoupper($ret), "</FONT>")));
        $ret.=StrDupl("</B>", (StrOccurs(strtoupper($ret), "<B") - StrOccurs(strtoupper($ret), "</B>")));
        $ret.=StrDupl("</I>", (StrOccurs(strtoupper($ret), "<I") - StrOccurs(strtoupper($ret), "</I>")));
        $ret.=StrDupl("</U>", (StrOccurs(strtoupper($ret), "<U") - StrOccurs(strtoupper($ret), "</U>")));
        $ret.=StrDupl("</S>", (StrOccurs(strtoupper($ret), "<S") - StrOccurs(strtoupper($ret), "</S>")));
        $ret.=StrDupl("</STRIKE>", (StrOccurs(strtoupper($ret), "<STRIKE") - StrOccurs(strtoupper($ret), "</STRIKE>")));
        $ret.=StrDupl("</STRONG>", (StrOccurs(strtoupper($ret), "<STRONG") - StrOccurs(strtoupper($ret), "</STRONG>")));
        $ret.=StrDupl("</SMALL>", (StrOccurs(strtoupper($ret), "<SMALL") - StrOccurs(strtoupper($ret), "</SMALL>")));
        $ret.=StrDupl("</CITE>", (StrOccurs(strtoupper($ret), "<CITE") - StrOccurs(strtoupper($ret), "</CITE>")));
        $ret.=StrDupl("</EM>", (StrOccurs(strtoupper($ret), "<EM") - StrOccurs(strtoupper($ret), "</EM>")));
        $ret.=StrDupl("</CODE>", (StrOccurs(strtoupper($ret), "<CODE") - StrOccurs(strtoupper($ret), "</CODE>")));
        $ret.=StrDupl("</SAMP>", (StrOccurs(strtoupper($ret), "<SAMP") - StrOccurs(strtoupper($ret), "</SAMP>")));
        $ret.=StrDupl("</KBD>", (StrOccurs(strtoupper($ret), "<KBD") - StrOccurs(strtoupper($ret), "</KBD>")));
        $ret.=StrDupl("</VAR>", (StrOccurs(strtoupper($ret), "<VAR") - StrOccurs(strtoupper($ret), "</VAR>")));
        $ret.=StrDupl("</DFN>", (StrOccurs(strtoupper($ret), "<DFN") - StrOccurs(strtoupper($ret), "</DFN>")));
        $ret.=StrDupl("</BIG>", (StrOccurs(strtoupper($ret), "<BIG") - StrOccurs(strtoupper($ret), "</BIG>")));
        $ret.=StrDupl("</SUP>", (StrOccurs(strtoupper($ret), "<SUP") - StrOccurs(strtoupper($ret), "</SUP>")));
        $ret.=StrDupl("</SUB>", (StrOccurs(strtoupper($ret), "<SUB") - StrOccurs(strtoupper($ret), "</SUB>")));
        $ret.=StrDupl("</H1>", (StrOccurs(strtoupper($ret), "<H1") - StrOccurs(strtoupper($ret), "</H1>")));
        $ret.=StrDupl("</H2>", (StrOccurs(strtoupper($ret), "<H2") - StrOccurs(strtoupper($ret), "</H2>")));
        $ret.=StrDupl("</H3>", (StrOccurs(strtoupper($ret), "<H3") - StrOccurs(strtoupper($ret), "</H3>")));
        $ret.=StrDupl("</H4>", (StrOccurs(strtoupper($ret), "<H4") - StrOccurs(strtoupper($ret), "</H4>")));
        $ret.=StrDupl("</H5>", (StrOccurs(strtoupper($ret), "<H5") - StrOccurs(strtoupper($ret), "</H5>")));
        $ret.=StrDupl("</H6>", (StrOccurs(strtoupper($ret), "<H6") - StrOccurs(strtoupper($ret), "</H6>")));
        $ret.=StrDupl("</H7>", (StrOccurs(strtoupper($ret), "<H7") - StrOccurs(strtoupper($ret), "</H7>")));
        return $ret;
}
?>


【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    


回复

使用道具 举报

1

主题

2万

回帖

59

积分

注册会员

Rank: 2

积分
59
发表于 2022-10-25 06:44:54 | 显示全部楼层
啪啪啪生怕PSP怕
回复 支持 反对

使用道具 举报

0

主题

2万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2022-10-29 01:16:05 | 显示全部楼层
554411515451555
回复 支持 反对

使用道具 举报

0

主题

1万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2022-12-20 09:37:36 | 显示全部楼层
我找了挺久终于找到了
回复 支持 反对

使用道具 举报

4

主题

2万

回帖

58

积分

注册会员

Rank: 2

积分
58
发表于 2023-1-22 05:07:32 | 显示全部楼层
下载来瞧瞧
回复 支持 反对

使用道具 举报

15

主题

2万

回帖

122

积分

注册会员

Rank: 2

积分
122
发表于 2023-3-3 09:35:01 | 显示全部楼层
强烈支持楼主ing……
回复 支持 反对

使用道具 举报

14

主题

1万

回帖

75

积分

注册会员

Rank: 2

积分
75
发表于 2023-3-5 09:41:26 | 显示全部楼层
飞飞飞飞飞飞飞飞飞飞飞飞飞
回复 支持 反对

使用道具 举报

1

主题

2万

回帖

362

积分

中级会员

Rank: 3Rank: 3

积分
362
发表于 2023-4-1 10:50:48 | 显示全部楼层
搞个免费的用用
回复 支持 反对

使用道具 举报

0

主题

1万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2023-7-29 16:33:23 | 显示全部楼层
vcxvcxv
回复 支持 反对

使用道具 举报

2

主题

2万

回帖

99

积分

注册会员

Rank: 2

积分
99
发表于 2023-8-25 07:39:37 | 显示全部楼层
源码源码源码源码源码源码源码源码源码源码源码源码源码
回复 支持 反对

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

手机版|小黑屋|网站地图|源码论坛 ( 海外版 )

GMT+8, 2024-11-23 06:14 , Processed in 0.116219 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表