[Database System Concepts] My First Virtual Website~
2014-05-14 00:03
246 查看
This is my final project for course fundamental concept of database. The requirement is to build an online library mainly for inserting, deleting and searching information about books and administrators, relating
to local database.
There are mainly two parts. One part, the more important one, is to build a library database and some tables for information storage and operations. Another is to create a graphical interface in order to make all
the database operation more convenient and direct.
As for the graphical interface part, we can use either ide like QT and MFC or write a website. And I choose the second one, for the simple reason that it seems more funny.
I had no idea about how to build a website before. I borrowed books about HTML and CSS from library and did my own research on w3school, a great website for learner.
Required environment : Mysql Server 5.5 ; WampServer;
The overall exhibition:
-homepage:
-search:
-admin login:
-add book:
-borrow book:
---------------------------------------------------------------------
Part of the code:
HTML for homepage:
HTML and SQL for book_add:
Took me a week to finish all of these for about nearly 2000 lines of code. Frankly speaking, it feels really good when the work exhibits in front of your eyes. I learn PHP, HTML and CSS myself and the process means a lot to me.
Continue to post some of my works about information security and object-oriented class.
to local database.
There are mainly two parts. One part, the more important one, is to build a library database and some tables for information storage and operations. Another is to create a graphical interface in order to make all
the database operation more convenient and direct.
As for the graphical interface part, we can use either ide like QT and MFC or write a website. And I choose the second one, for the simple reason that it seems more funny.
I had no idea about how to build a website before. I borrowed books about HTML and CSS from library and did my own research on w3school, a great website for learner.
Required environment : Mysql Server 5.5 ; WampServer;
The overall exhibition:
-homepage:
-search:
-admin login:
-add book:
-borrow book:
---------------------------------------------------------------------
Part of the code:
HTML for homepage:
<?php session_start(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>深圳图书馆-首页 · Bootstrap</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="css/bootstrap.css" rel="stylesheet"> <style type="text/css"> #jum { background: url(libarary.jpg); height: 400px; } </style> <script language="javascript"> function check(form){ if (form.name.value==""){ alert("ID不能为空!");form.name.focus();return false; } if (form.pwd.value==""){ alert(form.name.value+"密码不能为空!");form.pwd.focus();return false; } } function quit_() { window.open('','_self'); window.close(); } </script> </head> <body> <?php if(isset($_SESSION['admin_id'])) header('Location: admin_login.php'); ?> <form name="form1" method="post" action="chklogin.php"> <div class="container"> <div class="masthead"> <h3 class="muted">以人为本 · 营造读者心仪的天堂</h3> <div class="navbar"> <div class="navbar-inner"> <div class="container"> <ul class="nav"> <li class="active"><a href="main.php">主页</a></li> <li><a href="search.php">资源检索</a></li> <li><a href="guide.php">读者指南</a></li> <li><a href="about.php">关于深图</a></li> </ul> </div> </div> </div><!-- /.navbar --> </div> <div id="jum" class="hero-unit"> <h1>深圳图书馆</h1> <p>设计藏书容量400万册 • 读者座席2000个 • 网络节点3000个 • 日均可接待读者8000人次</p> </div> <hr> <div class="row-fluid"> <div class="span8"> <h3> 管理员登陆</h3> <form class="form-horizontal" action="chklogin.php" method="POST"> <div class="control-group"> <label class="control-label" for="inputEmail"> ID:</label> <div class="controls"> <input name="name" type="text" class="logininput" id="inputEmial" placeholder="请输入ID"> </div> </div> <div class="control-group"> <label class="control-label" for="inputPassword"> 密码:</label> <div class="controls"> <input name="pwd" type="password" class="logininput" id="inputPassword" placeholder="请输入密码" > </div> </div> <div class="control-group"> <div class="controls"> <span> </span> <input name="submit" type="submit" class="btn" value="登陆" onClick="return check(form1)"> </div> </div> </form> </div> </div> <hr> <div class="footer"> <p>© 浙江大学计算机学院</p> </div> </div> <script src="js\bootstrap.js"></script> </body> </html>
HTML and SQL for book_add:
<?php session_start(); include("conn/conn.php"); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>深圳图书馆-首页 · Bootstrap</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="css/bootstrap.css" rel="stylesheet"> <script language="javascript"> function check(form) 4000 { if (form.id.value==""){ alert("请输入书号");form.id.focus();return false; } if (form.name.value==""){ alert("请输入书名");form.name.focus();return false; } } </script> </head> <body> <form name="form1" method="POST" action="add_library.php"> <div class="container"> <div class="masthead"> <h3 class="muted">以人为本 · 营造读者心仪的天堂</h3> <div class="navbar"> <div class="navbar-inner"> <div class="container"> <ul class="nav"> <li class="active"><a href="main_admin.php">主页</a></li> <li><a href="search.php">资源检索</a></li> <li><a href="guide.php">读者指南</a></li> <li><a href="about.php">关于深图</a></li> </ul> </div> </div> </div> </div> <div class="container-fluid"> <div class="row-fluid"> <div class="span2"> <ul class="nav nav-list"> <li class="nav-header">欢迎您:<?php echo $_SESSION["admin_id"];?> </li> <li class="divider"></li> <li><a href="admin_login.php">首页</a></li> <li class="active"><a href="admin_add.php">图书入库</a></li> <li><a href="admin_borrow.php">借书</a></li> <li><a href="admin_back.php">还书</a></li> <li><a href="admin_ID.php">借书证管理</a></li> <li><a href="admin_about.php">管理员信息</a></li> <li class="divider"></li> <li><a href="quit.php">注销</a></li> </div> <div class="span4"> <form class="form-horizontal" action="add_library.php" method="POST"> <br> <br> <label class="control-label">书号</label> <div class="controls"> <input name="id" type="text" class="logininput" id="inputEmial"> </div> <label class="control-label">类别</label> <div class="controls"> <input name="category" type="text" class="logininput" id="inputEmial"> </div> <label class="control-label">书名</label> <div class="controls"> <input name="name" type="text" class="logininput" id="inputEmial"> </div> <label class="control-label">出版社</label> <div class="controls"> <input name="publisher" type="text" class="logininput" id="inputEmial"> </div> <label class="control-label">作者</label> <div class="controls"> <input name="author" type="text" class="logininput" id="inputEmial"> </div> <label class="control-label">年份</label> <div class="controls"> <input name="year" type="text" class="logininput" id="inputEmial"> </div> <label class="control-label">价格</label> <div class="controls"> <input name="price" type="text" class="logininput" id="inputEmial"> </div> <label class="control-label">数量</label> <div class="controls"> <input name="num" type="text" class="logininput" id="inputEmial"> </div> <div class="control-group"> <div class="controls"> <input name="submit" type="submit" class="btn btn-primary" value="入库" onClick="return check(form1)"> <a href="admin_add.php"><button class="btn" type="button">继续添加</button></a> </div> </div </form> </form> </div> <div class="span4"> <dl class="dl-horizontal"> <br> <form class="form-horizontal" action="test.php" method="POST"> <div class="control-group"> <h4>批量入库:</h4> </div> <div class="controls"> <input name="submit" type="submit" class="btn btn-primary" value="确认" > </div> </form> </dl </div> </div> </div> <hr> <div class="footer"> <p>© 浙江大学计算机学院</p> </div> </div> <script src="js/jquery.js"></script> <script src="js/bootstrap.js"></script> </body> </html>
<?php session_start(); include("conn/conn.php"); $book_id = $_POST['id']; $book_category = $_POST['category']; $book_name = $_POST['name']; $book_publisher = $_POST['publisher']; $book_author = $_POST['author']; $book_year = $_POST['year']; $book_price = $_POST['price']; $book_num = $_POST['num']; $sql = mysql_query("insert into book(book_id, category, book_name, publisher, writer, price, pub_time) values ('$book_id', '$book_category', '$book_name', '$book_publisher', '$book_author', '$book_price', '$book_year')"); $sqll = mysql_query("insert into warehouse(book_id, total_num, left_num) values ('$book_id', $book_num, $book_num)"); if($sqll && $sql){ echo "<script language='javascript'> alert('图书信息录入成功!'); history.back();</script>"; } else{ echo "<script language='javascript'> alert('图书信息录入失败!'); history.back();</script>"; } ?>
Took me a week to finish all of these for about nearly 2000 lines of code. Frankly speaking, it feels really good when the work exhibits in front of your eyes. I learn PHP, HTML and CSS myself and the process means a lot to me.
Continue to post some of my works about information security and object-oriented class.
相关文章推荐
- Database System Concepts
- Database system concept笔记(3)
- Ruby—My First Real Ruby Website
- Database System Concepts (1) -- Data Storage and Querying
- First day to reown this website of my own
- Database system concept笔记(4)
- Database System Concepts (4) -- Indexing and Hashing
- DATABASE SYSTEM CONCEPTS
- Database system concept笔记(1)
- Database System Concepts
- Database System Concepts (1) -- Data Models
- 【作品】My first special topic website
- Database System Concepts (2) -- SQL
- DATABASE SYSTEM CONCEPTS
- Manage the database-Manage my umbraco website (2)
- My first blog Article.
- 写一个程序,用于分析一个字符串中各个单词出现的频率,并将单词和它出现的频率输出显示。(单词之间用空格隔开,如“Hello World My First Unit Test”);
- 写一个程序,用于分析一个字符串中各个单词出现的频率,并将单词和它出现的频率输出显示。(单词之间用空格隔开,如“Hello World My First Unit Test”);
- Operating System Concept 读书笔记
- Windows Live Writer Test and Some of My First Thoughts