📄 viewstore.php
字号:
<?
require('session.inc');
require('connect.inc');
if ($usern=="none")
{
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">
</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>
<div align="right"><br>
<table width="45%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?
if ($usern>-1) $str_sql="select * from STORAGETB where stid = '$usern';";
else $str_sql="select * from STORAGETB;";
$result=mysql_db_query($db,$str_sql,$link_id);
if (!$result) html_error_exit('MySQL查询命令失败!');
if (!($nor=@mysql_num_rows($result)))
if ($usern>-1) echo "<p> $gs 无库存</p>";
else echo "<p>无库存</p>";
else
{
$num=$page*10;
$dp=$page+1;
$num0=$num+1;
$maxp=ceil($nor/10);
if ($page<$maxp-1) $num1=$dp*10;
else $num1=$nor;
if ($usern>-1) $str_sql="select * from STORAGETB where stid = '$usern' limit $num,10;";
else $str_sql="select * from STORAGETB order by stid limit $num,10;";
$result=mysql_db_query($db,$str_sql,$link_id);
if (!$result) html_error_exit('MySQL查询命令失败!');
if ($usern>-1) echo " $gs 中的库存 <br>";
?>
<table width="100%" border="0" cellspacing="2" cellpadding="1">
<tr>
<?
if ($usern==-1) echo ' <td width="30%" bgcolor="#000000">
<div align="center"><font color="#FFFFFF"><b>分 公 司</b></font></div>
</td>';
?>
<td width="50%" bgcolor="#000000">
<div align="center"><font color="#FFFFFF"><b>产 品 名</b></font></div>
</td>
<td bgcolor="#000000">
<div align="center"><font color="#FFFFFF"><b>库 存 量</b></font></div>
</td>
</tr>
<?
$html='';
$bgc='DDDDDD';
while ($record=mysql_fetch_object($result))
{
if ($bgc=='DDDDDD')
$bgc='EEEEEE';
else
$bgc='DDDDDD';
$amount=$record->amount;
$pid=$record->pid;
$stid=$record->stid;
if ($usern==-1)
{
$str_sql="select stname,isactive from STOREHOUSETB where stid = '$stid';";
$res=mysql_db_query($db,$str_sql,$link_id);
if (!$res) html_error_exit('MySQL查询命令失败!');
$rec=mysql_fetch_object($res);
$stname=$rec->stname;
if (!($rec->isactive)) $stname.="(已关闭)";
}
$str_sql="select pname from PRODUCTTB where pid = '$pid';";
$res=mysql_db_query($db,$str_sql,$link_id);
if (!$res) html_error_exit('MySQL查询命令失败!');
$rec=mysql_fetch_object($res);
$pname=$rec->pname;
$html.=' <tr bgcolor='.$bgc.'>';
if ($usern==-1)
$html.="<td>$stname</td>";
$html.=' <td width="50%">'.$pname.'</td>
<td>'.$amount.'</td>
</tr>';
}
$html.='</table><br><div align=center>';
echo $html;
if ($page!=0) {
$n=$page-1;
echo "<a href=viewstore.php?page=0>第一页</a> <a href=viewstore.php?page=$n>上一页</a> ";
}
echo " <a href=index2.php>返回首页</a> ";
if (($maxp!=0)&&($page<($lp=$maxp-1))) {
$n=$page+1;
echo " <a href=viewstore.php?page=$n>下一页</a> <a href=viewstore.php?page=$lp>最后页</a>";
}
echo "</div>";
}
?> </td>
</tr>
</table>
<br>
</div>
</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 + -