info.inc.php主要做些判断和信息处理
<?php
function update($reginfo)
{
switch ($reginfo[4])
{
case ($reginfo[4]==1):
$reginfo[4]="男";
break;
default:
$reginfo[4]="女";
break;
}
switch ($reginfo[11])
{
case ($reginfo[11]==1):
$reginfo[11]="会员";
break;
case ($reginfo[11]==2):
$reginfo[11]="版主";
break;
case ($reginfo[11]==3):
$reginfo[11]="管理员";
break;
case ($reginfo[11]==4):
$reginfo[11]="站长";
break;
default:
$reginfo[11]="游客";
break;
}
switch ($reginfo[6])
{
case ($reginfo[6]==5):
$reginfo[6]="我是学生";
break;
case ($reginfo[6]==1):
$reginfo[6]="公务员";
break;
case ($reginfo[6]==2):
$reginfo[6]="公司雇员";
break;
case ($reginfo[6]==3):
$reginfo[6]="自由职业";
break;
case ($reginfo[6]==4):
$reginfo[6]="无所事事";
break;
default:
$reginfo[6]="不告诉你";
break;
}
if ($reginfo[12]==1) $reginfo[12]="是";
else $reginfo[12]=="否";
if ($reginfo[18]==1) $reginfo[18]="是";
else $reginfo[18]="否";
if ($reginfo[12]==2)
{$reginfo[4]=$reginfo[4]." [保密]";
$reginfo[5]=$reginfo[5]." [保密]";
$reginfo[6]=$reginfo[6]." [保密]";
$reginfo[7]=$reginfo[7]." [保密]";
$reginfo[8]=$reginfo[8]." [保密]";
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); //判断用户名
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 "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo "<div align='center'><font color='ff0000'>".$mess."</font></div>";
echo "</table>";
}
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;
} //都没有
}
function err_info($mess)
{
echo "<script language='JavaScript'> alert('".$mess."'); </script>";
}
?>
<?php
function update($reginfo)
{
switch ($reginfo[4])
{
case ($reginfo[4]==1):
$reginfo[4]="男";
break;
default:
$reginfo[4]="女";
break;
}
switch ($reginfo[11])
{
case ($reginfo[11]==1):
$reginfo[11]="会员";
break;
case ($reginfo[11]==2):
$reginfo[11]="版主";
break;
case ($reginfo[11]==3):
$reginfo[11]="管理员";
break;
case ($reginfo[11]==4):
$reginfo[11]="站长";
break;
default:
$reginfo[11]="游客";
break;
}
switch ($reginfo[6])
{
case ($reginfo[6]==5):
$reginfo[6]="我是学生";
break;
case ($reginfo[6]==1):
$reginfo[6]="公务员";
break;
case ($reginfo[6]==2):
$reginfo[6]="公司雇员";
break;
case ($reginfo[6]==3):
$reginfo[6]="自由职业";
break;
case ($reginfo[6]==4):
$reginfo[6]="无所事事";
break;
default:
$reginfo[6]="不告诉你";
break;
}
if ($reginfo[12]==1) $reginfo[12]="是";
else $reginfo[12]=="否";
if ($reginfo[18]==1) $reginfo[18]="是";
else $reginfo[18]="否";
if ($reginfo[12]==2)
{$reginfo[4]=$reginfo[4]." [保密]";
$reginfo[5]=$reginfo[5]." [保密]";
$reginfo[6]=$reginfo[6]." [保密]";
$reginfo[7]=$reginfo[7]." [保密]";
$reginfo[8]=$reginfo[8]." [保密]";
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); //判断用户名
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 "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo "<div align='center'><font color='ff0000'>".$mess."</font></div>";
echo "</table>";
}
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;
} //都没有
}
function err_info($mess)
{
echo "<script language='JavaScript'> alert('".$mess."'); </script>";
}
?>
版权声明:
本站所有资源均为站长或网友整理自互联网或站长购买自互联网,站长无法分辨资源版权出自何处,所以不承担任何版权以及其他问题带来的法律责任,如有侵权或者其他问题请联系站长删除!站长QQ754403226 谢谢。
- 上一篇: 我的论坛源代码(十)
- 下一篇: PHP个人网站架设连环讲(一)