⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 person.php

📁 一个用php+mysql做的图书馆管理系统
💻 PHP
字号:
<?php
/**************************************************************************************

    Simple Library System
    Copyright (C) 2002 John Mark Matthews

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    For further information, contact:
    	John Matthews
    	jmatthews@exostrategy.com

***************************************************************************************/

include("mainfile.inc");
include("header.inc");
include("footer.inc");
include("auth.inc");

reg('GET','login_id','option');
reg('POST','submit','login','last_name','first_name','address_info','login_id','person_id');

if($login_id) {
	$sql = "select login, p.* from tbl_login l, tbl_person p where l.login_id=$login_id and l.login_id=p.login_id";
	$r = mysql_query($sql);
	$person = mysql_fetch_array($r);
}
if($global_is_admin && $option=="EDIT") {
	if($person_id && $login_id) {
		if($login=="") {
			mysql_query("delete from tbl_login where login_id=$login_id");
			mysql_query("delete from tbl_login where login_id=$login_id");
		}else{
			mysql_query("update tbl_login set login='$login' where login_id=$login_id");
			mysql_query("update tbl_person set last_name='$last_name', first_name='$first_name', address_info='$address_info' where login_id=$login_id");
		}
		echo " <html> <head> <title>edit window</title> </head> <body onload='javascript:self.close()'> </body> </html> ";
	}else{
		head();
		OpenForm("'./person.php?option=EDIT'");
		OpenTable();
		echo "<tr><th align=left>Login:     </th><td align=left><input type='text' name='login' value='".$person["login"]."'></td></tr>";
		echo "<tr><th align=left>Last Name: </th><td align=left><input type='text' name='last_name' value='".$person["last_name"]."'></td></tr>";
		echo "<tr><th align=left>First Name:</th><td align=left><input type='text' name='first_name' value='".$person["first_name"]."'></td></tr>";
		echo "<tr><th align=left>Delivery:  </th><td align=left><input type='text' name='address_info' value='".$person["address_info"]."'></td></tr>";
		echo "<tr><td colspan='4' align='center'> <input type='hidden' name='login_id' value=".$person["login_id"]."></td></tr>";
		echo "<tr><td colspan='4' align='center'> <input type='hidden' name='person_id' value=".$person["person_id"]."></td></tr>";
		echo "<tr><td colspan='4' align='center'> <input align='center' name='sub' type='submit' value = 'Update Person'></td></tr>";
		CloseTable();
		CloseForm();
		foot();
	}
}else{
	head();
	OpenTable();
	echo "<tr><th align=left>Login:    </th><td align=left>".$person["login"]."</td></tr>";
	echo "<tr><th align=left>Name:     </th><td align=left>".$person["first_name"]." ".$person["last_name"]."</td></tr>";
	echo "<tr><th align=left>Delivery: </th><td align=left>".$person["address_info"]."</td></tr>";
	echo "<tr><td><input type='button' value='Close' onClick='javascript:self.close()'></td></tr>";
	CloseTable();
	foot();
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -