当前位置:  编程技术>php
本页文章导读:
    ▪基于mysql的论坛(5)       ## 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);             .........
    ▪基于mysql的论坛(6)       # post.php <?php require("config.inc.php"); $sql="select * from boardinfo where name='$board'"; $sql_result=mysql_query($sql); $sql_row=mysql_fetch_array($sql_result); ?> <html> <head> <title>发新贴子</title> <li.........
    ▪生成sessionid和随机密码的例子       用这个可以来验证用户和生成随机密码--teaman <?         //----------------------------------------------------         // Function GetSID()         //         // Parameters : $nSize number of caracte.........

[1]基于mysql的论坛(5)
    来源: 互联网  发布时间: 2013-11-30
## 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="/blog_article/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="/blog_article/$php_self/job/setgood/amp;uid/$id/amp;id/$rootid.html">";?><font color="#FFFFFF">转进精华区</font></a></b><font color="#FFcc00"><b> </b></font><b><?php echo "<a href="/blog_article/$php_self/job/delete/amp;uid/$id/amp;id/$rootid.html">";?><font color="#FFFFFF">删除</font></a></b><font color="#FFcc00"><b><?php
if ($good=="y"){
?> </b></font><b><?php echo "<a href="/blog_article/$php_self/job/setnogood/amp;uid/$id/amp;id/$rootid.html">";?><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="/blog_article/image/icon1.gif" width="18" height="17" alt="给作者留言" border="0"></a> <a href="/blog_article/userinfo/name/lt;php echo $writer;/gt;.html"><img src="/blog_article/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="/blog_article/$php_self/job/setgood/amp;uid/$id/amp;id/$rootid.html">";?><font color="#FFFFFF">转进精华区</font></a></b><font color="#FFcc00"><b> </b></font><b><?php echo "<a href="/blog_article/$php_self/job/delete/amp;uid/$id/amp;id/$rootid.html">";?><font color="#FFFFFF">删除</font></a></b><font color="#FFcc00"><b><?php
if ($good=="y"){
?> </b></font><b><?php echo "<a href="/blog_article/$php_self/job/setnogood/amp;uid/$id/amp;id/$rootid.html">";?><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="/blog_article/image/icon1.gif" width="18" height="17" alt="给作者留言" border="0"></a> <a href="/blog_article/userinfo/name/lt;php echo.html"$sql_row[writer]";?>"><img src="/blog_article/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="/blog_article/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="/blog_article/change.html">
          <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" size="9" value="<?php echo $password;?>">
                * </td>
            </tr>
            <tr>  
              <td align="right">重复密码</td>
              <td>  
                <input type="password" name="pwd2" maxlength="8" size="9" value="<?php echo $password;?>">
                * </td>
            </tr>
            <tr>  
              <td align="right">Email</td>
              <td>  
                <input type="text" name="email" 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" value="<?php echo $sql_row[realname];?>">
              </td>
            </tr>
            <tr>  
              <td align="right">地址</td>
              <td>  
                <input type="text" name="address" maxlength="40" size="30" value="<?php echo $sql_row[address];?>">
              </td>
            </tr>
            <tr>  
              <td align="right">电话</td>
              <td>  
                <input type="text" name="phone" size="22" maxlength="20" value="<?php echo $sql_row[phone];?>">
              </td>
            </tr>
            <tr>  
              <td align="right">主页</td>
              <td>  
                <input type="text" name="homepage" size="50" value="<?php echo $sql_row[homepage];?>">
              </td>
            </tr>
            <tr>  
              <td align="right">OICQ</td>
              <td>  
                <input type="text" name="oicq" maxlength="11" 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="/blog_article/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="/blog_article/modify_l.html">
        <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);
}
?>

    
[2]基于mysql的论坛(6)
    来源: 互联网  发布时间: 2013-11-30
# post.php
<?php
require("config.inc.php");
$sql="select * from boardinfo where name='$board'";
$sql_result=mysql_query($sql);
$sql_row=mysql_fetch_array($sql_result);
?>
<html>
<head>
<title>发新贴子</title>
<link rel="stylesheet" type="text/css" href="/blog_article/css/index.css">
</head>
<body bgcolor="#666666">
<?php include "ad.php";?><br>
<hr noshade width="80%" size="1">
<table width="80%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#686898" bordercolordark="#FFFFFF">
  <tr align="center" valign="top" bgcolor="#666699">  
    <td><font size="3" color="#336699"><b><font color="#CCFFFF">发 贴 子</font></b></font><br>
    </td>
  </tr>
  <tr bgcolor="#ffffef">  
    <td>(您<b>必须注册</b>以后才能发表新主题,不然您只能查看主题。<br>
      如果您还未注册,请<a href="/blog_article/apply.html" target="_blank"><font color="#FF0000">点击这里</font></a>转到注册页)</td>
  </tr>
  <tr bgcolor="#e8eee0">  
    <td><br>
      您的贴子将被发表在<b><?php echo $sql_row[chinesename];?></b>版块 </td>
  </tr>
</table>
<br>
<form method="post" action="/blog_article/read.html">
  <table width="98%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#336699" bordercolordark="#FFFFFF" bgcolor="#666699">
    <tr>  
      <td width="89" bgcolor="#acc0fa" align="right">用户名:</td>
      <td width="224">  
        <input type="text" name="name" value="<?php echo $jl_forum[name];?>" size="17" maxlength="16">
        <font color="#FF0000">* </font> </td>
      <td width="63" bgcolor="#acc0fa" align="right">密码:</td>
      <td width="160">  
        <input type="password" name="password" size="10" maxlength="16" >
        <font color="#FF0000">*</font> <font color="#FF0000"> </font> </td>
    </tr>
    <tr>  
      <td colspan="4"><font color="#FFFFFF">主题:</font>  
        <input type="text" name="title" size="50" maxlength="50" >
        <font color="#FF0000">* </font></td>
    </tr>
    <tr>  
      <td colspan="4"> <font color="#FFFFFF">内容:</font><br>
             
        <textarea name="cont" cols="70" rows="12" wrap="VIRTUAL"></textarea>
        <br>
        <input type="button" name="Submit2" value="取消" onclick="window.close()">
        <input type="submit" name="add" value="提交">
        <input type="checkbox" name="qm" value="qm" checked>
        <font color="#FFFFFF">使用签名</font>  
        <input type="hidden" name="board" value="<?php echo $board;?>">
      </td>
    </tr>
  </table>
  </form>
<?php include "footer.php";?><br>
</body>
</html>
# query.php
<?php
    require("func.php");
    $sql="select * from boardinfo";
    $sql_result=mysql_query($sql);
?>
<html>
<head>
<title>main</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="/blog_article/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="/blog_article/query_list.html">
        在  
        <select name="board">
          <option selected>请选择版面</option>
<?php
while($sql_row=mysql_fetch_array($sql_result)){
?>  
          <option value="<?php echo $sql_row[name];?>"><?php echo $sql_row[chinesename];?></option>
<?php
}
?>
        </select>
        中查询<br>
        <input type="text" name="query_str" size="40" maxlength="40">
        <br>
        <input type="submit" name="title" value="按主题查询">
        <input type="submit" name="cont" value="按内容查询">
        <input type="submit" name="writer" value="按作者查询">
      </form>
    </td>
  </tr>
  <tr bgcolor="#CCFF99">  
    <td>
      <div align="center"><b>论坛信息</b></div>
    </td>
  </tr>
  <tr>
    <td>
<?php include "info.php";?>
    </td>
  </tr>
</table>
</body>
</html>
# query_list.php
<?php
require("func.php");
if (!empty($query_str)) {

if(!is_board_exits($board)){
    $board="computer";
}
if ($title){
    $submit="title";
}
elseif ($cont) {
    $submit="cont";
}
elseif ($writer) {
    $submit="writer";
}
else {
    $submit="title";
}
$sql="select * from $board where ($submit like '%$query_str%')";
$temp=mysql_query($sql);
$sum=mysql_num_rows($temp);
if ($sum!=0) {
$sql="select * from boardinfo where name='$board'";
$sql_result=mysql_query($sql);
$sql_row=mysql_fetch_array($sql_result);
$chinesename=$sql_row[chinesename];
setcookie ("jl_forum[chinesename]",$chinesename);
$sql="select name from user where slaveboard='$board'";
$sql_result=mysql_query($sql);
?>
<html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="/blog_article/css/index.css">
<script language="javascript">
function openwin(board,id){                window.open("good_read.php?board="+board+"&id="+id,"","height=460,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
function post(board){                window.open("post.php?board="+board,"","height=500,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
</script>
</head>

<body bgcolor="#FFFFFF" background="image/bg.gif">
<?php include "header.php";?> <br>
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
  <tr>
    <td height="20" width="22%" bgcolor="#E8E8E8">版面:<?php
echo $chinesename;
?></td>
    <td height="20" width="29%" bgcolor="#E8E8E8">版主:<?php
while ($sql_row=mysql_fetch_array($sql_result))
{
echo "$sql_row[name]"." ";
}
# 选择出留言纪录;

$totalpage=ceil($sum/$pagesize);
# 分页
if($page<1 or empty($page)){
    $page=1;
}
elseif ($page>$totalpage){
         $page=$totalpage;
}
elseif ($totalpage==0) {
    $page=0;
}
$offset=($page-1)*$pagesize;
$sql="select * from $board where ($submit like '%$query_str%') order by id desc limit $offset,$pagesize";
$sql_result=mysql_query($sql);
?> </td>
    <td height="20" width="17%" bgcolor="#E8E8E8">查询到<?php echo $sum; ?>条纪录</td>
    <td height="20" colspan="2" width="32%"><a href='javascript:post("<?php echo $board;?>")'><img src="/blog_article/image/newtopic.jpg" width="92" height="21" border="0" alt="发新贴子"></a></td>
  </tr>
</table>
<br>
<table width="100%" border="1" cellspacing="0" cellpadding="1" bordercolorlight="#CCCCCC" bordercolordark="#eeeeee">
  <tr bgcolor="#995100" align="center">
    <td width="6%"><font color="#FFFFFF">回应</font></td>
    <td width="67%" bgcolor="#995100"><font color="#FFFFFF">主 题</font></td>
    <td width="20%"><font color="#FFFFFF">时 间</font></td>
    <td width="7%"><font color="#FFFFFF">人气</font></td>
  </tr>
  <tr bgcolor="#FFCC99">
    <td colspan="5" height="2"> </td>
  </tr>
  <?php
while ($sql_row=mysql_fetch_array($sql_result))
{
echo"<tr>";
echo"<td width="6%" bgcolor="#E8E8E8" align="center">";
echo "[*]";
echo"</td>";
echo"<td bgcolor="#E8FDEE" width="56%"><font face="宋体"><a href='javascript:openwin("$board",$sql_row[id])' title="作者:$sql_row[writer] 大小:$sql_row[size]字节">$sql_row[title]</a></font></td>";
  echo"<td width="18%" bgcolor="#FFF5DD" align="center">$sql_row[writetime]</td>";
  echo"<td width="6%" bgcolor="#E8FDEE" align="center">$sql_row[hits]</td>";
  echo"</tr>";
}
?>
  <tr bgcolor="#FFCC99">
    <td colspan="5" align="center" height="2"> </td>
  </tr>
</table>
<div align="right">
<form method="post" action="/blog_article/</php echo $php_self;/gt;.html">
    <input type="hidden" name="<?php echo $submit;?>" value="y">
    <input type="hidden" name="query_str" value="<?php echo $query_str;?>">
    共<b><?php echo $totalpage;?></b>页 第<b><?php echo $page;?></b>页·<?php
if ($page!=1){
     $back=$page-1;
        echo"<a href="/blog_article/$php_self/board/$board/amp;page/1/amp;$submit/y/amp;query_str/$query_str.html">首页</a> <a href="/blog_article/$php_self/board/$board/amp;page/$back/amp;$submit/y/amp;query_str/$query_str.html">上一页</a>";
}
if ($page==1){
       echo"首页 上一页";
}
if($page!=$totalpage){
    $next=$page+1;
        echo" <a href="/blog_article/$php_self/board/$board/amp;page/$next/amp;$submit/y/amp;query_str/$query_str.html">下一页</a> <a href="/blog_article/$php_self/board/$board/amp;page/$totalpage/amp;$submit/y/amp;query_str/$query_str.html">尾页</a>";
}
if($page==$totalpage){
        echo" 下一页 尾页";
}
?>·转到  
    <input type="submit" name="goto" value="转到">
    <input type="text" name="page" size="2">
    页  
  </form>
</div>
<?php include "footer.php";?>
</body>
</html>
<?php
}
else
    {
    show_error(10);
}
}
else {
    show_error(9);
}
# read.php
<?php
require ("func.php");
if ($re){
     $sql="select slaveid from $board where id=$id";
     $sql_result=mysql_query($sql);
     $sql_row=mysql_fetch_array($sql_result);
     if($sql_row[slaveid]!=0){
         show_error(1);
         $founderr=1;
     }
     if (!check_user_password($name,$password)){
          show_error(4);
          $founderr=1;
     }
     if (empty($title)){
         show_error(2);
         $founderr=1;
     }
     if ($qm){
          $qm=expl_qm($name);
     }
     if(!$founderr){
         re_doc($board,$id);
         setcookie ("jl_forum[name]",$name);
         $sql="select * from $board where id=$id";
         $sql_result=mysql_query($sql);
         $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];
         $fromip=$sql_row[fromip];
         $sql="select * from $board where slaveid=$id";
         $sql_result=mysql_query($sql);
        # $sql_row=mysql_fetch_array($sql_result);
     }

}
elseif ($add){
     if (!is_board_exits($board)){
          show_error(7);
          $founderr=1;
     }
     if (empty($title)){
         show_error(2);
         $founderr=1;
     }
     if (!check_user_password($name,$password)){
          show_error(4);
          $founderr=1;
     }
     if ($qm){
          $qm=expl_qm($name);
     }
     if (!$founderr){
           add_doc($board);
           $add=1;
           setcookie ("jl_forum[name]",$name);
     }
}
else {
     if (!is_board_exits){
          show_error(7);
     }
     add_one_hit($board,$id);
     $sql="select * from $board where id=$id";
     $sql_result=mysql_query($sql);
     $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];
     $fromip=$sql_row[fromip];
     $sql="select * from $board where slaveid=$id";
     $sql_result=mysql_query($sql);
  #   $sql_row=mysql_fetch_array($sql_result);
}
?>
<html>
<head>
<title><?php echo $title;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="/blog_article/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;?></b></font></td>
  </tr>
  <tr>
    <td bgcolor="#eeeeee">作者:<?php echo "$writer";?>(<?php echo $writetime;?>) <a href="javascript:sendmsg('<?php echo "$writer";?>')"><img src="/blog_article/image/icon1.gif" width="18" height="17" alt="给作者留言" border="0"></a> <a href="/blog_article/userinfo/name/lt;php echo $writer;/gt;.html"><img src="/blog_article/image/profile.gif" width="16" height="15" alt="察看用户资料" border="0"></a></td>
  </tr>
  <tr bgcolor="#ffffef">  
    <td><?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!=1){
while($sql_row=mysql_fetch_array($sql_result)) {
?>
<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];?></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="/blog_article/image/icon1.gif" width="18" height="17" alt="给作者留言" border="0"></a> <a href="/blog_article/userinfo/name/lt;php echo.html"$sql_row[writer]";?>"><img src="/blog_article/image/profile.gif" width="17" height="15" alt="察看用户资料" border="0"></a></td>
  </tr>
  <tr bgcolor="#ffffef">  
    <td><?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
}
?>
<form method="post" action="/blog_article/read.html">
  <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
      <td>
        <table width="40" border="1" cellspacing="0" cellpadding="0" height="20" bordercolorlight="#000099" bordercolordark="#FFFFFF">
          <tr valign="middle" align="center" bgcolor="#acc0fa">
            <td height="17">回复</td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  <table width="98%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#686898" bordercolordark="#CCCCCC">
    <tr>
      <td width="8%" align="right" bgcolor="#acc0fa">用户名</td>
      <td width="33%">
        <input type="text" name="name" size="17" maxlength="16" value="<?php echo "$jl_forum[name]";?>">
        <font color="#FFFFFF">* </font></td>
      <td width="7%" bgcolor="#acc0fa" align="center">密码</td>
      <td width="52%">
        <input type="password" name="password" size="17" maxlength="16">
        <font color="#FFFFFF">* </font></td>
    </tr>
    <tr>
      <td width="8%" align="right" bgcolor="#acc0fa">标题:</td>
      <td colspan="3">
        <input type="text" name="title" size="40" maxlength="50">
        <font color="#FFFFFF"> * </font></td>
    </tr>
    <tr>
      <td width="8%" align="right" bgcolor="#acc0fa">内容:</td>
      <td colspan="3">
        <textarea name="cont" cols="60" rows="3" wrap="VIRTUAL"></textarea>
      </td>
    </tr>
    <tr>
      <td width="8%" align="right" bgcolor="#acc0fa"> </td>
      <td colspan="3">
        <input type="button" name="clear" value="关闭窗口" onclick="window.close()">
        <input type="submit" name="re" value="提交">
        <input type="checkbox" name="qm" value="qm" checked>
        <font color="#FFFFFF">使用签名
        <input type="hidden" name="board" value="<?php echo $board;?>">
        <input type="hidden" name="id" value="<?php echo $id;?>">
        </font></td>
    </tr>
  </table>
  <?php
  }
  ?>
  <br>
