当前位置:Gxlcms > PHP基础 > 基于mysql的论坛(5)

基于mysql的论坛(5)

时间:2021-07-01 10:21:17 帮助过:7人阅读

## manage_read.php
<?php
require ("func.php");
if (check_admin_password()) {
    $board=$jl_forum[board];
    switch ($job){
        case "setgood":
            set_good($jl_forum[board],$uid);
            $work=1;
            break;
        case "setnogood":
            set_no_good($jl_forum[board],$uid);
            $work=1;
            break;
        case "delete":
            del_doc($jl_forum[board],$uid);
            $work=1;
            break;
    }
if (!$word) {
    add_one_hit($board,$id);
}
$sql="select * from $board where id=$id";
$sql_result=mysql_query($sql);
$sum=mysql_num_rows($sql_result);
$sql_row=mysql_fetch_array($sql_result);
$title=$sql_row[title];
$writer=$sql_row[writer];
$cont=$sql_row[cont];
$writetime=$sql_row[writetime];
$hits=$sql_row[hits];
$good=$sql_row[good];
$rootid=$sql_row[id];
$fromip=$sql_row[fromip];
$sql="select * from $board where slaveid=$id";
$sql_result=mysql_query($sql);
if ($sum<>0) {
?>
<html>
<head>
<title><?php echo $title;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css/index.css">
<script language="javascript">
function sendmsg(name){                window.open("sendmsg.php?name="+name,"","height=200,width=500,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
</script>

</head>

<body bgcolor="#666699">
<?php include "ad.php";?><br>
<hr noshade width="98%" size="1">
<table width="98%" border="1" cellspacing="0" cellpadding="2" align="center" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
  <tr bgcolor="#666666">
    <td><font color="#FFcc00"><b>标题:<?php echo $title;?> <font color="#FFFFCC">◎操作:</font></b></font><b><?php echo "<a href="$php_self?job=setgood&uid=$id&id=$rootid">";?><font color="#FFFFFF">转进精华区</font></a></b><font color="#FFcc00"><b> </b></font><b><?php echo "<a href="$php_self?job=delete&uid=$id&id=$rootid">";?><font color="#FFFFFF">删除</font></a></b><font color="#FFcc00"><b><?php
if ($good=="y"){
?> </b></font><b><?php echo "<a href="$php_self?job=setnogood&uid=$id&id=$rootid">";?><font color="#FFFFFF">转出精华区</font></a></b><font color="#FFcc00"><b>  
      <?php
}
?> </b></font></td>
  </tr>
  <tr>
    <td bgcolor="#eeeeee">作者:<?php echo "$writer";?>(<?php echo $writetime;?>,点击:<?php echo $hits;?>) <a href="javascript:sendmsg('<?php echo "$writer";?>')"><img src="image/icon1.gif" width="18" height="17" alt="给作者留言" border="0"></a> <a href="userinfo.php?name=<?php echo $writer;?>"><img src="image/profile.gif" width="16" height="16" alt="察看用户资料" border="0"></a></td>
  </tr>
  <tr>
    <td bgcolor="#ffffef"><?php echo $cont;?></td>
  </tr>
  <tr bgcolor="#e8eee0">
    <td>※ 来源:<?php echo $jl_forum[chinesename];?> [◆FROM:<?php echo $fromip;?>]</td>
  </tr>
</table>
<br>
<?php
if (!$add){
while($sql_row=mysql_fetch_array($sql_result)) {
$good=$sql_row[good];
?>
<table width="98%" border="1" cellspacing="0" cellpadding="2" align="center" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
  <tr bgcolor="#015C71">
    <td><font color="#ffffff">标题:<?php echo $sql_row[title];
    $id=$sql_row[id];
    ?> <font color="#FFFFCC">◎操作:</font></b></font><b><?php echo "<a href="$php_self?job=setgood&uid=$id&id=$rootid">";?><font color="#FFFFFF">转进精华区</font></a></b><font color="#FFcc00"><b> </b></font><b><?php echo "<a href="$php_self?job=delete&uid=$id&id=$rootid">";?><font color="#FFFFFF">删除</font></a></b><font color="#FFcc00"><b><?php
if ($good=="y"){
?> </b></font><b><?php echo "<a href="$php_self?job=setnogood&uid=$id&id=$rootid">";?><font color="#FFFFFF">转出精华区</font></a></b><font color="#FFcc00"><b>  
      <?php
}
?> </b></font></td>
  </tr>
  <tr bgcolor="#eeeeee">
    <td>作者:<?php echo "$sql_row[writer]";?>(<?php echo $sql_row[writetime];?>) <a href="javascript:sendmsg('<?php echo "$sql_row[writer]";?>')"><img src="image/icon1.gif" width="18" height="17" alt="给作者留言" border="0"></a> <a href="userinfo.php?name=<?php echo "$sql_row[writer]";?>"><img src="image/profile.gif" width="17" height="16" alt="察看用户资料" border="0"></a></td>
  </tr>
  <tr>
    <td bgcolor="#ffffef"><?php echo $sql_row[cont];?></td>
  </tr>
  <tr bgcolor="#e8eee0">
    <td>※ 来源:<?php echo $jl_forum[chinesename];?> [◆FROM:<?php echo $sql_row[fromip];?>]</td>
  </tr>
</table>
<?php
}
}
?> <br>
<?php include"footer.php";?><br>
</body>
</html>
<?php
}
else {
    echo "此条纪录已经被删除";
}
}
else {
    show_error(1);
}
?>
## modify.php
<?php
require "func.php";
if (check_user_password($jl_forum[name],$jl_forum[password])) {
$name=$jl_forum[name];
$password=$jl_forum[password];
$sql="select * from user where name='$name'";
$sql_result=mysql_query($sql);
$sql_row=mysql_fetch_array($sql_result);
?>
<html>
<head>
<title>修改资料</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css/index.css">
</head>
<body bgcolor="#FFFFFF" background="image/bg.gif">
<?php include "header.php";?><br>
<hr noshade width="97%" size="1">
<div align="center">修改用户个人资料<br>
  <table width="90%" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#336699" bordercolordark="#FFFFFF">
    <tr valign="top">  
      <td colspan="2">  </td>
    </tr>
    <tr>  
      <td colspan="2">  
        <form method="post" action="change.php">
          <table width="80%" border="0" cellspacing="0" cellpadding="3" align="center">
            <tr>  
              <td align="right">用户名</td>
              <td><?php echo $name;?></td>
            </tr>
            <tr>  
              <td align="right">密码</td>
              <td>  
                <input type="password" name="pwd1" maxlength="8" style="font-size: 9pt; background-color: #FFFFFF; color: #FF0000; border: 1 solid #000000" size="9" value="<?php echo $password;?>">
                * </td>
            </tr>
            <tr>  
              <td align="right">重复密码</td>
              <td>  
                <input type="password" name="pwd2" maxlength="8" style="font-size: 9pt; background-color: #FFFFFF; color: #FF0000; border: 1 solid #000000" size="9" value="<?php echo $password;?>">
                * </td>
            </tr>
            <tr>  
              <td align="right">Email</td>
              <td>  
                <input type="text" name="email" style="font-size: 9pt; background-color: #FFFFFF; color: #FF0000; border: 1 solid #000000" value="<?php echo $sql_row[email];?>">
                * </td>
            </tr>
            <tr>  
              <td align="right">性别</td>
              <td>  
                <select name="sex">
                  <option value="秘密" selected>秘密</option>
                  <option value="男">男</option>
                  <option value="女">女</option>
                </select>
              </td>
            </tr>
            <tr>  
              <td align="right">真实性名</td>
              <td>  
                <input type="text" name="realname" size="17" maxlength="16" style="font-size: 9pt; background-color: #FFFFFF; color: #FF0000; border: 1 solid #000000" value="<?php echo $sql_row[realname];?>">
              </td>
            </tr>
            <tr>  
              <td align="right">地址</td>
              <td>  
                <input type="text" name="address" maxlength="40" size="30" style="font-size: 9pt; background-color: #FFFFFF; color: #FF0000; border: 1 solid #000000" value="<?php echo $sql_row[address];?>">
              </td>
            </tr>
            <tr>  
              <td align="right">电话</td>
              <td>  
                <input type="text" name="phone" size="22" maxlength="20" style="font-size: 9pt; background-color: #FFFFFF; color: #FF0000; border: 1 solid #000000" value="<?php echo $sql_row[phone];?>">
              </td>
            </tr>
            <tr>  
              <td align="right">主页</td>
              <td>  
                <input type="text" name="homepage" style="font-size: 9pt; background-color: #FFFFFF; color: #FF0000; border: 1 solid #000000" size="50" value="<?php echo $sql_row[homepage];?>">
              </td>
            </tr>
            <tr>  
              <td align="right">OICQ</td>
              <td>  
                <input type="text" name="oicq" maxlength="11" style="font-size: 9pt; background-color: #FFFFFF; color: #FF0000; border: 1 solid #000000" size="12" value="<?php echo $sql_row[oicq];?>">
              </td>
            </tr>
            <tr>  
              <td align="right">签名</td>
              <td><?php echo "$sql_row[qm]<br>";?>  
                <textarea name="qm" wrap="VIRTUAL" cols="50"></textarea>
              </td>
            </tr>
            <tr>  
              <td align="right">  </td>
              <td align="center">  
                <input type="submit" name="b2" value="修改">
                <input type="reset" name="Submit2" value="清除" >
              </td>
            </tr>
          </table>
        </form>
      </td>
    </tr>
  </table>
  <div align="center"><br>
  </div>
</div>
<?php include "footer.php";?>
</body>
</html>
<?php
}
else {
    show_error(4);
}
?>
## modify_l.php
<?php
require "func.php";
if ($b1) {
    if (is_user_exits($name) and check_user_password($name,$password)) {
    setcookie ("jl_forum[name]",$name);
    setcookie ("jl_forum[password]",$password);
    redirect2("modify.php");
    }
    else {
        show_error(4);
    }
}
else {
?>
<html>
<head>
<title>main</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css/page.css">
</head>

<body bgcolor="#FFFFFF" background="image/bg.gif">
<table width="90%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#FFCC99" bordercolordark="#FFCC99">
  <tr bgcolor="#CCFF99">  
    <td>
      <div align="center"><b>修改资料登陆</b></div>
    </td>
  </tr>
  <tr align="center">  
    <td>
      <form method="post" action="modify_l.php">
        <table width="70%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="38%" align="right">用户名:</td>
            <td width="62%" align="left">
              <input type="text" name="name" size="17" maxlength="16">
            </td>
          </tr>
          <tr>
            <td width="38%" align="right">密码:</td>
            <td width="62%" align="left">
              <input type="password" name="password" size="17" maxlength="16">
            </td>
          </tr>
        </table>
        <input type="submit" name="b1" value="进入">
      </form>
    </td>
  </tr>
  <tr bgcolor="#CCFF99">  
    <td>
      <div align="center"><b>论坛信息</b></div>
    </td>
  </tr>
  <tr valign="top">  
    <td>  
<?php include "info.php";?>
    </td>
  </tr>
</table>
</body>
</html>
<?php
}
?>
## oper.php
<?php
require "func.php";
if (adminok()) {
    if (isset($add_board)) {
        if (isset($name) and isset($chinesename) and !is_board_exits($name)) {
            create_board_table($name,$chinesename);
        }
        else {
            echo "出现错误!(可能版面已经存在)";
            $founderr=1;
        }
    }
    elseif (isset($del_board)) {
        if (isset($board)) {
            drop_board_table($board);
        }
        else {
            echo "出现错误!(请选择要删除的版面)";
            $founderr=1;
        }
    }
    elseif (isset($modify)) {
        if (isset($name) and isset($chinesename)) {
            update_board($name,$chinesename);
        }
        else {
            echo "出现错误!(请填写完整)";
            $founderr=1;
        }
    }
    elseif (isset($add_admin)) {
        if (is_user_exits($name) and isset($board)) {
            add_admin($board,$name);
        }
        else {
            echo "出现错误!(极有可能是用户不存在)";
            $founderr=1;
        }
    }
    elseif (isset($delete_admin)) {
        if (is_user_exits($name)) {
            del_admin($name);
        }
        else {
            echo "出现错误!(极有可能是用户不存在)";
            $founderr=1;
        }
    }
    else {
        echo "你要干什么?";
        $founderr=1;
    }
    if (!$founderr) {
        redirect2("admin.php");
    }
}
else {
    show_error(1);
}
?>

人气教程排行