include_once 'inc.php';
secure("book",0,100);
$table = "book";
$caption = "書本";
$key = "book";
$page_qry = "select book,main,vertical,x,y,user,ldate from book order by book";
$page_th = "
| 書本 | 主要 | 垂直 | X | Y | 更改 | 日期 | ";
$search = "concat(book,choice)";
layout(1,$caption,1);
processing($page_qry, $page_th, 10);
layout(2);
//---------------------------------- add/edit screen of record $id
function localRecord() {
global $table, $db, $sql, $_FILES, $max_upload, $choice, $act, $act2, $act3, $msg;
global $id, $user, $ldate, $f1, $f2, $f3, $f4, $f5;
// --------------------------------- load record $id if not adding
if ( $id) {
$qry = "select book,main,vertical,x,y,choice,user,ldate from book where book=\"$id\"";
if ( !($res = mysql_db_query($db, $qry, $sql))) {die(mysql_error(). " in $qry"); }
if ( ($all = mysql_num_rows($res))==0 ) {
$msg = "沒有這筆紀錄 \n";
} else {
$row = mysql_fetch_array($res, MYSQL_BOTH);
}
}
// --------------------------------- display record $id, submit with act3
if ( $act2 !== $choice['add'] ) $ro1 = 'readonly';
if ( ! ( $act2 == $choice['edit'] || $act2 == $choice['add'] ) ) $ro = 'readonly';
print "\n";
print " ";
if (!empty($act2)) print " \n";
if ($act2<>$choice['add']) print " ";
print $msg;
print "";
}
// -------------------------------- display one row,
function localSayPage($row) {
global $choice, $editor;
print " |
|---|
| $row[0] | $row[1] | $row[2] | $row[3] | $row[4] | $row[5] | $row[6] ";
print ' | ';
$but = " ";
if ( secure("delete", 'silent') ) print $but." value=". $choice['delete']. ">";
print $but." value=". $choice[ $row[6]=='Y' ? 'enable' : 'disable']. ">";
print " |
\n";
}
// -------------------------------- update row $id
// if need to insert, caller did before calling and setted $id
function localSaveRecord() {
global $table, $db, $sql, $_FILES, $max_upload, $choice, $act, $act2, $act3, $imgarray, $user, $msg;
global $id, $f1, $f2, $f3, $f4, $f5, $f6, $f7;
$f1 = chk2($f1);
$f2 = chk2($f2);
$qry = "update book set main=\"$f1\", vertical=\"$f2\", x=\"$f3\", y=\"$f4\", choice=\"$f5\",user=\"$user\", ldate=now() where book=\"$id\"";
if ( !($res = mysql_db_query($db, $qry.$qry8, $sql))) { $msg = mysql_error(). " in $qry"; }
}
function localProcess($actX) {}
?>