Copy Code code as follows:
<?php
/*********************************************************************
* Common Functions List
* ubb,getip,goin,goback,isint,instring
* ourhome:http://iwind.org
* Http://10.13.31.90/~coldwind
*
* */
UBB Support code Functions////////////////////////////
function Ubb ($Text) {
$Text =trim ($Text);
$Text =htmlspecialchars ($Text);
$Text =ereg_replace ("\ n", "<br>", $Text);
$Text =preg_replace ("/\\t/is", "", $Text);
$Text =preg_replace ("/\[h1\]" (. +?) \[\/h1\]/is "," $Text =preg_replace ("/\[h2\]" (. +?) \[\/h2\]/is "," $Text =preg_replace ("/\[h3\]" (. +?) \[\/h3\]/is "," $Text =preg_replace ("/\[h4\]" (. +?) \[\/h4\]/is "," $Text =preg_replace ("/\[h5\]" (. +?) \[\/h5\]/is "," $Text =preg_replace ("/\[h6\]" (. +?) \[\/h6\]/is "," $Text =preg_replace ("/\[center\]" (. +?) \[\/center\]/is "," <center>\\1</center> ", $Text);
$Text =preg_replace ("/\[url\]" (http:\/\/.+?) \[\/url\]/is "," <a href=\\1>\\1</a> ", $Text);
$Text =preg_replace ("/\[url\]" (. +?) \[\/url\]/is "," <a href=\ "http://\\1\" >http://\\1</a> ", $Text);
$Text =preg_replace ("/\[url=" (http:\/\/.+?) \] (. *) \[\/url\]/is "," <a href=\\1>\\2</a> ", $Text);
$Text =preg_replace ("/\[url= (. +?)" \] (. *) \[\/url\]/is "," <a href=http://\\1>\\2</a> ", $Text);
$Text =preg_replace ("/\[img\]" (. +?) \[\/img\]/is "," ", $Text);
$Text =preg_replace ("/\[color= (. +?)" \](.+?) \[\/color\]/is "," <font color=\\1>\\2</font> ", $Text);
$Text =preg_replace ("/\[size= (. +?)" \](.+?) \[\/size\]/is "," <font size=\\1>\\2</font> ", $Text);
$Text =preg_replace ("/\[sup\]" (. +?) \[\/sup\]/is "," <sup>\\1</sup> ", $Text);
$Text =preg_replace ("/\[sub\]" (. +?) \[\/sub\]/is "," <sub>\\1</sub> ", $Text);
$Text =preg_replace ("/\[pre\]" (. +?) \[\/pre\]/is "," <pre>\\1</pre> ", $Text);
$Text =preg_replace ("/\[email\]" (. +?) \[\/email\]/is "," <a href=\\1>\\1</a> ", $Text);
$Text =preg_replace ("/\[i\]" (. +?) \[\/i\]/is "," <i>\\1</i> ", $Text);
$Text =preg_replace ("/\[b\]" (. +?) \[\/b\]/is "," <b>\\1</b> ", $Text);
$Text =preg_replace ("/\[quote\]" (. +?) \[\/quote\]/is "," <blockquote><font size= ' 1 ' face= ' Courier New ' >quote:</font>$Text =preg_replace ("/\[code\]" (. +?) \[\/code\]/is "," <blockquote><font size= ' 1 ' face= ' times New Roman ' >code:</font>$Text =preg_replace ("/\[sig\]" (. +?) \[\/sig\]/is "," <div style= ' text-align:left; Color:darkgreen; margin-left:5% ' ><br><br>--------------------------<br>\\1<br>---------------------- ----</div> ", $Text);
return $Text;
}
Get the browser's IP address/////////////////////////////
function GetIP () {
$IP =getenv (' remote_addr ');
$IP _ = getenv (' http_x_forwarded_for ');
if (($IP _!= "") && ($IP _!= "Unknown")) $IP = $IP _;
return $IP;
}
function GoBack ($num, $saying) {
echo "<table align=\" Center\ "><tr><td><a href=\" javascript:history.go ( -1) \ "> $saying </a > ";
}
Determines whether the string contains a value in the array/////////////////
function instring ($array, $string) {
while (list (, $value) =each ($array)) {
if (eregi ($value, $string)) {
return true;
Exit
}
}
}
Link to a page///////////////////////////////////////
function Goin ($addr, $saying) {
echo "<table align=\" Center\ ><tr><td><a href=\ "$addr \" > $saying </a></td></ Tr></table> ";
}
JS back to//////////////////////////////////////////////
function Isint ($string) {
if (Ereg ("^[0-9]{0,}$", $string)) {
return true;
}
else {
return false;
}
}
?>