Home > Backend Development > PHP Tutorial > My forum source code (7)_PHP tutorial

My forum source code (7)_PHP tutorial

WBOY
Release: 2016-07-21 16:04:11
Original
1031 people have browsed it

info.inc.php mainly does some judgment and information processing

function update($reginfo)
{
switch ($reginfo[4])
{
case ($reginfo[4]==1):
$reginfo[4]="Male";
break;
default:
$reginfo[4]="Female" ;
break;
}

switch ($reginfo[11])
case ($reginfo[11]==1):
$reginfo[11 ]="Member";
break;
case ($reginfo[11]==2):
$reginfo[11]="Moderator";
break;
case ( $reginfo[11]==3):
$reginfo[11]="Administrator";
break;
case ($reginfo[11]==4):
$reginfo[ 11]="Webmaster";
break;
default:
$reginfo[11]="Visitor";
break;
}
switch ($reginfo[6] )
                                                                                                ==1):
$reginfo[6]="Civil servant";
break;
case ($reginfo[6]==2):
$reginfo[6]="Company employee ";
break;
case ($reginfo[6]==3):
$reginfo[6]="Freelance";
break;
case ($reginfo[6 ]==4):
$reginfo[6]="Nothing to do";
break;
default:
$reginfo[6]="Won’t tell you";
break;
}
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); //Judge the 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 "

";
echo "
".$mess."
";
echo "
";
}

function cuser($cookiem,$action)
{
if ($cookiem)                        //检查是否有此用户
   {
       $useinfo=$cookiem;  //打开COOKIE
       $query="select * from useinfo where usename='".$useinfo."'";
       $req=mysql_query($query);
       if ($req)
       {
          $user=mysql_fetch_array($req);
            if ($useinfo==$user[0])
                {
                 $useinfo=$user;
                 return $useinfo;
                }
          else
                {
             $useinfo[0]="";
             $useinfo[2]="游客";
             return $useinfo;
                }

       }
       else
       {
          $useinfo[0]="";
          $useinfo[2]="游客";
          return $useinfo;
       }
   }
else if($action)         //如果不是,则看是否有信息传入
   {
       $user=$action;
       $query="select * from useinfo where usename='".$user."'";
       $req=mysql_query($query);
       if ($req)
       {
           $user=mysql_fetch_array($req);   //找到
           if ($user[0]==$useinfo)
              {
                 $useinfo==$user;
                 return $useinfo;
              }
           else
              {
                 $useinfo[0]="";
                 $useinfo[2]="游客";
                 return $useinfo;
              }
       }
       else
       {
         $useinfo[0]="";
         $useinfo[2]="游客";
         return $useinfo;
       }
   }

else
    {
      $useinfo[0]="";
      $useinfo[2]="游客";
      return $useinfo;
    }//None
}



function err_info($mess)
{
echo "";
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316044.htmlTechArticleinfo.inc.php mainly does some judgment and information processing?php function update($reginfo) { switch ($ reginfo[4]) { case ($reginfo[4]==1): $reginfo[4]=male; break; default: $reginfo[4]=female; break;...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template