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

📄 admin_groups.php

📁 一个全功能的国外博客商业程序
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<tr>
<td class='header'>$admin_groups97</td></tr>
<tr>
<td class='box'>
$admin_groups98
<br><br>
<table cellpadding='0' cellspacing='0'>
<tr><td><input type='radio' name='allow_language' value='1'"; if($group_info[allow_language] == 1) { echo " CHECKED"; } echo "></td><td>$admin_groups99</td></tr>
<tr><td><input type='radio' name='allow_language' value='0'"; if($group_info[allow_language] == 0) { echo " CHECKED"; } echo "></td><td>$admin_groups100</td></tr>
</table>
</td>
</tr>
</table>

<br>

<table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 3px;'>
<tr><td class='header'>$admin_groups43</td></tr>
<tr>
<td class='box'>
$admin_groups44<br><br>
<table cellpadding='0' cellspacing='0'>
<tr><td><input type='radio' name='show_ad' value='0'"; if($group_info[show_ad] == 0) { echo " CHECKED"; } echo "></td><td>$admin_groups45</td></tr>
<tr><td><input type='radio' name='show_ad' value='1'"; if($group_info[show_ad] == 1) { echo " CHECKED"; } echo "></td><td>$admin_groups46</td></tr>
<tr><td><input type='radio' name='show_ad' value='2'"; if($group_info[show_ad] == 2) { echo " CHECKED"; } echo "></td><td>$admin_groups47</td></tr>
<tr><td><input type='radio' name='show_ad' value='3'"; if($group_info[show_ad] == 3) { echo " CHECKED"; } echo "></td><td>$admin_groups48</td></tr>
</table>
</td>
</tr>
</table>

<br>

<table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 3px;'>
<tr><td class='header'>$admin_groups101</td></tr>
<tr>
<td class='box' style='border-bottom: none;'>
$admin_groups102<br><br>
<b>$admin_groups103</b><br>
<textarea name='html_ad' rows='8' cols='40' style='width: 100%;'>".str_replace("<", "&lt;", $group_info[html_ad])."</textarea>
</td>
</tr>
<tr>
<td class='box'>
<b>$admin_groups104</b><br>
<textarea name='html_ad_bottom' rows='8' cols='40' style='width: 100%;'>".str_replace("<", "&lt;", $group_info[html_ad_bottom])."</textarea>
</td>
</tr>
</table>

<br>

<input type='submit' name='submit' class='button' value='$submit'>
<input type='submit' name='submit' class='button' value='$admin_groups63'>
<input type='hidden' name='task' value='doedit'>
<input type='hidden' name='g_id' value='$group_info[g_id]'>
</form>
";
echo $foot;
exit();
}











if($task == "doedit") {
$g_id = $_POST['g_id'];
$group_name = $_POST['group_name'];
$allow_comments = $_POST['allow_comments'];
$allow_members = $_POST['allow_members'];
$allow_privacy = $_POST['allow_privacy'];
$allow_mailinglist = $_POST['allow_mailinglist'];
$allow_rss = $_POST['allow_rss'];
$allow_uploads = $_POST['allow_uploads'];
$uploads_space = $_POST['uploads_space'];
$uploads_extensions = $_POST['uploads_extensions'];
$allow_banning = $_POST['allow_banning'];
$allow_pinging = $_POST['allow_pinging'];
$allow_trackback = $_POST['allow_trackback'];
$allow_entry_cat = $_POST['allow_entry_cat'];
$allow_edittemplate = $_POST['allow_edittemplate'];
$allow_language = $_POST['allow_language'];
$show_ad = $_POST['show_ad'];
$html_ad = str_replace("&lt;", "<", $_POST['html_ad']);
$html_ad_bottom = str_replace("&lt;", "<", $_POST['html_ad_bottom']);
$announcements = $_POST['announcements'];
$submit = $_POST['submit'];

$count = 0;
$templates = "";
$bhost_templates = mysql_query("SELECT * FROM bhost_templates");
while($template_info = mysql_fetch_assoc($bhost_templates)) {
  $var = "template_$template_info[t_id]";
  $included = $_POST[$var];
  if($included == "1") {
    if($count != 0) { $templates .= ","; }
    $templates .= "$template_info[t_id]";
    $count = $count + 1;
  }
}


if($submit == "$admin_groups63") { header("Location: admin_groups.php"); exit(); }

if(str_replace(" ", "", $group_name) == "") {
echo $head;
echo "
<h2>$admin_groups51</h2>
$admin_groups53
<br><br>
<form action='admin_groups.php' method='POST'>
<input type='submit' class='button' value='$admin_groups3'>
";
if($g_id == "") { echo "<input type='hidden' name='task' value='newgroup'>"; } else { echo "<input type='hidden' name='task' value='edit'><input type='hidden' name='g_id' value='$g_id'>"; }
echo "
</form>
";
echo $foot;
exit();
}


if($g_id == "") {
mysql_query("INSERT INTO bhost_groups (group_name, allow_comments, allow_members, allow_privacy, allow_mailinglist, allow_rss, allow_uploads, uploads_space, uploads_extensions, allow_banning, allow_pinging, allow_trackback, allow_entry_cat, allow_edittemplate, templates, allow_language, show_ad, html_ad, html_ad_bottom, announcements) VALUES ('$group_name', '$allow_comments', '$allow_members', '$allow_privacy', '$allow_mailinglist', '$allow_rss', '$allow_uploads', '$uploads_space', '$uploads_extensions', '$allow_banning', '$allow_pinging', '$allow_trackback', '$allow_entry_cat', '$allow_edittemplate', '$templates', '$allow_language', '$show_ad', '$html_ad', '$html_ad_bottom', '$announcements')");
} else {
mysql_query("UPDATE bhost_groups SET group_name='$group_name', allow_comments='$allow_comments', allow_members='$allow_members', allow_privacy='$allow_privacy', allow_mailinglist='$allow_mailinglist', allow_rss='$allow_rss', allow_uploads='$allow_uploads', uploads_space='$uploads_space', uploads_extensions='$uploads_extensions', allow_banning='$allow_banning', allow_pinging='$allow_pinging', allow_trackback='$allow_trackback', allow_entry_cat='$allow_entry_cat', allow_edittemplate='$allow_edittemplate', templates='$templates', allow_language='$allow_language', show_ad='$show_ad', html_ad='$html_ad', html_ad_bottom='$html_ad_bottom', announcements='$announcements' WHERE g_id='$g_id'");
}
header("Location: admin_groups.php");
exit();
}











if($task == "delete") {
if(isset($_GET['g_id'])) { $g_id = $_GET['g_id']; } else { $g_id = 0; }
if(mysql_num_rows(mysql_query("SELECT g_id FROM bhost_groups WHERE g_id='$g_id'")) != 1) { exit(); }
$group_info = mysql_fetch_assoc(mysql_query("SELECT g_id, default_group FROM bhost_groups WHERE g_id='$g_id'"));

if($group_info[default_group] == 1) {
echo $head;
echo "
<h2>$admin_groups51</h2>
$admin_groups52
<br><br>
<form action='admin_groups.php' method='POST'>
<input type='submit' class='button' value='$admin_groups3'>
</form>
";
echo $foot;
exit();
}

echo $head;
echo "
<h2>$admin_groups60</h2>
$admin_groups61
<br><br>
<form action='admin_groups.php' method='POST'>
<input type='submit' class='button' value='$admin_groups62'>
<input type='submit' class='button' value='$admin_groups63'>
<input type='hidden' name='task' value='dodelete'>
<input type='hidden' name='g_id' value='$g_id'>
</form>
";
echo $foot;
exit();
}











if($task == "dodelete") {
if(isset($_POST['g_id'])) { $g_id = $_POST['g_id']; } else { exit(); }
$group_info = mysql_fetch_assoc(mysql_query("SELECT g_id, default_group FROM bhost_groups WHERE g_id='$g_id'"));
if($group_info[default_group] == 1) { exit(); }
$default_group = mysql_fetch_assoc(mysql_query("SELECT g_id, default_group FROM bhost_groups WHERE default_group='1' LIMIT 1"));

mysql_query("DELETE FROM bhost_groups WHERE g_id='$g_id'");
mysql_query("UPDATE bhost_users SET g_id='$default_group[g_id]' WHERE g_id='$g_id'");
header("Location: admin_groups.php");
exit();
}






if($task == "move") {
$g_id = $_GET['g_id'];
if($g_id == "") { exit(); }

$totalusers = mysql_num_rows(mysql_query("SELECT g_id, u_id FROM bhost_users WHERE g_id='$g_id'"));

// IF ZERO USERS IN GROUP, SHOW ERROR
if($totalusers == 0) {
echo $head;
echo "
<h2>$admin_groups33</h2>
$admin_groups76
<br><br>
<form action='admin_groups.php' method='POST'>
<input type='submit' class='button' value='$admin_groups3'>
</form>
";
echo $foot;
exit();
}

// IF ONLY ONE GROUP EXISTS, SHOW ERROR
$totalgroups = mysql_num_rows(mysql_query("SELECT g_id FROM bhost_groups"));
if($totalgroups == 1) {
echo $head;
echo "
<h2>$admin_groups33</h2>
$admin_groups86
<br><br>
<form action='admin_groups.php' method='POST'>
<input type='submit' class='button' value='$admin_groups3'>
</form>
";
echo $foot;
exit();
}

$group_info = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_groups WHERE g_id='$g_id'"));
echo $head;
echo "
<h2>$admin_groups77</h2>
$admin_groups78 $totalusers $admin_groups79 <b>$group_info[group_name]</b>
<br><br>
<table cellpadding='7' cellspacing='0' class='box' style='background: #FFFFFF;'>
<form action='admin_groups.php' method='POST'>
<tr><td>$admin_groups80 <b>$group_info[group_name]</b> $admin_groups81</td><td>
<select name='newgroup'>
";

$groups = mysql_query("SELECT * FROM bhost_groups ORDER BY group_name");
while($group = mysql_fetch_assoc($groups)) {
if($group[g_id] != $g_id) {
echo "<option value='$group[g_id]'>$group[group_name]</option>
";
}}

echo "
</select>
</td></tr></table>

<br>

<input type='submit' class='button' name='submit' value='$admin_groups82'>
<input type='submit' class='button' name='submit' value='$admin_groups63'>
<input type='hidden' name='task' value='domove'>
<input type='hidden' name='g_id' value='$g_id'>
</form>
";
echo $foot;
exit();
}




if($task == "domove") {
$submit = $_POST['submit'];
$g_id = $_POST['g_id'];
$newgroup = $_POST['newgroup'];

if($submit == "$admin_groups63") { header("Location: admin_groups.php"); exit(); }
if($g_id == "" OR $newgroup == "") { exit(); }

// MOVE USERS TO NEW GROUP
mysql_query("UPDATE bhost_users SET g_id='$newgroup' WHERE g_id='$g_id'");
$totalusers = mysql_affected_rows();

$oldgroup = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_groups WHERE g_id='$g_id'"));
$newgroup = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_groups WHERE g_id='$newgroup'"));

echo $head;
echo "
<h2>$admin_groups83</h2>
$admin_groups84 $totalusers $admin_groups85 <b>$oldgroup[group_name]</b> $admin_groups81 <b>$newgroup[group_name]</b>.
<br><br>
<form action='admin_groups.php' method='POST'>
<input type='submit' class='button' value='$admin_groups3'>
</form>
";
echo $foot;
exit();
}




if($task == "main") {
echo $head;
echo "
<h2>$admin_groups1</h2>
$admin_groups4
<br><br>

<table cellpadding='0' cellspacing='0' width='100%'>
<tr><form action='admin_groups.php' method='POST'>
<td class='header' width='1%' NOWRAP>$admin_groups64</td>
<td class='header' width='70%' style='border-left: none;' NOWRAP>$admin_groups65</td>
<td class='header' width='5%' style='border-left: none;' NOWRAP>$admin_groups66</td>
<td class='header' width='5%' style='border-left: none;' NOWRAP>$admin_groups50</td>
<td class='header' width='19%' style='border-left: none;' NOWRAP>$admin_groups67</td>
</tr>
";

$groups = mysql_query("SELECT * FROM bhost_groups ORDER BY group_name");
while($group_info = mysql_fetch_assoc($groups)) {
$users_in_group = mysql_num_rows(mysql_query("SELECT u_id, g_id FROM bhost_users WHERE g_id='$group_info[g_id]'"));
  echo "
  <tr>
  <td class='list2' align='center' style='border-left: 1px solid #AAAAAA;' NOWRAP>$group_info[g_id]</td>
  <td class='list2' style='border-left: none;'>$group_info[group_name]</td>
  <td class='list2' style='border-left: none;' align='center' NOWRAP>$users_in_group</td>
  <td class='list2' style='border-left: none; padding: 3px;' align='center' NOWRAP><input type='radio' name='default_group' value='$group_info[g_id]'"; if($group_info[default_group] == 1) { echo " CHECKED"; } echo ">
  <td class='list2' style='border-left: none;' NOWRAP><a href='admin_groups.php?task=edit&g_id=$group_info[g_id]'>$admin_groups68</a> <font class='gray'>|</font> <a href='admin_groups.php?task=move&g_id=$group_info[g_id]'>$admin_groups75</a> <font class='gray'>|</font> <a href='admin_groups.php?task=delete&g_id=$group_info[g_id]'>$admin_groups69</a></td>
  </tr>
  ";
}

echo "
</table>

<br>
<input type='submit' name='submit' class='button' value='$admin_groups70'>
<input type='submit' name='submit' class='button' value='$admin_groups71'>
<input type='hidden' name='task' value='newgroup_or_setdefault'>
</form>

";

echo $foot;
exit();
}

?>

⌨️ 快捷键说明

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