您现在的位置: 军旅同心 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 文章正文
用PHP和ACCESS写聊天室(三)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:36:22
cinput.php3
如下:
<html>
<head>
<title>输入</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="main.css" type="text/css">
<script language="JavaScript">
<!--
function NameGotFocus( ) {
        document.frmInput.txtSend.focus();
}

function CheckValid() {
    document.frmInput.sEmotion.value=top.emotion.frmEmotion.selEmotion.value;
    document.frmInput.sColor.value=top.emotion.frmEmotion.selColor.value;
    if (document.frmInput.txtSend.value == "") {
        document.frmInput.txtSend.focus();
        return false;
    }
    return true;
}

//-->
</script>
<link rel="stylesheet" href="main.css" type="text/css">
</head>
<body onload="NameGotFocus()">
<?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 = substr($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),"&brvbar;",$sStr);
    $s=str_replace(chr(39),"&acute;",$s);
    $s=str_replace(chr(34),"&quot;",$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(">","&gt;",str_replace("<","&lt;",$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

[1] [2] [3] [4] 下一页


 
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 |