您现在的位置: 军旅同心-旅游自驾-军旅文学 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 正文
图书管理程序(二)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:35:56
图书目录输入部分:
<?
if(!$UploadAction):
?>
<?
//本程序是为输入书名,作者、出版社资料而设。
//编者:孔秀祥。日期:2001/3/24
/*
session_start();
if (!isset($auth_passed)) {
echo "本功能只有授权用户才能使用。";
return -1;
}

if(isset($u_name)) {
  session_name($u_name);

//echo "<center><font color='red'>".session_name().":本程序将竭诚为您服务。</font></center> ";
//echo "<hr>";
}
*/
?>
<HTML><HEAD>
<TITLE>图书目录输入 </TITLE>
</HEAD>
<BODY><TABLE align=CENTER>
<FORM ENCTYPE= "multipart/form-data" NAME = "SubmitForm"
ACTION= "<? $PHP_SELF ?>" METHOD = "POST">
<INPUT TYPE= "hidden" NAME = "MAX_FILE_SIZE" VALUE ="20000000">
<INPUT TYPE= "hidden" NAME = "UploadAction" VALUE = "1">

<!--TR><TD>文件名<TD><INPUT NAME = "UploadFile" TYPE = "file" VALUE="" SIZE = "30"></TR-->
<TR><TD align=center>著作名<TD><INPUT NAME = "b_name" TYPE = "text" VALUE="" SIZE = "30" maxlength=100></TD></TR>
<TR><TD align=center>作者<TD>姓<INPUT NAME = "a_first1" TYPE = "text" VALUE="" SIZE = "6" maxlength=20>
名<INPUT NAME = "a_last1" TYPE = "text" VALUE="" SIZE = "6" maxlength=20></TD></TR>
<TR><TD align=center>作者<TD>姓<INPUT NAME = "a_first2" TYPE = "text" VALUE="" SIZE = "6" maxlength=20>
名<INPUT NAME = "a_last2" TYPE = "text" VALUE="" SIZE = "6" maxlength=20></TD></TR>
<TR><TD align=center>作者<TD>姓<INPUT NAME = "a_first3" TYPE = "text" VALUE="" SIZE = "6" maxlength=20>
名<INPUT NAME = "a_last3" TYPE = "text" VALUE="" SIZE = "6" maxlength=20></TD></TR>
<TD>编著方式</TD>
<TD>
<SELECT size="1" name="author_type" TYPE = "int" default=11>
<OPTION selected value="11">&nbsp;&nbsp;著 </OPTION>
<OPTION selected value="12">&nbsp;编著 </OPTION>
<OPTION value="13">&nbsp;主编</OPTION>
<OPTION value="14">副主编</OPTION>
<OPTION value="15"> &nbsp;参编</OPTION>
<OPTION value="16"> &nbsp;&nbsp;注 </OPTION>
<OPTION value="17"> &nbsp;&nbsp;编 </OPTION>
<OPTION value="18"> &nbsp;&nbsp;选 </OPTION>
<OPTION value="19"> &nbsp;&nbsp;评 </OPTION>
<OPTION value="20">&nbsp;其他</OPTION>
</SELECT>
&nbsp;&nbsp;定价<INPUT NAME = "b_price_a" TYPE = "text" VALUE="" SIZE = "3">.<INPUT NAME = "b_price_b" TYPE = "text" VALUE="" SIZE = "2">元
</TR>

<TR><TD align=center>出版社<TD><INPUT NAME = "p_name" TYPE = "text" VALUE="" SIZE = "30" maxlength=100></TD></TR>
<TR><TD>出版日期<TD><INPUT NAME = "p_year" TYPE = "text" VALUE="" SIZE = "4">年
<INPUT NAME = "p_month" TYPE = "text" VALUE="" SIZE = "2">月  
<TR><TD>ISBN<TD><INPUT NAME = "isbn" TYPE = "text" VALUE="" SIZE = "25">

<TR><TD rowspan=5>有关书的说明</TD>
<!--/TR><TR-->
<TD rowspan=5><TEXTAREA wrap=on rows="5" cols="30" NAME = "b_comment" SIZE = "255">
</TEXTAREA></TD>
</TR>
</TABLE>

<TABLE align=center>
<TR><TD align=center>
<INPUT NAME = "submit" VALUE = "提交" TYPE = "submit">
<TD><INPUT NAME = "reset" VALUE = "重置" TYPE = "reset">
</TD></TR>
</FORM></CENTER></TABLE></BODY>

</HTML>

<?

else:
session_start();
require "config.php3";

$b_price=trim($b_price_a).".".trim($b_price_b);
if(strlen($p_month)==1)
     $p_month="0".trim($p_month);
if($p_month=="")
    $p_month="01";
$date_pub=trim($p_year)."-".trim($p_month)."-01";

$UploadAction=0;
$repeat=0;      //是不是重复了。
$TimeLimit=0; //设置超时限制时间缺省时间为 30秒设置为0时为不限时
set_time_limit($TimeLimit);
@MYSQL_CONNECT($hostname,$dbusername,$dbpassword) OR DIE("不能连接数据库!");
@mysql_select_db("$dbname") or die("不能选择数据库!");
//$q="select books.books_id, books.books_name,author.first_name,author.last_name,publisher.publisher_name from books,author,books_author,publisher where books.books_name="$b_name" and books.publisher_id=publisher.publisher_id and books.books_id=books_author.books_id and books_author.author_id=author.author_id";

$b_name=trim($b_name);
$sele="select books.books_id, books.books_name,author.first_name,author.last_name,publisher.publisher_name,books.ISBN,books.price,books.date_pub,books.pages";
$fro=" from books,author,books_author,publisher ";
if(trim($isbn)!="")
    $whe="where books.ISBN="$isbn" ";
elseif(trim($a_first1)!="" && trim($a_last1)!="" && trim($p_name)!="")
    $whe=" where books.books_name="$b_name" and books.publisher_id=publisher.publisher_id and books.books_id=books_author.books_id and books_author.author_id=author.author_id";
else{
    $msg="书名为必填,其他如果ISBN为空,则作者的姓、名,出版社为必填。<BR>请检查是否符合要求。";
    xueroom_error_exit($msg,$PHP_SELF);

}
$q="$sele$fro$whe";

/*
books.books_id,  
books.books_name,
author.first_name,
author.last_name,
publisher.publisher_name
books.ISBN,
books.price,
books.date_pub,
books.pages
*/
$r = @mysql_query($q);
//             $count=@mysql_fetch_row($r);
//             echo "书名".$count[1]."<BR>";
if(!$r){
    echo "查询无效 <BR>";
    exit;
}
if(mysql_num_rows($r)){
    if(trim($isbn)!=""){
        echo "数据重复。<BR>";
        exit;
    }
    else
while($count=mysql_fetch_array($r)){  
/*
          echo "while。<BR>";
          echo trim($a_first1);
          echo trim($count[2]);
          echo trim($a_first1)==trim($count[2]);
          echo "<BR>";
          echo trim($a_last1)==trim($count[3]);
          echo "<BR>";
          echo trim($p_name)==trim($count[4]);
          echo "<BR>";
          */
    if( trim($a_first1)==trim($count[2]) && trim($a_last1)==trim($count[3]) && trim($p_name)==trim($count[4])){
        $data_exist+=1;
        $books_id=$count[0];
        $books_name=$count[1];     
        $first_name=$count[2];
        $last_name=$count[3];
        $repeat=1;
        echo "本书已经在数据库中。<BR>";     
        echo "<font color='red'>书名:</font>".$books_name;
        echo "<BR><font color='blue'>作者:</font>".$first_name.$last_name;
        echo "<BR><font color='red'>国标标准书号:</font>".$count[5];
        echo "<BR><font color='blue'>书价:</font>".$count[6]."元";
        echo "<BR><font color='red'>出版日期:</

[1] [2] [3] 下一页


更多
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 网站地图 | 版权申明 | 网站公告 | 管理登录 |