📄 modsubco.php
字号:
<?
require('session.inc');
require('connect.inc');
if ($usern!=-1)
{
html_header("非法登录,拒绝访问 - ACCESS DENIED",'<META http-equiv="refresh" content="3; url=index.php">');
echo "<td align=right valign=center><br>
Sorry, 您正想非法登录本系统,请正常登录!<br>系统会在3秒后自动返回登录页面。
<br><br><br><a href=index.php>返回登录</a></td>";
html_footer();
}
else
{
?>
<html>
<head>
<title>::: DATABASE 化妆品公司数据库管理系统 - 修改分公司信息 :::</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="common.css" type="text/css">
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') {
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="770" border="0" cellspacing="0" cellpadding="0" align="center" height="450">
<tr>
<td background="images/bg2.jpg">
<table width="770" border="0" cellspacing="0" cellpadding="0" height="450">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="450">
<tr>
<td height="140" class="bigh"><font color=#ff3333>修改分公司信息</font></td>
</tr>
<tr>
<td valign=top>
<?
if ($step==0)
{
$str_sql="select stid,stname from STOREHOUSETB where stid > '-1' and isactive= '1';";
$result=mysql_db_query($db,$str_sql,$link_id);
if (!$result) html_error_exit('MySQL查询命令失败!');
else
{
?>
<table width="45%" border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td>
<form name="form1" method="post" action="modsubco.php?step=1">
<p><b><font face=Arial>Step 1 </font>- 选择要修改的分公司</b></p>
<p>
<select name="stid">
<?
$html='';
while ($record=mysql_fetch_object($result))
$html.='<option value="'.$record->stid.'">'.$record->stname.'</option>';
echo $html;
?>
</select>
</p>
<p>
<input type="submit" name="Submit" value="修 改" onClick="MM_validateForm('stid','','RisNum','stname','','R','email','','RisEmail','pass1','','R','pass2','','R');return document.MM_returnValue">
<a href=index2.php>返回首页</a> </p>
</form>
</td>
</tr>
</table>
<?
}
}
else
{
if ($step==1)
{
$str_sql="select * from STOREHOUSETB where stid = '$stid';";
$result=mysql_db_query($db,$str_sql,$link_id);
if (!$result) html_error_exit('MySQL查询命令失败!');
else
{
$record=mysql_fetch_object($result);
$stname=$record->stname;
$email=$record->email;
?>
<table width="45%" border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td>
<form name="form1" method="post" action="modsubco.php?step=2">
<p><b><font face=Arial>Step 2 </font>- 修改分公司信息</b></p>
<p><b>分公司ID号</b>
<?
echo ' <input type="text" name="stid" size="20" maxlength="8" value="'.$stid.'">
</p>
<p><b>分公司名称</b>
<input type="text" name="stname" size="20" maxlength="20" value="'.$stname.'">
</p>
<p><b>分公司邮箱</b>
<input type="text" name="email" size="20" maxlength="20" value="'.$email.'">
<input type="hidden" name="oldid" value="'.$stid.'">
<input type="hidden" name="oldname" value="'.$stname.'">
</p>';
?> <p>
<input type="submit" name="Submit" value="修改信息" onClick="MM_validateForm('stid','','RisNum','stname','','R','email','','RisEmail','pass1','','R','pass2','','R');return document.MM_returnValue">
<input type="reset" name="reset" value="重置表单"> <a href=index2.php>返回首页</a></p>
</form>
</td>
</tr>
</table>
<? }
}
else
{
$flag=0;
$str_sql="select stid,isactive from STOREHOUSETB where (stid = '$stid' or stname = '$stname') and stid <> '$oldid';";
$result=mysql_db_query($db,$str_sql,$link_id);
if (!$result) html_error_exit('MySQL查询命令失败!');
else
{
$num=@mysql_num_rows($result);
if ($num>0)
{
while ($record=mysql_fetch_object($result))
if ($record->isactive==1||$record->stid==$stid) $flag=1;
}
}
if ($flag==1)
{
echo "<div align=right><br>分公司ID号或分公司名称已经存在,不能重复,请重新修改
<br><br><br><a href=modsubco.php?step=0>返回重新修改</a></div>";
}
else
{
$str_sql="update STOREHOUSETB set stid = '$stid',
stname = '$stname',
email = '$email'
where stid= '$oldid';";
$result=mysql_db_query($db,$str_sql,$link_id);
if (!$result) html_error_exit('MySQL查询命令失败!');
else
{
echo "<div align=right><br>分公司信息修改成功,信息如下:<br><table border=0 width=25%><tr><td><li>分公司ID - $stid <li>分公司名称 - $stname <li>分公司邮箱 - $email </td></tr></table>
<br><br><br><a href=modsubco.php?step=0>返回继续修改</a> <a href=index2.php>返回首页</a></div>";
}
}
}
}
@mysql_close($link_id);
?>
</td>
</tr>
<tr>
<td height="40">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="40">
<tr>
<td valign="bottom" align="right"><font face="Arial"><b>Powered
by <img src="images/php.gif" width="39" height="20" align="absmiddle">
& <img src="images/mysql.gif" width="82" height="20" align="absmiddle"></b></font></td>
<td align="right" valign="bottom" width="200"><font face="Arial">©
<a href="mailto:lonelyp@etang.com">Lonely Passenger</a>,2001<br>
All rights reserved!</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -