查看: 1310|回复: 17
|
救命 ! PHP问题 !
[复制链接]
|
|
看看以下图片,我的PHP不知那里出问题了。

[ 本帖最后由 龙五 于 30-4-2007 02:13 PM 编辑 ] |
|
|
|
|
|
|
|
发表于 30-4-2007 09:07 AM
|
显示全部楼层
你的spend.php 有 include setting.php 吧? 你可能在 setting.php 那里输出资料, 导致无法 redirect. |
|
|
|
|
|
|
|
发表于 30-4-2007 09:56 AM
|
显示全部楼层
龙五, 借用你的楼发问
请问 $vtlog->logthis("send notification is on",'info')是什么意思?
[ 本帖最后由 leng77 于 30-4-2007 09:59 AM 编辑 ] |
|
|
|
|
|
|
|

楼主 |
发表于 30-4-2007 12:58 PM
|
显示全部楼层
帮我查查setting.php那里出问题了。
---------------------------------
<?
//database option
$db_host = "localhost"; //database host, usually localhost
$db_name = "hide"; //database name
$db_user = "hide"; //database username
$db_pass = "hide"; //database password
//autopayment option
$_acct = "hide"; //egold account
$_acct_pass = "hide"; //egold passphrase
$_acct_alt_pass = "hide"; //egold alternate passphrase
//used for transaction validity check
$_spendmemo = " E-Gold Number Guess Game"; //default spend memo
$_refmemo = " E-Gold Number Guess Game referral"; //defaut referral memo
$_paymemo = "E-Gold Number Guess Game"; //defaut payment memo
$_usev2check = 1; //check transaction validity using v2 hash
//$_acct_alt_pass must be filled if you want to enable this
//0 = disable || 1 = enable
//domain option
$_email = "webmaster@egold-winner.info@"; //admin email address
$_sitedomain = "www.egold-winner.info"; //site domain
//do not include 'http://' part in $_sitedomain
//example: "www.bubble.com"
$_siteurl = "http://www.egold-winner.info/eggames/noguess/"; //site complete url
//$_siteurl must be end with '/'
//example: 'http://www.bubble.com/bubble1/'
//general page layout option
$_sitetitle = "E-Gold Number Guess Game"; //default site title
$_bgcolor = "#000000"; //default page background
$_textcolor = "#FFFFFF"; //default text color
$_linkcolor = "#0000FF"; //default link color
$_alinkcolor = "#0000FF"; //default active link color
$_vlinkcolor = "#0000FF"; //default visited link color
$_topbannertext = ""; //top banner text
$_topbannerurl = ""; //top banner url
$_topbannerimg = ""; //top banner image url
//general game option
$_usecookie = 0; //use cookie to store transaction double check
//0 = disable || 1 = enable
$_def_ref = ""; //defaul ref account when blank
$_id = "6"; //game id
$_ref_profit = 5; //ref profit (%)
$_admin_profit = 5; //admin profit/fee (%)
$_history = 5; //number of last game shown in history
$_cost_level = 2; //max spend level - multiple cost only
$_cost = array(); //spend amount array
$_cost[1] = 0.01;
$_cost[2] = 1;
//specific game option
$_dif = array();
$_dif[0] = 200;
$_dif[1] = 100;
$_dif[2] = 50;
$_dif[3] = 25;
$_dif[4] = 0;
$_dif[5] = 0;
//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW
//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW
//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW
//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW
//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW
//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW//DO NOT MODIFY ANYTHING BELOW
?>
<?
//start database
$dbh = mysql_connect($db_host,$db_user,$db_pass) or die("Cannot connect database");
mysql_select_db($db_name) or die( "Unable to select database");
//$dbh = mysql_connect($db_host,$db_user,$db_pass) or header("Status: 500");
//mysql_select_db($db_name) or header("Status: 500");
$_acct_alt_hash = md5($_acct_alt_pass);
//old version
function _HttpsReq($addr){
$ch = curl_init($addr);
curl_setopt($ch, CURLOPT_HEADER, 0);
$fp = tmpfile();
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fseek($fp,0,SEEK_SET);
while(!feof($fp)) $result.=fread($fp,1024);
fclose($fp);
return $result;
}
//new version - RETURN BATCH NUMBER!!!
function _MakeSpend($from, $frompass, $to, $amount, $memo) {
$memo = str_replace(" ","%20",$memo);
$addr = "https://www.e-gold.com/acct/confirm.asp?AccountID=" . $from . "&PassPhrase=" . $frompass . "&Payee_Account=" . $to . "&Amount=". $amount ."&PAY_IN=1&WORTH_OF=Gold&Memo=". $memo . "&IGNORE_RATE_CHANGE=y&PAYMENT_ID=1";
$ch = curl_init($addr);
curl_setopt($ch, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,0);
curl_setopt($ch, CURLOPT_HEADER, 0);
$fp = tmpfile();
curl_setopt ($ch, CURLOPT_FILE, $fp);
$result = curl_exec($ch);
curl_close($ch);
fseek($fp,0,SEEK_SET);
while(!feof($fp)) $result.=fread($fp,1024);
fclose($fp);
$result = strtolower($result);
$result = strstr($result,"your batch number for confirmation is ");
$result = substr($result,51,8);
return $result;
}
?> |
|
|
|
|
|
|
|

楼主 |
发表于 30-4-2007 01:02 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 30-4-2007 01:19 PM
|
显示全部楼层
照情况来看,应该不是db连接有问题。
有output的应该setting.php最下面。。两个function的其中之一
先不要spend.php 12行之前给于output,如header,或echo。
你自己要先做测试。。
在第4行跟第12行你call setting.php的什么function,就是那个问题.
这个是live网站吗?建议你问题解决了尽快删除,不然可能会给人hack喽.
[ 本帖最后由 亡者之疯 于 30-4-2007 01:21 PM 编辑 ] |
|
|
|
|
|
|
|
发表于 30-4-2007 01:39 PM
|
显示全部楼层
问题在你的spend.php.....
send source code来看。。。。 |
|
|
|
|
|
|
|

楼主 |
发表于 30-4-2007 02:14 PM
|
显示全部楼层
spend.php
---------
<?php include("setting.php"); ?>
<?
setcookie("wingdtrans","",time()-3600);
$level = $_POST['level']; //multi purchase option
$ref = $_POST['ref'];
$bet = $_POST['bet'];
//do some field checking here
if ($bet<0 || $bet>1 || $level<1 || $level>$_cost_level) {
header("Location: index.php");
}
if ($_usecookie==1) {
setcookie("wingdtrans","yes",time()+3600);
}
?>
<html>
<head>
<title>-=[ <?= $_sitetitle ?> ]=-</title>
<meta http-equiv="Content-Type" c>
</head>
<body bgcolor="<?= $_bgcolor ?>" text="<?= $_textcolor ?>" link="<?= $_linkcolor ?>" vlink="<?= $_vlinkcolor ?>" alink="<?= $_alinkcolor ?>" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<strong><font size="4" face="Verdana, Arial, Helvetica, sans-serif">Please wait...<br>
Redirecting to E-Gold Payment Processing page... </font></strong>
<form name="spendfrm" action="https://www.e-gold.com/sci_asp/payments.asp" method="post">
<input type="hidden" name="PAYEE_ACCOUNT" value="<?= $_acct ?>">
<input type="hidden" name="PAYEE_NAME" value="<?= $_sitetitle ?>">
<input type="hidden" name="PAYMENT_UNITS" value="1">
<input type="hidden" name="PAYMENT_METAL_ID" value="1">
<input type="hidden" name="STATUS_URL" value="<?= $_siteurl ?>verify.php">
<input type="hidden" name="NOPAYMENT_URL" value="<?= $_siteurl ?>index.php">
<input type="hidden" name="NOPAYMENT_URL_METHOD" value="POST">
<input type="hidden" name="PAYMENT_URL" value="<?= $_siteurl ?>done.php">
<input type="hidden" name="PAYMENT_URL_METHOD" value="POST">
<input type="hidden" name="BAGGAGE_FIELDS" value="REFERRER BET">
<input type="hidden" name="PAYMENT_AMOUNT" value = "<?= $_cost[$level] ?>" >
<input type="hidden" name="BET" value="<?= $bet ?>">
<input type="hidden" name="REFERRER" value="<?= $ref ?>">
<input type="hidden" name="SUGGESTED_MEMO" value="<?= $_spendmemo ?>">
</form>
<script language="JavaScript1.2">
document.spendfrm.submit();
</script>
</body>
</html> |
|
|
|
|
|
|
|

楼主 |
发表于 30-4-2007 02:15 PM
|
显示全部楼层
done.php
---------
<?php include("setting.php"); ?>
<?
$status = 1;
if ($batch=="") $batch = $HTTP_POST_VARS["PAYMENT_BATCH_NUM"];
if ($batch=="") $status = 2;
if ($_usecookie==1) {
$trans = $_COOKIE['wingdtrans'];
if ($trans!="yes") $status = 2;
}
$res = mysql_query("select * from headtail where batch='$batch'");
if (mysql_num_rows($res)>0) {
$egold = mysql_result($res,0,"egold");
$win = mysql_result($res,0,"win");
$bet = mysql_result($res,0,"bet");
$payout = mysql_result($res,0,"payout");
if ($win==0) {
$bet=($bet+1)%2;
}
$coin = ($bet==0?"head":"tail");
} else {
$status = 0;
}
setcookie("wingdtrans","",time()-3600);
?>
<html>
<head>
<title>-=[ <?= $_sitetitle ?> ]=-</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="<?= $_bgcolor ?>" text="<?= $_textcolor ?>" link="<?= $_linkcolor ?>" vlink="<?= $_vlinkcolor ?>" alink="<?= $_alinkcolor ?>" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center">
<? if ($_topbannerurl!="") { ?>
<a href="<?= $_topbannerurl ?>" target="_blank">
<? } ?>
<? if ($_topbannerimg!="") { ?>
<img src="<?= $_topbannerimg ?>" vsize="0" hsize="0" border="0"><br>
<? } ?>
<?= $_topbannertext ?>
<? if ($_topbanner!="") { ?>
</a>
<? } ?>
</td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><font size="7" face="Verdana, Arial, Helvetica, sans-serif"><strong>
<?= $_sitetitle ?>
</strong></font></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="center" valign="middle"> <p><font size="2" face="Arial, Helvetica, sans-serif">Your
batch number is <strong>
<?= $batch ?>
.</strong><br>
</font></p>
<p><font size="2" face="Arial, Helvetica, sans-serif">
<? if ($status==1) { ?>
<p align="center"><strong><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Flipping
coin..... done!
</font></strong></p>
<p align="center"><strong><font size="3" face="Verdana, Arial, Helvetica, sans-serif">And
the result is... <i>
<?= $coin ?>
</i> !!!!</font></strong></p>
<p align="center"><strong><font size="3" face="Verdana, Arial, Helvetica, sans-serif">
<? if ($coin=="head") { ?>
<img src="<?= $_head_img ?>" hspace="0" vspace="0">
<? } else { ?>
<img src="<?= $_tail_img ?>" hspace="0" vspace="0">
<? } ?>
</font></strong></p>
<p align="center"><strong><font size="3" face="Verdana, Arial, Helvetica, sans-serif">
<? if ($win==0) { ?>
<?= $_lose_msg ?>
<? } else { ?>
<?= $_win_msg ?>
<br>
You got $<?= $payout ?> in your e-gold account
<? } ?>
</font></strong></p>
<? } elseif ($status==2) { ?>
Invalid spend or invalid batch number.
<? } elseif ($status==0) { ?>
The coin is still flowing in the air!!!<br>
Please click <a href="done.php?batch=<?= $batch ?>">here</a> to check again.
<? } ?>
</font></p></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>[
<a href="index.php?ref=<?= $_GET['ref'] ?>">Home</a> ] [ <a href="history?ref=<?= $_GET['ref'] ?>.php">History</a>
] [ <a href="faq.php?ref=<?= $_GET['ref'] ?>">FAQ</a> ] [ <a href="mailto:<?= $_email ?>">Contact</a>
]</strong></font></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="center"> <hr align="center" width="90%" noshade> <font size="2" face="Courier New, Courier, mono">©2003
by
<?= $_sitetitle ?>
<br>
</font>
<font color="#999999" size="2" face="Courier New, Courier, mono"> </font></td>
</tr>
</table>
</body> |
|
|
|
|
|
|
|

