📄 choose_template.php
字号:
<?
$page = "choose_template.php";
include "header.php";
if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }
if($group_info[templates] == "") { exit(); }
if($task == "dochange") {
$t_id = $_POST['t_id'];
$template_array = explode(",", $group_info[templates]);
if(!in_array($t_id, $template_array)) { exit(); }
$newtemplate = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_templates WHERE t_id='$t_id'"));
$html = str_replace("'", "\'", $newtemplate[html]);
mysql_query("UPDATE bhost_users SET template='$html' WHERE u_id='$user_info[u_id]'");
echo $head;
echo "
<h2>$choose_template1</h2>
$choose_template2
<br><br>
<table cellpadding='0' cellspacing='0'>
<form action='choose_template.php' method='POST'>
<tr>
<td>
<input type='submit' class='button' value='$choose_template3'>
</td>
</form>
";
if($group_info[allow_edittemplate] == "1") {
echo "
<form action='edit_template.php' method='POST'>
<td>
<input type='submit' class='button' value='$choose_template4'>
</td>
";
}
echo "
</tr>
</table>
";
echo $foot;
exit();
}
if($task == "main") {
echo $head;
echo "
<h2>$choose_template5</h2>
$choose_template6
";
if($group_info[allow_edittemplate] == "1") {
echo "$choose_template10";
}
$count = 0;
$templates = mysql_query("SELECT * FROM bhost_templates");
$template_array = explode(",", $group_info[templates]);
while($template = mysql_fetch_assoc($templates)) {
if(in_array($template[t_id], $template_array)) {
$count = $count + 1;
}
}
if($count == 0) {
echo "
<br><br>
<b>$choose_template7</b>
";
} else {
echo "
<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td valign='top'>
";
}
$templates = mysql_query("SELECT * FROM bhost_templates");
$template_array = explode(",", $group_info[templates]);
while($template = mysql_fetch_assoc($templates)) {
if(in_array($template[t_id], $template_array)) {
if($template[image] != "" AND $template[image] != "http://") {
$image = "<img src='$template[image]' border='0' class='template'>";
} else {
$image = "<img src='../images/noimage.gif' border='0' class='template'>";
}
$image = "<a href='../example.php?t_id=$template[t_id]' target='_blank'>$image</a>";
echo "
<div class='float'><form onsubmit='return confirm(\"$choose_template8\");' action='choose_template.php' method='POST'><br>
<b>$template[name]</b>
<div class='templatebox' valign='top' align='center'>$image<br>
<input type='submit' class='button' value='$choose_template9' style='margin-top: 5px;'>
<input type='hidden' name='t_id' value='$template[t_id]'>
<input type='hidden' name='task' value='dochange'>
</div>
</form>
</div>
";
}
}
if(mysql_num_rows($templates) != 0) {
echo "
</td>
</tr>
</table>";
}
echo $foot;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -