<?php
echo "<html>\n";
echo "<head>\n";
echo "<title>安装程序</title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<style>\n";
echo "* {
padding: 0;
margin: 0;
}
body {
font-family: verdana, sans-serif;
font-size: 10pt;
background-color: #FFFFEE;
padding: 25px 0px 25px 0px;
}
a:link, a:active, a:visited {
color: #336699;
text-decoration: underline;
}
a:hover {
color: #7F0000 !important;
text-decoration: none;
}
select option {
padding-right: 3px;
}
#wrapper {
width: 650px;
border: 1px solid silver;
margin-left: auto;
margin-right: auto;
background-color: #EFEFEF;
background-image: url(gfx/bg.png);
background-repeat: repeat-x;
}
#wrapper h1 {
height: 90px;
line-height: 90px;
background-image: url(gfx/logo.png);
background-repeat: no-repeat;
background-position: top right;
padding: 0px 25px 0px 25px;
font-weight: normal;
font-size: 24pt;
letter-spacing: -2px;
word-spacing: 5px;
color: #336699;
}
#content {
padding: 0px 25px 10px 25px;
}
p, table, pre, h2, h3, ul, ol, dl {
margin: 0px 0px 15px 0px;
}
p.important {
background-color: #EFDFBF;
padding: 10px;
font-size: 8pt;
}
p#submit, p#submit input {
text-align: center;
font-weight: bold;
}
p#submit input {
padding: 5px;
}
h2 {
color: #336699;
font-weight: normal;
font-size: 14pt;
border-bottom: 1px solid silver;
}
h3 {
color: #333;
font-weight: bold;
font-size: 10pt;
}
ul, ol {
margin-left: 35px;
}
dl dt {
font-weight: bold;
color: #333;
}
dl dd {
margin-left: 35px;
margin-bottom: 5px;
}
table {
background-color:#000000;
border-collapse: collapse;
margin-left: 0;
margin-right: 0;
}
table th, table td {
padding: 5px;
}
td {
background-color:#cccc99;
}
table th {
text-align: left;
color: #336699;
}
table td.title {
width: 135px;
}";
echo "</style>\n";
if(!$_POST[admin]) //如果没有默认参数显示HTML
{
echo "<script language=\"javascript\">\n";
echo "function juge(theForm)\n";
echo "{\n";
echo "\tif (theForm.admin.value == \"\")\n";
echo "\t{\n";
echo "\t\talert(\"请输入管理员名称!\");\n";
echo "\t\ttheForm.admin.focus();\n";
echo "\t\treturn (false);\n";
echo "\t}\n";
echo "\tif (theForm.pass.value == \"\")\n";
echo "\t{\n";
echo "\t\talert(\"请输入管理员密码!\");\n";
echo "\t\ttheForm.pass.focus();\n";
echo "\t\treturn (false);\n";
echo "\t}\n";
echo "\tif (theForm.pass.value.length < 8 )\n";
echo "\t{\n";
echo "\t\talert(\"密码至少要8位!\");\n";
echo "\t\ttheForm.pass.focus();\n";
echo "\t\treturn (false);\n";
echo "\t}\n";
echo "\tif (theForm.re_pass.value !=theForm.pass.value)\n";
echo "\t{\n";
echo "\t\talert(\"确认密码与密码不一致!\");\n";
echo "\t\ttheForm.re_pass.focus();\n";
echo "\t\treturn (false);\n";
echo "\t}\n";
echo "\tif (theForm.nickname.value == \"\")\n";
echo "\t{\n";
echo "\t\talert(\"请输入昵称!\");\n";
echo "\t\ttheForm.nickname.focus();\n";
echo "\t\treturn (false);\n";
echo "\t}\n";
echo "\tif (theForm.pre.value == \"\")\n";
echo "\t{\n";
echo "\t\talert(\"请输入表前缀!\");\n";
echo "\t\ttheForm.pre.focus();\n";
echo "\t\treturn (false);\n";
echo "\t}\n";
echo "}\n";
echo "</script>\n";
echo "<center>\n";
echo "<table width=\"80%\" cellpadding=\"1\" cellspacing=\"1\">\n";
echo "<form method=\"post\" action=\"$PATH_INFO\" onsubmit=\"return juge(this)\">\n";
echo "<tr>\n";
echo "<td colspan=\"2\" align=\"center\"><font size=\"5px\">安装论坛</font></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>管理员:(后台登录)</td>\n";
echo "<td><input type=\"text\" name=\"admin\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>管理员密码:(不小于8位)</td>\n";
echo "<td><input type=\"password\" name=\"pass\" size=\"21\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>确认密码:</td>\n";
echo "<td><input type=\"password\" name=\"re_pass\" size=\"21\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>管理员E-mail:(可选)</td>\n";
echo "<td><input type=\"text\" name=\"email\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>管理员昵称:(前台显示)</td>\n";
echo "<td><input type=\"text\" name=\"nickname\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>表的前缀:</td>\n";
echo "<td><input type=\"text\" name=\"pre\" value=\"bbs_\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan=\"2\"><center>\n";
echo "<input type=\"submit\" value=\"下一步\">\n";
echo "<input type=\"reset\" value=\"重新填\">\n";
echo "</center></td>\n";
echo "</tr>\n";
echo "</form>\n";
echo "</table>\n";
echo "</center>\n";
echo "</body>\n";
echo "<html>\n";
}
else //如果有POST参数执行操作
{
$name=$_POST[admin]; //获得参数
$password=md5($_POST[pass]); //获得密码,并使用MD5进行加密操作
$nickname=$_POST[nickname];
$email=$_POST[email];
$pre=$_POST[pre];
require "20-1.php";
$table_members=$pre.$table_members;
$table_topic=$pre.$table_topic;
$table_posts=$pre.$table_posts;
$ip=$_SERVER[REMOTE_ADDR];
$time=date("Y年m月d日");
$time2=date("G:i:s");
$sql="create table $table_members(
id int(5) not null auto_increment primary key,
name varchar(12) not null default '',
password varchar(40) not null default '',
nickname varchar(12) not null default '',
sex enum('boy','girl') not null default 'boy',
email varchar(80) not null default '',
photo varchar(80) not null default '',
q_name varchar(200) not null default '',
post_num int(5) not null default 0,
reg_date varchar(20) not null default '',
admin int(1) not null default '0',
level int(5) not null default 0,
other varchar(200) not null default ''
)";
mysql_query($sql,$link) or die(mysql_error()); //发送创建member表的SQL请求
$sql="create table $table_topic(
id int(5) not null auto_increment primary key,
p_id int(5) not null default 0,
topic_name varchar(12) not null default '',
topic_description varchar(80) not null default '',
last_post_id int (5) not null default 0,
post_count int(5) not null default 0,
post_m_count int(5) not null default 0,
other varchar(200) not null default ''
)";
mysql_query($sql,$link) or die(mysql_error()); //发送创建topic表的SQL请求
$sql="create table $table_posts(
id int(5) not null auto_increment primary key,
topic_id int(5) not null default 0,
re_id int(5) not null default 0,
poster_id int(5) not null default 0,
poster_ip varchar(23) not null default '',
poster varchar(12) not null default '',
title varchar(40) not null default '',
content text not null,
view_count int(5) not null default 0,
re_count int(5) not null default 0,
post_time varchar(40) not null default '',
post_re_time varchar(40) not null default '',
other varchar(200) not null default ''
)";
mysql_query($sql,$link) or die(mysql_error()); //发送创建posts表的SQL请求
$sql="insert into $table_topic(p_id,topic_name,topic_description)values('0','默认主类别1','系统创建的默认主类别')";
mysql_query($sql,$link) or die(mysql_error()); //发送添加默认主分类的SQL请求
$sql="insert into $table_topic(p_id,topic_name,topic_description,last_post_id,post_count,post_m_count)values('1','默认分类别','系统创建的默认分类别','1','1','1')";
mysql_query($sql,$link) or die(mysql_error()); //发送添加默认子分类的SQL请求
$sql="insert into $table_members(name,password,nickname,email,post_num,reg_date,admin)values('$name','$password','$nickname','$email','1','$time','3')";
mysql_query($sql,$link) or die(mysql_error()); //发送添加管理员信息的SQL请求
$sql="insert into $table_posts(topic_id,poster_id,poster_ip,poster,title,content,post_time,post_re_time)values('2','1','$ip','$name','第一条测试信息','测试留贴是否有效','$time$time2','$time$time2')";
mysql_query($sql,$link) or die(mysql_error()); //发送添加发贴的SQL请求
$sql="update $table_topic set post_count='1',post_m_count='1' where id='2'";
mysql_query($sql,$link) or die(mys
没有合适的资源?快使用搜索试试~ 我知道了~
PHP教程习题集-源代码
共368个文件
php:254个
gif:55个
bmp:46个
需积分: 10 122 下载量 186 浏览量
2009-03-01
15:47:13
上传
评论
收藏 385KB RAR 举报
温馨提示
PHP教程习题集-源代码,有很详细和具体的源代码!配合PHN光盘教程更好!
资源推荐
资源详情
资源评论
收起资源包目录
PHP教程习题集-源代码 (368个子文件)
21-2.php.bak 7KB
20061103110914.BMP 4KB
16.BMP 4KB
6.BMP 4KB
3.BMP 4KB
19.BMP 4KB
15.BMP 4KB
17.BMP 4KB
11.BMP 4KB
13.BMP 4KB
1.BMP 4KB
5.BMP 4KB
12.BMP 4KB
10.BMP 4KB
20.BMP 4KB
7.BMP 4KB
14.BMP 4KB
8.BMP 4KB
2.BMP 4KB
4.BMP 4KB
18.BMP 4KB
9.BMP 4KB
16.BMP 4KB
6.BMP 4KB
3.BMP 4KB
19.BMP 4KB
15.BMP 4KB
17.BMP 4KB
11.BMP 4KB
13.BMP 4KB
1.BMP 4KB
5.BMP 4KB
12.BMP 4KB
10.BMP 4KB
20.BMP 4KB
7.BMP 4KB
14.BMP 4KB
8.BMP 4KB
2.BMP 4KB
4.BMP 4KB
18.BMP 4KB
9.BMP 4KB
3.bmp 1KB
2.bmp 1KB
4.bmp 1KB
5.bmp 1KB
1.bmp 1KB
style.css 1KB
style.css 605B
style1.css 535B
style3.css 474B
style2.css 280B
data.dat 0B
9.gif 4KB
8.gif 4KB
4.gif 4KB
7.gif 4KB
0.gif 4KB
6.gif 4KB
3.gif 3KB
5.gif 3KB
2.gif 3KB
1.gif 3KB
2.gif 3KB
20.gif 3KB
20.gif 3KB
8.gif 3KB
8.gif 3KB
22.gif 3KB
22.gif 3KB
9.gif 3KB
9.gif 3KB
16.gif 3KB
16.gif 3KB
18.gif 3KB
18.gif 3KB
6.gif 3KB
6.gif 3KB
19.gif 3KB
19.gif 3KB
10.gif 3KB
10.gif 3KB
2.gif 3KB
2.gif 3KB
3.gif 3KB
3.gif 3KB
21.gif 3KB
21.gif 3KB
5.gif 3KB
5.gif 3KB
15.gif 2KB
15.gif 2KB
12.gif 2KB
12.gif 2KB
4.gif 2KB
4.gif 2KB
13.gif 2KB
13.gif 2KB
14.gif 2KB
14.gif 2KB
共 368 条
- 1
- 2
- 3
- 4
资源评论
java_zkp
- 粉丝: 0
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功