php简单的记账
<?php
include_once("shangmian.php");
?>
<?php
//======================================================
/// 查询
///=====================================================
foreach ($_GET as $key=>$v){
${$key}=$v;
}
$lines = file ('zhangmu.txt');
$rs=array();
$n=0;
foreach ($lines as $line_num => $line) {
if($line_num>0){
$t=0;
$p = explode('|',$line);
if($Submit<>""){
if(strstr($p[0],$chaxun)||strstr($p[1],$chaxun)||strstr($p[2],$chaxun)||strstr($p[3],$chaxun)||strstr($p[4],$chaxun)){
$t=1;
}
}
if ($Submits<>""){
if(strstr($p[1],$chaxuns)&&strstr($p[2],$chaxunx)||
strstr($p[1],$chaxuns)&&strstr($p[3],$chaxunx)||
strstr($p[1],$chaxuns)&&strstr($p[4],$chaxunx)||
strstr($p[2],$chaxuns)&&strstr($p[1],$chaxunx)||
strstr($p[2],$chaxuns)&&strstr($p[3],$chaxunx)||
strstr($p[2],$chaxuns)&&strstr($p[4],$chaxunx)||
strstr($p[3],$chaxuns)&&strstr($p[1],$chaxunx)||
strstr($p[3],$chaxuns)&&strstr($p[2],$chaxunx)||
strstr($p[3],$chaxuns)&&strstr($p[4],$chaxunx)||
strstr($p[4],$chaxuns)&&strstr($p[1],$chaxunx)||
strstr($p[4],$chaxuns)&&strstr($p[2],$chaxunx)||
strstr($p[4],$chaxuns)&&strstr($p[3],$chaxunx)
){
$t=1;
}
}
}
if($t==1){
$rs[$n]['sz']=$p[2];
$rs[$n]['je']=$p[0];
$rs[$n]['fl']=$p[1];
$rs[$n]['bz']=$p[3];
$rs[$n]['sj']=$p[4];
$n ;
}
}
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="5"></td>
</tr>
</table>
<table width="550" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#B3B3B3">
<tr>
<th width="60" bgcolor="#EBEBEB">收支情况</th>
<th width="76" bgcolor="#EBEBEB">金额</th>
<th width="77" bgcolor="#EBEBEB">账户</th>
<th width="133" bgcolor="#EBEBEB">备注</th>
<th width="78" bgcolor="#EBEBEB">时间</th>
<th width="59" bgcolor="#EBEBEB">操作</th>
</tr>
<? foreach ($rs as $k=>$v) { ?>
<tr>
<td align="center" bgcolor="#FFFFFF"><img src="img/<? echo $v['sz'] ?>.GIF" width="20" height="20" /></th>
<td align="center" bgcolor="#FFFFFF"><? echo $v['je']; ?>
</th>
</td>
<td align="center" bgcolor="#FFFFFF"><? echo $v['fl']; ?></th>
<td align="center" bgcolor="#FFFFFF"><? echo $v['bz']; ?></th>
<td align="center" bgcolor="#FFFFFF"><? echo $v['sj']; ?></th>
<td align="center" bgcolor="#FFFFFF"> </th>
</tr>
<? $count = $v['je']; //计算
} ?>
<tr>
<td align="center" bgcolor="#FFFFFF">搜索结果
<td align="center" bgcolor="#FFFFFF"><?php echo $count; ?>
<td align="center" bgcolor="#FFFFFF">
<td align="center" bgcolor="#FFFFFF">
<td align="center" bgcolor="#FFFFFF">
<td align="center" bgcolor="#FFFFFF">
</tr>
</table>
<form action="" method="get" style=" margin-top:5px;" >
<table width="550" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#B3B3B3">
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="chaxun" id="chaxun"
style="WIDTH: 200px" value="模糊查询" onfocus="if (this.value=='模糊查询') this.value=''" size="35" /> <input class="BtnStyle" style="WIDTH: 64px" type="submit" value="查询" name="Submit" id="Submit" />
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF" width=100%>提示:查年月日格式:2013/01/30 查年:2013/ 查月:2013/01 <br />查收支: 或则 -
</tr>
</table>
</form>
<form action="" method="get" style=" margin-top:5px;" >
<table width="550" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#B3B3B3">
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="chaxuns" id="chaxuns"
style="WIDTH: 200px" value="时间" onfocus="if (this.value=='时间') this.value=''" size="35" />
<input name="chaxunx" id="chaxunx"
style="WIDTH: 200px" value="条件" onfocus="if (this.value=='条件') this.value=''" size="35" />
<input class="BtnStyle" style="WIDTH: 64px" type="submit" value="查询" name="Submits" id="Submits" />
</tr>
</table>
</form>
<?php
include_once("xiamian.php");
?>
评论