⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 21-11.php

📁 php 和 ajax 开发的一些资料
💻 PHP
字号:
<?php
echo "<html>\n";								//输出标准HTML内容
echo "<head>\n";
echo "<title>\n";
echo "修改论坛\n";
echo "</title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">\n";
echo "<div class=\"Frame\">\n";
include "21-1.php";
$sql="select power from $bbs_user where name='$_COOKIE[user]'";
$temp=mysql_fetch_array(mysql_query($sql,$my_conn));
if($temp[0]<2)
{
  echo "<div class=\"title\">你无权运行此页面<p>点<a href=\"21-5.php\">这里</a>返回</div>";
  exit();
}
else
{
  if(!$_POST["id"])
  {
    echo "<div class=\"title\">修改论坛第一步</div>\n";
    echo "<div class=\"main\">&nbsp;</div>\n";
    echo "<form action=\"".$_SERVER[PHP_SELF]."\" method=\"post\">\n";
    echo "<div class=\"title\">选择需要修改的论坛:";
    echo "<select name=\"id\" size=\"1\">\n";
    $sql="select id ,type_n from $bbs_type";
    $result=mysql_query($sql,$my_conn);
    while($row=mysql_fetch_array($result))
    {
      echo "<option value=\"".$row[0]."\">".$row[1]."</option>";
    }
    echo "</select>\n";
    echo "</div>\n";
    echo "<div class=\"title\"><input type=\"submit\" value=\"下一步\"></div>\n";
    echo "</form>\n";
  }
  else if(!$_POST["type_n"])
  {
    echo "
<script language=\"javascript\">
<!--
function Juge(theForm)
{
   if (theForm.type_n.value == \"\")
    {
      alert(\"请输入论坛名称!\");
      theForm.type_n.focus();
      return (false);
    }
   if (theForm.type_d.value == \"\")
    {
      alert(\"请输入论坛名称!\");
      theForm.type_d.focus();
      return (false);
    }
}
-->
</script>\n";
    $sql="select type_n,type_d,m_id from $bbs_type where id='$_POST[id]' limit 1";
$temp=mysql_fetch_array(mysql_query($sql,$my_conn));
    echo "<div class=\"title\">修改论坛第二步</div>\n";
    echo "<div class=\"main\">&nbsp;</div>\n\n";
    echo "<form name=\"f\" action=\"".$_SERVER[PHP_SELF]."\" method=\"post\"  onsubmit=\"return Juge(this)\">\n";
    echo "<input type=\"hidden\" name=\"id\" value=\"".$_POST[id]."\">\n";
    echo "<div class=\"title\">输入论坛名称:<input type=\"text\" name=\"type_n\" value=\"".$temp[0]."\" class=\"input\"></div>\n";
    echo "<div class=\"title\">输入论坛介绍:<input type=\"text\" name=\"type_d\" value=\"".$temp[1]."\"  class=\"input\"></div>\n";
    if($temp[2]!=0)
    {
      echo "<div class=\"title\">分论坛应属于:";
      echo "<select name=\"m_id\" size=\"\" class=\"input\" style=\"width:151px\">\n";
      $sql="select id,type_n from $bbs_type where m_id=0";
      $result=mysql_query($sql,$my_conn);
      while($row=mysql_fetch_array($result))
      {
        echo "<option value=\"".$row[id]."\" ";
        if($row[id]==$temp[2]) echo " selected";
        echo ">".$row[type_n]."</option>\n";
      }
      echo "</select>";
      echo "</div>\n";
    }
    echo "<div class=\"title\"><input type=\"button\" value=\"上一步\" onclick=\"history.go(-1)\">";
    echo "<input type=\"submit\" value=\"下一步\"></div>\n";
    echo "</form>\n";
  }
  else
  {
    $type_n=$_POST["type_n"];
    $type_d=$_POST["type_d"];
    if($_POST["m_id"]) $m_id=$_POST["m_id"];
    else $m_id=0;
    $sql="UPDATE $bbs_type SET type_n='$type_n',type_d='$type_d',m_id='$m_id' where id='$_POST[id]'";
    $result=(mysql_query($sql,$my_conn));
    if($result)
    {
      echo "<div class=\"title\">修改论坛成功<p>点<a href=\"21-5.php\">这里</a>返回</div>";
    }
    else
    {
      echo "<div class=\"title\">修改论坛失败<p>点<a href=\"21-5.php\">这里</a>返回</div>";
    }
  }
}
echo "</div>";
echo "</doby>";
echo "</html>";
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -