📄 setup_date.php
字号:
<?php
if($mode=="")
{
echo "<p> </p><p align=center>正在数据库创建表格......</a>";
echo "<script language=\"javascript\">\n";
echo "self.location.href=\"setup_date.php?mode=create&doit=trues\"\n";
echo "</script>";
}
if($mode=="create")
{
if($doit=="trues")
{
include("header.php");
$tables[6];
$tables[0]="CREATE TABLE book (book_id tinyint(5) NOT NULL auto_increment,book_name varchar(50) NOT NULL, book_member varchar(50) NOT NULL,";
$tables[0].="book_publish varchar(100) NOT NULL,book_outtime date DEFAULT '0000-00-00' NOT NULL, book_sorter tinyint(4) NOT NULL,";
$tables[0].="book_number tinyint(4) NOT NULL,book_sotcks tinyint(4) NOT NULL,book_loss tinyint(4),";
$tables[0].="book_meno text,book_no varchar(100) NOT NULL,PRIMARY KEY (book_id),KEY book_id (book_id, book_name, book_member, book_publish, book_outtime, book_sorter),";
$tables[0].="UNIQUE book_id_2 (book_id),KEY book_no (book_no),UNIQUE book_no_2 (book_no))";
$tables[1]="CREATE TABLE class (classid int(4) NOT NULL auto_increment,classname char(100) NOT NULL,parentid int(4) NOT NULL,";
$tables[1].="downid char(240) DEFAULT '\"0\"' NOT NULL,layer tinyint(4) NOT NULL,classnumber char(50),";
$tables[1].="addnumber int(5) DEFAULT '1' NOT NULL,backup1 tinyint(4) NOT NULL,backup2 tinyint(4) NOT NULL,KEY classid (classid))";
$tables[2]="CREATE TABLE lend (id int(6) NOT NULL auto_increment,user_id int(5) NOT NULL,book_id int(5) NOT NULL,";
$tables[2].="book_name char(100) NOT NULL,lent_time date DEFAULT '0000-00-00' NOT NULL,type tinyint(1) NOT NULL,";
$tables[2].="book_sorter char(50) NOT NULL,continu_date year(4) DEFAULT '0000' NOT NULL,PRIMARY KEY (id),KEY id (id, user_id, book_id, book_name, lent_time),UNIQUE id_2 (id))";
$tables[3]="CREATE TABLE manage (id tinyint(4) NOT NULL auto_increment,name char(20) NOT NULL,password char(20) NOT NULL,";
$tables[3].="level tinyint(4) NOT NULL,PRIMARY KEY (id),KEY id (id, name),UNIQUE id_2 (id))";
$tables[4]="CREATE TABLE papared_user (id int(5) NOT NULL auto_increment,document char(50) NOT NULL,";
$tables[4].="name char(50) NOT NULL,dress char(100),phone char(20) NOT NULL,password char(15) NOT NULL,";
$tables[4].="editor char(50) NOT NULL,email char(50) NOT NULL,regist_time date DEFAULT '0000-00-00' NOT NULL,";
$tables[4].="PRIMARY KEY (id),KEY id (id, document, name),UNIQUE id_2 (id, document))";
$tables[5]="CREATE TABLE user (id int(5) NOT NULL auto_increment,document char(50) NOT NULL,";
$tables[5].="name char(50) NOT NULL,dress char(100),phone char(20) NOT NULL,lend_number tinyint(4) NOT NULL,";
$tables[5].="prepare_number tinyint(4) NOT NULL, password char(15) NOT NULL,editor char(50) NOT NULL,";
$tables[5].="email char(50) NOT NULL,PRIMARY KEY (id),KEY id (id, document, name),UNIQUE id_2 (id, document))";
for($i=0;$i<6;$i++)
@mysql_query($tables[$i],$conn) or die ("<p align=center>在创建第".($i+1)."个表格时出现错误");
echo "<p align=center>表格创建完成</p>";
}
echo "<p align=center>请在下面输入你的管理员名称和密码:<br>";
echo "<form action=\"setup_date.php?mode=ok\" method=\"post\">";
echo "用 户 名:<input type=text name=names size=20><br>";
echo "密 码:<input type=\"password\" name=password1 size=20><br>";
echo "密码确实:<input type=password name=password2 size=20><br>";
echo "<input type=submit value=\"提交\">";
}
if($mode=="ok")
{
include("header.php");
if($names=="" || $password1=="" || $password2=="" )
{
echo "<p align=center>各选项输入不能为空</br>";
echo "<a href=\"setup_date.php?mode=create\">返回</a>";
exit();
}
if($password1 != $password2)
{
echo "<p align=center>你两次输入的密码不同</br>";
echo "<a href=\"setup_date.php?mode=create\">返回</a>";
exit();
}
$sql="insert into manage (name,password) values ('".$names."','".$password1."')";
@mysql_query($sql,$conn) or die ("<p align=center>在向数据库写入用户名和密码时发生错误");
echo "<p align=center>数据库安装完成,请删掉此安装文件</p>";
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -