Home >Backend Development >PHP Tutorial >My forum source code seven
info.inc.php mainly does some judgment and information processing
function update($reginfo)
{
switch ($reginfo[4])
F $ reginfo [4] = "Male";
Break;
default:
$ reginfo [4] = "female";
break;
}
switch ($ reginfo [11])
{
case ($ reginfo [ 11]==1):
$reginfo[11]="Member"; break; case ($reginfo[11]==3):
$reginfo[11]="Administrator";
break; case ($reginfo[11]==4):
$reginfo[11]="Webmaster ";
case ($reginfo[6]==5):
$ reginfo[6]="I am a student";
‐ reginfo reginfo [6] =2):
$reginfo[6]="Company employee"; $reginfo[6]==4):
if ($reginfo [12]==1) $reginfo[12]="Yes";
else $reginfo[12]=="No";
if ($reginfo[18]==1) $reginfo[18]="Yes ";
else $reginfo[18]="No";
if ($reginfo[12]==2)
{$reginfo[4]=$reginfo[4]." [Confidential]";
$reginfo[ 5]=$reginfo[5]." [Confidential]";
$reginfo[6]=$reginfo[6]." [Confidential]";
$reginfo[7]=$reginfo[7]." [Confidential] ]";
$reginfo[8]=$reginfo[8]." [Confidential]";
return $reginfo;
}
else
return $reginfo;
}
function uinfo($useinfo,$t)
{
if ($t==name) return eregi("^[a-zA-Z0-9][_-~a-zA-Z0-9]{2,8}$",$useinfo); //Judgement Username
else if($t==oicq) return eregi("^[0-9]{1,10}$",$useinfo); //oicq
else if($t==pass) return eregi( "^[a-zA-Z0-9]{1,8}$",$useinfo); //pass
else if($t==web) //web
{
$n=strstr($useinfo,'.');
if ($n&&strlen($useinfo)>10)
{
$x[1]=substr($n,0,1);
$n=strstr(substr($n,1),'.');
$x[2]=substr($n,0,1);
if ($x[1]==$x[2]) return OK;
}
}
else return eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$",$useinfo); //邮箱
}
function err($mess)
{
echo "
The above has introduced the source code of my forum seven, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.