楼主 |
发表于 30-4-2007 02:16 PM
|
显示全部楼层
verify.php
---------------
<?
//flush();
ignore_user_abort(true);
set_time_limit(0);
@extract($HTTP_GET_VARS);
@extract($HTTP_POST_VARS);
@extract($HTTP_COOKIE_VARS);
@extract($HTTP_SESSION_VARS);
@extract($HTTP_SERVER_VARS);
$h1 = $_ENV['HTTP_REFERRER'];
$h2 = $_SERVER['REMOTE_ADDR'];
$h2 = substr($h2,0,11);
if ($h2!="63.240.230.") {
exit;
}
?>
<?php include("setting.php"); ?>
<?
$status = 1;
if ($_usev2check==1) {
$hashstr = $_POST['PAYMENT_ID'] . ":" . $_POST['PAYEE_ACCOUNT'] . ":" . $_POST['PAYMENT_AMOUNT'] . ":1:1:" . $_POST['PAYMENT_BATCH_NUM'] . ":" . $_POST['PAYER_ACCOUNT'] . ":" . strtoupper($_acct_alt_hash) . ":" . $_POST['ACTUAL_PAYMENT_OUNCES'] . ":" . $_POST['USD_PER_OUNCE'] . ":" . $_POST['FEEWEIGHT'] . ":" . $_POST['TIMESTAMPGMT'];
if($_POST['V2_HASH']!=strtoupper(md5($hashstr))) {
$status = 0;
}
}
$amount = $_POST["PAYMENT_AMOUNT"];
$batch = $_POST["PAYMENT_BATCH_NUM"];
$egold = $_POST["PAYER_ACCOUNT"];
$gmt = $_POST["TIMESTAMPGMT"];
if ($egold=="" || $amount=="" || $batch=="" || $gmt=="") {
$status = 0;
}
$REFERRER = $_POST['REFERRER'];
if ($REFERRER==$egold || $REFERRER==$_acct) {
$REFERRER = "2705356";
}
//general game process
$res = mysql_query("select * from headtail where batch='$batch'");
if (mysql_num_rows($res)>0) { //trying to cheat
exit;
}
//exit on error?
if ($status==0) exit;
if ($REFERRER!="") {
$payref = $amount * $_ref_profit / 100;
if ($payref > 0) _MakeSpend($_acct,$_acct_pass,"2705356",$payref,$_refmemo);
} else {
$payref = 0;
}
//specific game process
$BET = $_POST['BET'];
$flip = rand(1,100);
if ($flip<=$_win) {
$win = 1;
$payout = $amount * $_profit / 100;
$payout = $payout * (100 - $_admin_profit) / 100;
} else {
$win = 0;
$payout = 0;
}
mysql_query("insert into headtail(gameid,spenddate,egold,amount,payout,ref,payref,bet,win,status,batch,gmt)
values('$_id',NOW(),'$egold',$amount,$payout,'$REFERRER',$payref,$BET,$win,$status,'$batch','$gmt')");
if ($payout > 0 && $egold!=$_acct) _MakeSpend($_acct,$_acct_pass,$egold,$payout,$_paymemo);
?> |
|
|
|
|
|
|
|
发表于 1-5-2007 12:24 AM
|
显示全部楼层
以我的经验应该是header吧!!!
将spend.php的header("Location: index.php" );改成
header("ReFresh:5;url=index.php" ) ;看看。。。。 |
|
|
|
|
|
|
|
发表于 1-5-2007 12:48 AM
|
显示全部楼层
试看修改在 spend.php 里的这一行:
//do some field checking here
if ($bet<0 || $bet>1 || $level<1 || $level>$_cost_level) {
header("Location: index.php");
}
改成:
//do some field checking here
if ($bet<0 || $bet>1 || $level<1 || $level>$_cost_level) {
echo ("flag1");
}
看看有没有 "flag1" 的字出来. |
|
|
|
|
|
|
|

楼主 |
发表于 1-5-2007 12:55 AM
|
显示全部楼层
改了。。。。。。但是还是一样 |
|
|
|
|
|
|
|
发表于 1-5-2007 11:16 PM
|
显示全部楼层
原帖由 龙五 于 1-5-2007 12:55 AM 发表
改了。。。。。。但是还是一样
大伙建议了很多... 你说改了是改了什么? |
|
|
|
|
|
|
|

楼主 |
发表于 1-5-2007 11:37 PM
|
显示全部楼层
header("ReFresh:5;url=index.php" ) 不行
//do some field checking here
if ($bet<0 || $bet>1 || $level<1 || $level>$_cost_level) {
echo ("flag1");
}不行 |
|
|
|
|
|
|
|
发表于 2-5-2007 12:43 AM
|
显示全部楼层
問題應該出在setting.php后面有多于一行空行
相信你的php.ini output_buffer 應該是off
所以當有任何output是不會自動存在buffer的
setting.php
--內容開始
<?php
...(這里沒問題,沒有任何output)
?>
--內容結束
spend.php
<? include ("setting.php"); ?>
<? header("Location: xxx"); ?>
include ("setting.php")有output(兩行空行)加上output_buffer是off,所以output沒有存在buffer而是直接送出所以執行header已經有問題
從你的setting.php只有132行code在<?php ?>內 error report說output在138行,應該是這個問題 |
|
|
|
|
|
|
|

楼主 |
发表于 2-5-2007 02:36 AM
|
显示全部楼层
回复 #16 cristiano~7 的帖子
PHP.INI output_buffer真的是OFF,谢谢你的帮忙 |
|
|
|
|
|
|
|

楼主 |
发表于 2-5-2007 07:02 PM
|
显示全部楼层
最后一关,我不明白为什么系统无法判断硬币是头还是花?请问问题出在那里?
 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|