Func. php3
Code 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 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), "success", $ 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, "If ($ bneed! = "True" |! Strstr ($ sother, "If ($ bneed! = "True" |! Strstr ($ sother, "If ($ bneed! = "True" |! Strstr ($ sother, "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 ("$ Ret. = strdupl ("</H2>", (stroccurs (strtoupper ($ RET), "<H2")-stroccurs (strtoupper ($ RET ), "</H2> ")));
$ Ret. = strdupl ("$ 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;
}
?>
[This article is copyrighted by the author and osuo. If you need to reprint it, please indicate the author and its source]