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

📄 setup.php

📁 八星瓢虫留言本特点:采用PHP+Access数据库实现
💻 PHP
字号:
<?php
include_once("include/conn.php");
include_once("include/config.php");
include_once("include/function.php");
$action=$_POST["action"];
if ($action=="save")
{
  if ($_POST["user_name"]!=$_COOKIE["admin_login"])
  {
    $rs=@new COM("ADODB.RecordSet") or die ("创建记录集失败!");
    $rs->open("select * from gb_admin where id<>".$_COOKIE["admin_id"]." and adm_name='".$_POST["user_name"]."'",$conn,1,1);
    if(!$rs->eof)
    {alert("用户名已经存在!",1);}
    else
    {$conn->execute("update gb_admin set adm_name='".$_POST["user_name"]."' where id=".$_COOKIE["admin_id"]);}
    $rs->close;
    $rs=null;
  }
  if ($_POST["user_pass"]!="")
  {
    $newpass=$_POST["user_pass"];
    $newpass=substr(md5($newpass),8,16);
    $conn->execute("update gb_admin set adm_pass='".$newpass."' where id=".$_COOKIE["admin_id"]);
  }
  $rs=@new COM("ADODB.RecordSet") or die ("创建记录集失败!");
  $rs->open("select top 1 * from gb_setup",$conn,1,3);
  if(!$rs->eof)
  {
    $rs->Fields["cfg_name"]->Value=$_POST["cfg_name"];
    $rs->Fields["cfg_skin"]->Value=$_POST["cfg_skin"];
    $rs->Fields["cfg_width"]->Value=$_POST["cfg_width"];
    $rs->Fields["cfg_keywords"]->Value=$_POST["cfg_keywords"];
    $rs->Fields["cfg_description"]->Value=$_POST["cfg_description"];
    $rs->Fields["cfg_page"]->Value=$_POST["cfg_page"];
    $rs->Fields["cfg_editor"]->Value=$_POST["cfg_editor"];
    $rs->Fields["cfg_emot"]->Value=$_POST["cfg_emot"];
    $rs->Fields["cfg_check"]->Value=$_POST["cfg_check"];
    $rs->update;
  }
  else
  {
    alert("参数错误!",1);
    exit;
  }
  $rs->close;
  $rs=null;
  alert("设置成功!","index.php");
  exit;
}
else
{
  $rs=@new COM("ADODB.RecordSet") or die ("创建记录集失败!");
  $rs->open("select top 1 * from gb_setup",$conn,1,1);
  if(!$rs->eof)
  {
    $cfg_name=$rs->Fields["cfg_name"]->Value;
    $cfg_skin=$rs->Fields["cfg_skin"]->Value;
    $cfg_width=$rs->Fields["cfg_width"]->Value;
    $cfg_keywords=$rs->Fields["cfg_keywords"]->Value;
    $cfg_description=$rs->Fields["cfg_description"]->Value;
    $cfg_page=$rs->Fields["cfg_page"]->Value;
    $cfg_editor=$rs->Fields["cfg_editor"]->Value;
    $cfg_emot=$rs->Fields["cfg_emot"]->Value;
    $cfg_check=$rs->Fields["cfg_check"]->Value;
  }
  else
  {
    alert("参数错误!",1);
    exit;
  }
  $rs->close;
  $rs=null;
}
$conn->close();
$conn=null;

if($_COOKIE["admin_login"]|=""){
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>留言管理--<?php echo $cfg_name; ?></title>
<link href="skin/<?php echo $cfg_skin; ?>.css" rel="stylesheet" type="text/css">
<meta name="keywords" content="<?php echo $cfg_keywords; ?>">
<meta name="description" content="<?php echo $cfg_description; ?>">
</head>

<body>
<!--登录开始-->
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="30" height="20"><img src="skin/<?php echo $cfg_skin; ?>/top_left.gif" width="30" height="20"></td>
    <td background="skin/<?php echo $cfg_skin; ?>/top_mid.gif">&nbsp;</td>
    <td width="30"><img src="skin/<?php echo $cfg_skin; ?>/top_right.gif" width="30" height="20"></td>
  </tr>
</table>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0" class="td_border">
  <tr>
    <td align="center">
      <table width="60%" border="0" cellspacing="0" cellpadding="0">
        <form name="frm_login" method="post" action="<?php echo $PHP_SELF; ?>">
        <tr>
          <td height="28" align="right">用户名:</td>
          <td>
            <input name="user_name" type="text" class="frm_input" maxlength="20" style="width:120px" value="<?php echo $_COOKIE["admin_login"]; ?>">
          </td>
        </tr>
        <tr>
          <td height="28" align="right">密&nbsp;&nbsp;码:</td>
          <td>
            <input name="user_pass" type="password" class="frm_input" maxlength="50" style="width:120px">
            (不修改请留空)
          </td>
        </tr>
        <tr>
          <td height="28" align="right">留言本名称:</td>
          <td>
            <input name="cfg_name" type="text" class="frm_input" maxlength="20" style="width:120px" value="<?php echo $cfg_name; ?>">
          </td>
        </tr>
        <tr>
          <td height="28" align="right">留言本样式:</td>
          <td>
            <select name="cfg_skin">
            <option value="skin01"<?php if ($cfg_skin=="skin01"){echo " selected";} ?>>蓝色天空</option>
            <option value="skin02"<?php if ($cfg_skin=="skin02"){echo " selected";} ?>>金黄世界</option>
            <option value="skin03"<?php if ($cfg_skin=="skin03"){echo " selected";} ?>>红色浪漫</option>
            </select>
          </td>
        </tr>
        <tr>
          <td height="28" align="right">留言本宽度:</td>
          <td>
            <input name="cfg_width" type="text" class="frm_input" maxlength="20" style="width:120px" value="<?php echo $cfg_width; ?>">
          </td>
        </tr>
        <tr>
          <td height="28" align="right">关键字:</td>
          <td>
            <input name="cfg_keywords" type="text" class="frm_input" maxlength="20" style="width:120px" value="<?php echo $cfg_keywords; ?>">
          </td>
        </tr>
        <tr>
          <td height="28" align="right">描述:</td>
          <td>
            <input name="cfg_description" type="text" class="frm_input" maxlength="20" style="width:120px" value="<?php echo $cfg_description; ?>">
          </td>
        </tr>
        <tr>
          <td height="28" align="right">每页留言数:</td>
          <td>
            <input name="cfg_page" type="text" class="frm_input" maxlength="20" style="width:120px" value="<?php echo $cfg_page; ?>">
          </td>
        </tr>
        <tr>
          <td height="28" align="right">编辑器样式:</td>
          <td>
            <input name="cfg_editor" type="radio" value="0"<?php if ($cfg_editor=="0"){echo " checked";} ?>>普通
            <input name="cfg_editor" type="radio" value="2"<?php if ($cfg_editor=="2"){echo " checked";} ?>>多功能
          </td>
        </tr>
        <tr>
          <td height="28" align="right">使用心情图标:</td>
          <td>
            <input name="cfg_emot" type="radio" value="1"<?php if ($cfg_emot=="1"){echo " checked";} ?>>使用
            <input name="cfg_emot" type="radio" value="0"<?php if ($cfg_emot=="0"){echo " checked";} ?>>不使用
          </td>
        </tr>
        <tr>
          <td height="28" align="right">留言是否审核:</td>
          <td>
            <input name="cfg_check" type="radio" value="1"<?php if ($cfg_check=="1"){echo " checked";} ?>>需要
            <input name="cfg_check" type="radio" value="0"<?php if ($cfg_check=="0"){echo " checked";} ?>>不需要
          </td>
        </tr>
        <tr>
          <td height="28" colspan="2" align="center">
          <input name="btn_submit" type="submit" class="frm_button" id="btnSubmit" value="  设 置 ">
          &nbsp;&nbsp;
          <input name="action" type="hidden" id="action" value="save">
          <input name="btn_back" type="button" class="frm_button" id="btnBack" onClick="history.back()" value=" 返 回 ">
          </td>
          </tr>
        </form>
      </table>
    </td>
  </tr>
</table>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="30" height="15"><img src="skin/<?php echo $cfg_skin; ?>/bom_left.gif" width="30" height="15"></td>
    <td background="skin/<?php echo $cfg_skin; ?>/bom_mid.gif">&nbsp;</td>
    <td width="30"><img src="skin/<?php echo $cfg_skin; ?>/bom_right.gif" width="30" height="15"></td>
  </tr>
</table>
<!--登录结束-->
</body>
</html>
<?php } ?>

⌨️ 快捷键说明

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