/bookmanage/resetdb.php
PHP | 31 lines | 27 code | 4 blank | 0 comment | 1 complexity | 9208efeb7202d7b65fcc5ce63196e5b8 MD5 | raw file
- <?php
- $chosen="General";
- include "side.php";
- echo ' <div id="main-content"> <!-- Main Content Section with everything -->';
- $con=mysql_connect("localhost","root","root");
- mysql_query("use bookmanage");
- $command="select * from administrator where aid='".$_REQUEST["aid"]."' and passwd='".$_REQUEST["passwd"]."'";
- $result=mysql_query($command);
- $row=mysql_fetch_array($result);
- if ($row) {
- mysql_query("drop table books");
- mysql_query("create table books (bookid char(20),type char(20),name char(50),publisher char(50),publish_year integer,author char(50),price integer,total_storage integer,storage integer,primary key (bookid))");
- mysql_query("drop table administrator");
- mysql_query("create table administrator (aid char(30),passwd char(30), name char(30),contact char(30),primary key (aid))");
- mysql_query("insert into administrator values('admin','admin','Ufotalent','15068154598')");
- mysql_query("drop table card");
- mysql_query("create table card (cid char(30),name char(30),station char(30),type char(30),primary key (cid))");
- mysql_query("drop table record");
- mysql_query("create table record (cid char(30),bookid char(20),aid char(30), bdate date, rdate date, foreign key (cid) references card, foreign key (aid) references administrator, foreign key (bookid) references books)");
- echo mysql_error();
- echo "reset";
- }
- else
- echo "authentication error";
- echo '</div>';
- echo "</html>"
- ?>