</form>
<?php include"footer.php";?><br>
</body>
</html> 

    
[3]生成sessionid和随机密码的例子
    来源: 互联网  发布时间: 2013-11-30
用这个可以来验证用户和生成随机密码--teaman
<?
        //----------------------------------------------------
        // Function GetSID()
        //
        // Parameters : $nSize number of caracters, default 24
        // Return value : 24 caracters string
        //
        // Description : This function returns a random string
        // of 24 caracters that can be used to identify users
        // on your web site in a more secure way. You can also  
        // use this function to generate passwords.
        //----------------------------------------------------
        function GetSID ($nSize=24) {

            // Randomize
            mt_srand ((double) microtime() * 1000000);
            for ($i=1; $i<=$nSize; $i++) {

                // if you wish to add numbers in your string,  
                // uncomment the two lines that are commented
                // in the if statement
                $nRandom = mt_rand(1,30);
                if ($nRandom <= 10) {
                    // Uppercase letters
                    $sessionID .= chr(mt_rand(65,90));
            //    } elseif ($nRandom <= 20) {
            //        $sessionID .= mt_rand(0,9);
                } else {
                    // Lowercase letters
                    $sessionID .= chr(mt_rand(97,122));
                }

            }         
            return $sessionID;
        }
        // Test the function  
        echo GetSID(16);
    ?> 

    
最新技术文章:
▪PHP函数microtime()时间戳的定义与用法
网络技术 iis7站长之家
▪PHP数组排序方法总结(收藏)
▪php数组排序方法大全(脚本学堂整理奉献)
▪php数组排序的几个函数(附实例)
▪php二维数组排序(实例)
▪php根据键值对二维数组排序的小例子
▪php验证码(附截图)
▪php数组长度的获取方法(三个实例)
▪php获取数组长度的方法举例
▪判断php数组维度(php数组长度)的方法
▪php获取图片的exif信息的示例代码
▪PHP 数组key长度对性能的影响实例分析
▪php函数指定默认值的方法示例
▪php提交表单到当前页面、提交表单后页面重定...
▪php四舍五入的三种实现方法
▪php获得数组长度(元素个数)的方法
▪php日期函数的简单示例代码
▪php数学函数的简单示例代码
▪php字符串函数的简单示例代码
▪php文件下载代码(多浏览器兼容、支持中文文...
▪php实现文件下载、支持中文文件名的示例代码...
▪php文件下载(防止中文文件名乱码)的示例代码
▪解决PHP文件下载时中文文件名乱码的问题
▪php数组去重(一维、二维数组去重)的简单示例
▪php小数点后取两位的三种实现方法
▪php Redis 队列服务的简单示例
▪PHP导出excel时数字变为科学计数的解决方法
▪PHP数组根据值获取Key的简单示例
▪php数组去重的函数代码示例
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3