textbook-management-system/基于PHP的教材管理系统/jgai.php

120 lines
4.3 KiB
PHP
Raw Blame History

<?php require_once('Connections/jc.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE laoshi SET xingming=%s, xi=%s, user_name=%s, password=%s WHERE jiaoshihao=%s",
GetSQLValueString($_POST['xingming'], "text"),
GetSQLValueString($_POST['xi'], "text"),
GetSQLValueString($_POST['user_name'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['jshao'], "text"));
mysql_select_db($database_jc, $jc);
$Result1 = mysql_query($updateSQL, $jc) or die(mysql_error());
$updateGoTo = "cg3.htm";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_Recordset1 = "-1";
if (isset($_GET['jiaoshihao'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['jiaoshihao'] : addslashes($_GET['jiaoshihao']);
}
mysql_select_db($database_jc, $jc);
$query_Recordset1 = sprintf("SELECT * FROM laoshi WHERE jiaoshihao = '%s'", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $jc) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><3E>ޱ<EFBFBD><DEB1><EFBFBD><EFBFBD>ĵ<EFBFBD></title>
<style type="text/css">
<!--
.txt {font-size: 12px;
color: #000000;
}
-->
</style>
</head>
<body topmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<?php include("head.php");?>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td align="center"><form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
<table width="300" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" class="txt">
<tr>
<td height="20" colspan="2" align="center"><3E>޸Ľ<DEB8>ʦ<EFBFBD><CAA6><EFBFBD><EFBFBD></td>
</tr>
<tr>
<td width="102" align="right"><3E><>ʦ<EFBFBD><CAA6>:</td>
<td width="198"><input name="jshao" type="text" id="jshao" value="<?php echo $row_Recordset1['jiaoshihao']; ?>" /></td>
</tr>
<tr>
<td align="right"><3E><> &nbsp;<3B><>:</td>
<td><input name="xingming" type="text" id="xingming" value="<?php echo $row_Recordset1['xingming']; ?>" /></td>
</tr>
<tr>
<td align="right">ϵ:</td>
<td><input name="xi" type="text" id="xi" value="<?php echo $row_Recordset1['xi']; ?>" /></td>
</tr>
<tr>
<td align="right"><3E><> &nbsp;<3B><>:</td>
<td><input name="user_name" type="text" id="user_name" value="<?php echo $row_Recordset1['user_name']; ?>" /></td>
</tr>
<tr>
<td align="right"><3E><> &nbsp;<3B><>:</td>
<td><input name="password" type="text" id="password" value="<?php echo $row_Recordset1['password']; ?>" /></td>
</tr>
</table>
<label>
<input type="submit" name="Submit" value="<22>޸<EFBFBD>" />
</label>
<input type="hidden" name="MM_update" value="form1">
</form>
</td>
</tr>
</table>
<?php include("foot.php");?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>