网站地图    收藏   

主页 > php专栏 > php综合实列 >

我的论坛源代码(八)-PHP实例

来源:自学PHP网    时间:2014-12-25 09:57 作者: 阅读:

[导读] 我的论坛源代码八,reguse.php用户注册与登录页面lt;?if$action==dlamp;amp;$uname{$uinfo=$uname.quot;|quot;.$upass;setcookiequot;FlyFoxNetquot;,$uinfo,time+3600;}?gt;lt;htmlgt;lt;headgt;lt;titlegt;用户注册lt;/titlegt;lt;metah...

reguse.php用户注册与登录页面

<?
if ($action==dl&&$uname)
{
$uinfo=$uname."|".$upass;
setcookie("FlyFoxNet",$uinfo,time()+3600);
}
?>
<html>
<head>
<title>用户注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/CSS>
P {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
DIV {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
</STYLE>
<LINK href="js/cpcw.css" rel=stylesheet /LINK>
</head>
<?php
include "linkfox.inc.php";
include "info.inc.php";
include "reguse.inc.php";

function dlokey($user)      //登录成功显示
{
echo "<script language='javaScript'> alert('".$user3."欢迎你再次来到狐网论坛,站长飞狐||黑暗居士欢迎你!你上次来访的时间是".$user[2]."'); </script>";
echo "<table width='50%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#000000'>";
echo "<tr><td><table width='100%' border='0' cellspacing='1' cellpadding='1'><tr bgcolor='#006699'><td>";
echo "<div align='center'><font color='#FFFFFF'>欢迎你!<font color='00ff00'>".$user[3]."</font></font></div></td></tr><tr bgcolor='#eeeeee'><td>";
echo "<div align='center'>你上次访问本站的时间是:<font color='009900'>".$user[2]."</font></div></td></tr><tr bgcolor='#eeeeee'>";
echo "<td><div align='center'>你现在可以<a href='post.php'> <发布新帖> </a><a href='foxbbs.php'> <查看主题></a> <a href='useinfo.php?action=edit'> <修改信息></a></div></td></tr>";
echo "</table></td></tr></table>";
}




?>
<body bgcolor="#FFFFFF">
<table width="100%" cellpadding="4" cellspacing="0" border="0">
  <tr>
    <td height="20">
      <div align="right"></div>
    </td>
    <td height="20" width="75">&nbsp;</td>
    <td height="20" width="75">&nbsp;</td>
    <td height="20" width="75">&nbsp;</td>
    <td height="20" width="75">&nbsp;</td>
  </tr>
  <tr>
    <td height="20">
      <div align="right"></div>
    </td>
    <td height="20" width="75">
      <div align="center"><img src="images/top_register.gif" width="74" height="21" border="0"></div>
    </td>
    <td height="20" width="75">
      <div align="center"><img src="images/top_members.gif" width="74" height="21"></div>
    </td>
    <td height="20" width="75"><img src="images/top_PRofile.gif" width="74" height="21"></td>
    <td height="20" width="75"><a href="okey.php?d=q"><img src="images/top_logout.gif" width="74" height="21" border="0"></a></td>
  </tr>
  <tr>
    <td height="20">
      <div align="left">当前位置:<font color="#0000FF">狐网─&gt;狐网论坛─&gt;会员注册</font></div>
    </td>
    <td height="20" width="75">
      <div align="center"><a href="foxbbs.php"><img src="images/index.gif" width="70" height="20" border="0"></a></div>
    </td>
    <td height="20" width="75">
      <div align="center"><a href="post.php"><img src="images/newthread.gif" width="70" height="20" border="0"></a></div>
    </td>
    <td height="20" width="75"><a href="superuse.php"><img src="images/super.gif" width="70" height="20" border="0"></a></td>
    <td height="20" width="75">
      <div align="center"><a href="../index.php"><img src="images/fox.gif" width="70" height="20" border="0"></a></div>
    </td>
  </tr>
</table>
<?
if ($action==xy)
{
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor='#000000'><tr><td>";
echo "<table width='100%' border='0' cellspacing='1' cellpadding='1'>";
echo "<tr bgcolor='#006699'><td height='20'><div align='center'><font color='#FFFFFF'>狐网论坛 规定</font></div></td></tr>";
echo "<tr bgcolor='#eeeeee'><td height='20'>";
echo "<div align='left'><p>你在这个论坛注册是完全免费的! 我们希望您遵守以下的论坛规定. 请仔细阅读下列条款. 如果您同意请按 '我同意' 按钮. 如果您不同意,";
echo "请按 '不同意' 按钮退出.</p>";
echo "<p> 1. 遵守中华人民共和国的各项有关法律法规.</p>";
echo "<p> 2. 不得在发布任何色情非法, 以及危害国家安全的言论.</p>";
echo "<p> 3. 严禁链接有关政治, 色情, 宗教, 迷信等违法信息.</p>";
echo "<p> 4. 承担一切因您的行为而直接或间接导致的民事或刑事法律责任; </p>";
echo "<p> 5. 互相尊重, 遵守互联网络道德; 严禁互相恶意攻击, 漫骂;</p>";
echo "<p> 6. 管理员及版主有权保留或删除论坛中的任意内容;</p>";
echo "<p> 7. 本站网管拥有一切管理权力. </p>";
echo "<p> 8. 在此论坛发表的原创文章,版权规作者与狐网共有。</p>";
echo "</div></td></tr></table>";
echo "</td></tr></table>";
echo "<div align='center'><FORM ACTION='reguse.php' METHOD='get'><INPUT TYPE='HIDDEN' NAME='action' VALUE='reg'>";
echo "<INPUT TYPE='SUBMIT' VALUE='我同意'></p></form>";
echo "<div align='center'><FORM ACTION='foxbbs.php' METHOD='get'><INPUT TYPE='SUBMIT' VALUE='不同意'></p></form>";
}
else if ($action==reg)
{
usemess("请在下表填写注册信息",'必填','必填','必填','必填','必填','必填','必填');
}
if ($action==add)
{
  if ($useni)        //如果有信息
     {
          for ($i=0;$i<10;$i++)
        {
          if ($bq[$i]) $usebq=$bq[$i];
        }
    $reginfo=reg($usename,$usepass,$usemail,$useweb,$useni,$uSEOicq,$usesex,$useage,$usezy,$useaddr,$useinf,$usety,$usebq,$useqm);
    switch ($reginfo)
      {
      case ($reginfo==1):
        usemess("错误!用户名超长",$usename,$usemail,$useweb,$useni,$useoicq,$useaddr,$useqm);
        break;
      case ($reginfo==2):
        usemess("错误!密码超长",$usename,$usemail,$useweb,$useni,$useoicq,$useaddr,$useqm);
        break;
      case ($reginfo==3):
        usemess("错误!oicq号非法",$usename,$usemail,$useweb,$useni,$useoicq,$useaddr,$useqm);
        break;
      case ($reginfo==4):
        usemess("错误!用户密码含有非法字符",$usename,$usemail,$useweb,$useni,$useoicq,$useaddr,$useqm);
        break;
      case ($reginfo==5):
        usemess("错误!用户名含有非法字符",$usename,$usemail,$useweb,$useni,$useoicq,$useaddr,$useqm);
        break;
      case ($reginfo==6):
        usemess("错误!非法OICQ号",$usename,$usemail,$useweb,$useni,$useoicq,$useaddr,$useqm);
        break;
      case ($reginfo==7):
        usemess("错误!非法EMAIL地址",$usename,$usemail,$useweb,$useni,$useoicq,$useaddr,$useqm);
        break;
      case ($reginfo==8):
        usemess("非常报歉!这个用户已经存在,请重新选择",$usename,$usemail,$useweb,$useni,$useoicq,$useaddr,$useqm);
        break;
      case ($reginfo==9):
        usemess("未知错误!",$usename,$usemail,$useweb,$useni,$useoicq,$useaddr,$useqm);
        break;
      case ($reginfo==10):
        usemess("写入数据库错误,请与<font color='ffffff'>黑暗居士</font>联系",$usename,$usemail,$useweb,$useni,$useoicq,$useaddr,$useqm);
        break;
      default:
        $reginfo=update($reginfo);
        regok("注册成功,以下是你的个人信息",$reginfo);
        break;
      }
    }
    else usemess("请填写好你的信息",'必填','必填','必填','必填','必填','必填','必填');
}
if ($action==dl)      //登录函数
{
  if ($uname)
   {
     $query="select usepass,usename,enddate,useni from useinfo where usename='".$uname."'";  //检查是否存在用户
     $req=@MySQL_query($query);
       if ($req)
        {
         $user=@mysql_fetch_array($req);
         if ($user[0]==$upass)              //检查口令是否正确
          {
          $time=date(Y年n月j日G时i分);
          $query="update useinfo set enddate='$time' where usename='".$uname."'";
          $req=@mysql_query($query);
          if ($req) dlokey($user);
          else dlmes("数据登录错误!");
          }
         else dlmes("用户密码不正确,请校验!");
       }
       else dlmes("不能找到用户信息,请确认!如果还未注册,请点击<a href='reguse.php?action=xy'>这里</a>");
  }
else dlmes("用户登录");
}
?>
</body>
</html> 

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论