快疯了,问个比较麻烦的问题!!

x198909253132 2009-08-13 01:54:43
<? ob_start (); ?>
<? session_start (); ?>
<?php
include "../conn/public.php";
include "msgcode.php";
$c_user=$_SESSION['c_user']; //提取SESSION用户名
$c_company=$_SESSION['c_company']; //提取SESSION密码
$c_loginpwd=$_SESSION['c_loginpwd']; //提取SESSION密码
$account_id=$_SESSION['account_id']; //提取SESSION密码

?>
<?php
$a=mysql_query("select * from company_user where c_user = '$c_user' and c_loginpwd='$c_loginpwd'");
$b=mysql_fetch_array($a) or die ("<script>alert(\"对不起,您还没有登录,或登录已超时,请重新登录!\");parent.location.replace('../index.php');</script>");
?>
<link href="../style/ufax.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.onon{background-color:#dddddd}
.ouou{}
-->
</style>

<?php
$v = $_REQUEST['v'];
$account = $_REQUEST['account'];
$faxnum = $_REQUEST['faxnum'];
$fp=fopen("D:/yellow.txt","a");
fwrite($fp,'1');
fclose($fp);
if ($v==3) {
$subfaxacc=$_REQUEST['subfaxacc'];
$subfax=$_REQUEST['subfax'];
$ai_id=$_REQUEST['ai_id'];
$a = mysql_query ("select * from customer_account where account_id = $subfaxacc limit 1");
$b = mysql_fetch_array ($a);
$c = mysql_query ("select * from customer_account where account_id = $account_id limit 1");
$d = mysql_fetch_array ($c);
$e = $b['ca_balance']+$d['ca_balance']; //企业账户和个人账户余额之和
$ary = mysql_query ("select * from customer_consume where ci_fax = $subfax");
$rec = mysql_num_rows($ary);
if ($rec>0) { //已经消费,保持账平衡,将余额和充值记录加入企业
/*更新余额*/
@mysql_query ("update customer_account set ca_balance = '$e' where account_id = $account_id");
/*更新subfax充值信息*/
@mysql_query ("update customer_payment set account_id = $account_id where account_id = $subfaxacc");
}
else { //没有消费,考虑已经充值,将赠送记录删除,其它加入企业
$ary2 = mysql_query ("select * from customer_payment where account_id = $subfaxacc and cp_memo != 1");
$rec2 = mysql_num_rows ($ary2);
if ($rec2>0) { //已经充值
/*更新余额*/
@mysql_query ("update customer_account set ca_balance = '$e' where account_id = $account_id");
/*更新subfax充值信息*/
@mysql_query ("update customer_payment set account_id = $account_id where account_id = $subfaxacc");
}
else {
//删除赠送的充值记录,并不更新企业余额
@mysql_query ("delete from customer_payment where account_id = $subfaxacc");
}
}
/*删除account_id信息*/
@mysql_query ("delete from customer_account where account_id = $subfaxacc");
/*更新subfax注册信息account_id*/
@mysql_query ("update customer_info set account_id = $account_id where account_id = '$subfaxacc'");
//计算新月租
$priRes = mysql_query ("select count(*) from customer_info where account_id = $account_id");
$priNum = mysql_fetch_array($priRes);
$new_rentmonth = ceil(($d['ca_rentmonth'] * ($priNum[0] - 1) + $b['ca_rentmonth']) / $priNum[0]);
@mysql_query ("update customer_account set ca_rentmonth = '$new_rentmonth' where account_id = $account_id");
}
?>



<?php
$fp=fopen("D:/yellow.txt","a");
fwrite($fp,'2');
fclose($fp);
if ($v==9) {
$subfax_ids=$_REQUEST['subfax_ids'];
$sub_fax = explode(",", $subfax_ids);
for ($i=1;$i<sizeof ($sub_fax);$i++) {
$a = @mysql_query ("select * from customer_info where ci_id = '$sub_fax[$i]' limit 1");
$b =@mysql_fetch_array($a);
if ($b[account_id]!=$account_id) {
header ("location:msg.php?v=5");
exit ();
}elseif(90<=$b[ci_num]&&$b[ci_num]<100){
header ("location:msg.php?v=27");
exit ();
}elseif(date("Y-m")==date("Y-m",strtotime($b['ci_regtime']))||date('Y-m-d h', mktime(6,0,0,date('n'),1,date('Y')))>date("Y-m-d h")){
header ("location:msg.php?v=28");
exit ();
}
else {
$subfax_limit = $b[ci_fax];
//删除用户注册信息
mysql_query ("delete from customer_info where ci_fax = '$subfax_limit'");
//删除用户传真信息
mysql_query ("delete from email_fax where ci_fax = '$subfax_limit'");
//删除用户邮件信息
mysql_query ("delete from fax_email where ci_fax = '$subfax_limit'");
//删除用户消费信息
mysql_query ("delete from customer_consume where ci_fax = '$subfax_limit'");
//删除用户notice_send信息
mysql_query ("delete from notice_send where ci_fax = '$subfax_limit'");
//删除用户地址本信息
mysql_query ("delete from address_note where ci_fax = '$subfax_limit'");
//删除用户真实验证
@mysql_query("delete from fax_realcheck where ci_fax = '$subfax_limit'");
//删除用户黑名单
@mysql_query("delete from customer_blacklist where ci_fax = '$subfax_limit'");
//删除用户电话广播设置
@mysql_query("delete from phone_service where ci_fax = '$subfax_limit'");
//添加删除号码到号码列表
mysql_query ("insert into num_lib (ci_fax,nl_flag) values ('$subfax_limit','0') ");

}
}
}
?>

<?

$fp=fopen("D:/yellow.txt","a");
fwrite($fp,'3');
fclose($fp);

if ($v!=22) {
$fp=fopen("D:/yellow.txt","a");
fwrite($fp,'4');
fclose($fp);

?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="header">

<tr>
<td><img src="../search/images/sys1.gif" width="96" height="36" border="0"></td>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/b.jpg" height="36" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td bgcolor="#73A2D6" class="blue9">
<img src="images/p.gif" width="23" height="23" align="absmiddle">
<span class="white9">

系统提示

</span>
</td>

</tr>

<tr>
<td valign="top">
</td>
</tr>

</table>
<?

$fp=fopen("D:/yellow.txt","a");
fwrite($fp,'5');
fclose($fp);

} else {

?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="header">
<tr>
<td valign="bottom"><a href="consume.php"><img src="images/consume.gif" height="36" border="0"></a></td>
<td><a href="payment.php"><img src="images/payment1.gif" height="36" border="0"></a></td>
<td valign="bottom"><a href="account.php"><img src="images/account.gif" height="36" border="0"></a></td>
<td valign="bottom"><a href="pay.php"><img src="images/c_pay.gif" height="36" border="0"></a></td>
<td valign="bottom"><a href="tts.php"><img src="images/tts1.gif" height="36" border="0"></a></td>
<td valign="bottom"><a href="packages.php"><img src="images/package.gif" height="36" border="0"></a></td>
<td valign="bottom"></td>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/b.jpg" height="36" colspan="3"></td>
</tr>
</table>
</td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#73A2D6" class="blue9"><img src="images/p.gif" width="23" height="23" align="absmiddle"><span class="white9">企业充值记录</span></td>
</tr>
<tr>
<td valign="top">
</td>
</tr>
</table>


<? } ?>


<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
</tr>
<tr>
<td class="blue9" align="center"><?=$msg?></td>
</tr>
</table>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" valign="bottom" class="red9">
<br>
<a href="<?=$url?>"><img src="../search/images/return.jpg" border="0"></a>
<a href="welcome.php"><img src="../search/images/main.jpg" border="0"></a>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" valign="bottom" class="red9">
</td>
</tr>
</table>


<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" valign="bottom" class="red9">
<br>
</td>
</tr>
</table>

<!----
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#73A2D6" class="blue9"><img src="images/p.gif" width="23" height="23" align="absmiddle"><span class="white9">注意事项</span></td>
</tr>
<tr>
<td class="red9" >
<? /*
echo
nl2br("
(1)子帐户必须已经注册。
(2)必须正确输入子帐户的账号和传真发送密码。
(3)新注册子帐户请点击<a href=new_uu.php>这里</a>。 "
)
; */
?>
</td>
</tr>
</table>
-->
</body>
我测试用的代码,php断点如果加在158行的系统提示前测试代码写入文件就是1234,代码执行了一遍,如果断点放在158行后写入文件就是12341234,说明php程序执行了2遍,这个太诡异了,哪位高手告诉下愿意啊
...全文
197 31 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
31 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhongqixing1104 2009-08-14
  • 打赏
  • 举报
回复
知道写代码不规范的后果了吧!要是写得规范的话,排查问题就很容易了。像这种代码大家就不要帮它解决,让他自己吞下恶果!免得以后还写这么乱的代码。
zhuhuquan29 2009-08-14
  • 打赏
  • 举报
回复
看不下去了这是什么代码风格--;
meiking 2009-08-14
  • 打赏
  • 举报
回复
为什么不 debug 一遍呢?
YHL27 2009-08-14
  • 打赏
  • 举报
回复
sf!!
x198909253132 2009-08-13
  • 打赏
  • 举报
回复
晕 那帮我看看上边的html会不会使页面刷新 结构很简单 if()else
x198909253132 2009-08-13
  • 打赏
  • 举报
回复
<? if ($v!=22) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="header">
<tr>
<td><img src="../search/images/sys1.gif" width="96" height="36" border="0"></td>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/b.jpg" height="36" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#73A2D6" class="blue9"><img src="images/p.gif" width="23" height="23" align="absmiddle"><span class="white9">系统提示</span></td>
</tr>
<tr>
<td valign="top">
</td>
</tr>
</table>
<? } else { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="header">
<tr>
<td valign="bottom"><a href="consume.php"><img src="images/consume.gif" height="36" border="0"></a></td>
<td><a href="payment.php"><img src="images/payment1.gif" height="36" border="0"></a></td>
<td valign="bottom"><a href="account.php"><img src="images/account.gif" height="36" border="0"></a></td>
<td valign="bottom"><a href="pay.php"><img src="images/c_pay.gif" height="36" border="0"></a></td>
<td valign="bottom"><a href="tts.php"><img src="images/tts1.gif" height="36" border="0"></a></td>
<td valign="bottom"><a href="packages.php"><img src="images/package.gif" height="36" border="0"></a></td>
<td valign="bottom"></td>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/b.jpg" height="36" colspan="3"></td>
</tr>
</table>
</td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#73A2D6" class="blue9"><img src="images/p.gif" width="23" height="23" align="absmiddle"><span class="white9">企业充值记录</span></td>
</tr>
<tr>
<td valign="top">
</td>
</tr>
</table>


<? } ?>


<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
</tr>
<tr>
<td class="blue9" align="center"><?=$msg?></td>
</tr>
</table>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" valign="bottom" class="red9">
<br>
<a href="<?=$url?>"><img src="../search/images/return.jpg" border="0"></a>
<a href="welcome.php"><img src="../search/images/main.jpg" border="0"></a>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" valign="bottom" class="red9">
</td>
</tr>
</table>


<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" valign="bottom" class="red9">
<br>
</td>
</tr>
</table>
hzbigdog 2009-08-13
  • 打赏
  • 举报
回复
你把有问题的代码分离出来吗?
帖那么大一堆,谁看得懂啊,代码风格又那么乱.
x198909253132 2009-08-13
  • 打赏
  • 举报
回复
问题在<? if ($v!=22) { ?>下边,貌似下面的几行代码让页面刷新了,所以重复执行了一遍,各位帮忙看下
x198909253132 2009-08-13
  • 打赏
  • 举报
回复
[Quote=引用 21 楼 txj_no 的回复:]
什么东东,你就说报什么错误,错误指向那一行不就行了
[/Quote]
我说了 是程序执行二次 没有 报错
x198909253132 2009-08-13
  • 打赏
  • 举报
回复
[Quote=引用 20 楼 baiyuxiong 的回复:]
到处插入echo,查看变量结果,慢慢调试吧。
不给你看了,烦死了。
程序里总共才一个循环,怎么可能执行两遍。肯定是你犯低级错误了。
自己找吧
[/Quote]
那些低级错误能出现这种情况呢
TXJ_NO 2009-08-13
  • 打赏
  • 举报
回复
什么东东,你就说报什么错误,错误指向那一行不就行了
codeyell-com 2009-08-13
  • 打赏
  • 举报
回复
到处插入echo,查看变量结果,慢慢调试吧。
不给你看了,烦死了。
程序里总共才一个循环,怎么可能执行两遍。肯定是你犯低级错误了。
自己找吧
x198909253132 2009-08-13
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 baiyuxiong 的回复:]
靠,也不行,那就只会写一个数字了。你每运行一次把文件内容清空了看看
要不你先把数字连成一个字符串,再一起写入文件。
为什么要分开那么多次写。
[/Quote]
我是分段落写进的 就是想看程序执行情况 不是业务需要 测试代码
x198909253132 2009-08-13
  • 打赏
  • 举报
回复
[Quote=引用 16 楼 baiyuxiong 的回复:]
可读性相当的差,注意缩进……
各种注释风格都样,C的,C++的,HTML的……

[/Quote]
可以用zend缩进一下如果你认为可读性差的话,这程序都快改烂了
x198909253132 2009-08-13
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 baiyuxiong 的回复:]
把所有的
$fp=fopen("D:/yellow.txt","a");
改成
$fp=fopen("D:/yellow.txt","w");

[/Quote]
我是执行一次输出的,测试n次,每次都是执行完程序就删,不存在追加覆盖的问题
codeyell-com 2009-08-13
  • 打赏
  • 举报
回复
可读性相当的差,注意缩进……
各种注释风格都样,C的,C++的,HTML的……
codeyell-com 2009-08-13
  • 打赏
  • 举报
回复
靠,也不行,那就只会写一个数字了。你每运行一次把文件内容清空了看看
要不你先把数字连成一个字符串,再一起写入文件。
为什么要分开那么多次写。
x198909253132 2009-08-13
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 jlzan1314 的回复:]
靠着头昏,代码的可读性比较差. 麻烦说明下,那行报错.
[/Quote]
不是错误 , 是程序执行了2次
codeyell-com 2009-08-13
  • 打赏
  • 举报
回复
把所有的
$fp=fopen("D:/yellow.txt","a");
改成
$fp=fopen("D:/yellow.txt","w");
x198909253132 2009-08-13
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 baiyuxiong 的回复:]
172行
$fp=fopen("D:/yellow.txt","a");
你的打开方式是a
写入方式打开,将文件指针指向文件末尾。如果文件不存在则尝试创建之。
两个1234是不是追加的结果?
改成
$fp=fopen("D:/yellow.txt","w");
试试。
另有一问:1234是啥?文件内容?
[/Quote]
不是 1234 是4次写入的数字,在代码各个段落做标记用的,然后用exit看那段没有执行,那段重复执行
加载更多回复(11)

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