欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

我的论坛源代码(八)

程序员文章站 2023-12-31 21:46:40
reguse.php用户注册与登录页面
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"> </td>
    <td height="20" width="75"> </td>
    <td height="20" width="75"> </td>
    <td height="20" width="75"> </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">狐网─>狐网论坛─>会员注册</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> 

上一篇:

下一篇: