心靈捕手 寫:applegod 寫:心靈捕手兄可否請教一下
水怪骰子遊戲照你ㄉ修改出現下列錯誤
Parse error: parse error, unexpected ';' in c:\appserv\www\phpbb
pg\dice.php on line 23
不知是我哪裡錯了~不知是否能幫忙一下 謝謝
喔! 我彷彿想起那個時候,
好像也出現過類似的錯誤...
經過~倉木麻衣~兄的說明,
知道該行(第23行)應該是'註解',
不會被執行才對!
後來, 我將我的 rpg/dice.php
貼在[竹貓]
經由他加以修改後,
再下載回來用,
也就成功了.
之後, 我比對的結果,
發現原本我的 rpg/dice.php
在每一行的開頭幾乎都有一個"?",
但是貼在[竹貓]上,
那些問號都自動消失了;
所以我下載他幫我修改後的檔案裡頭,
也就沒有那些問號了.
我的意思是告訴你:
假如你的 rpg/dice.php
在每一行的開頭也是有很多"問號"的話\r
建議你把它們刪除掉,
(最後一行的問號 "?>" 是 php 標準語法, 不要刪!)
再試試看!
我的有類似的問題但是不是在23行
是在第七行
代碼: 選擇全部
<?php
include($phpbb_root_path . 'rpg/function_rpg.'.$phpEx);
if ( !defined('IN_PHPBB') ){ die("Hacking attempt"); exit;}
$returnurl = '<br /><br /><a href="rpg.php?action=dice">返回上一頁</a>';$template->set_filenames(array( 'menu' => 'rpg_header.tpl', 'body' => 'rpg_dice.tpl'));
// 取得個人資料$profiledata = get_userdata(intval($userdata['user_id']));
$act = trim($_POST['act']);/*if (!isset($act) or $act=="") { $act="horse";}*/
$postusername = $profiledata['username'];$rpg_dice_result = "";if ($HTTP_POST_VARS['act']=="bet"){ $rpg_dice_result = ""; $mony = trim(addslashes($_POST['pay_money']); $usermoney = $profiledata['user_money']; $pay = trim($_POST['pay']); if($pay =="point") { $point = trim(addslashes($_POST['point'])); } if ($mony<100 || $mony>10000) { $rpg_dice_result .="對不起,您的下注金額不在規定的範圍內!!"; $rpg_dice_result .="<br />".$returnurl; } else if ($usermoney<$mony) { $rpg_dice_result .="對不起,您的下注金額超出了您持有的現金!!"; $rpg_dice_result .="<br />".$returnurl; } else { $sql= "UPDATE clanweb_users SET user_money=user_money-".$mony." WHERE user_id='".$profiledata[user_id]."'"; if( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, "無法更新會員的現金!!", "", __LINE__, __FILE__, $sql); } srand((double)microtime()*1000000); $randid1 = rand(1, 6); $randid2 = rand(1, 6); $randid3 = rand(1, 6); $randid = $randid1 + $randid2 + $randid3; $win = 0; if ($pay == "big" && $randid >10) { $win = 1; $mony1 = $mony*2; } if ($pay == "small" && $randid <=10) { $win = 1; $mony1 = $mony*2; } if ($pay == "point") { if ($randid == $point) { $win = 1; $mony1 = $mony*10; } } $rpg_dice_result .="<body bgcolor="#FFFFFF" onLoad="MM_preloadImages('images/dice/1.gif','images/dice/2.gif','images/dice/3.gif')">"; if ($win) { $mony2 = $mony1-$mony; $rpg_dice_result .="<div id="Layer_result" style="position:absolute; left:330px; top:550px; width:330px; height:45px; z-index:1; visibility: hidden"><center><span class=gen><img src=images/dice/win.gif>恭喜,您贏了 <font color=#FF6600>".$mony2."</font> 元。</font></span><p class=gen>[ <a href=rpg.php?action=dice>再來一盤</a> ] [ <a href=rpg.php?action=menu>回主選單</a> ]</p></center></div>
"; $sql= "UPDATE clanweb_users SET user_money=user_money+".$mony1." WHERE user_id='".$profiledata[user_id]."'"; if( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, "無法更新會員的現金!!", "", __LINE__, __FILE__, $sql); } } else { $rpg_dice_result .="<div id="Layer_result" style="position:absolute; left:330px; top:550px; width:330px; height:45px; z-index:1; visibility: hidden"><center><span class=gen><img src=images/dice/lose.gif>真遺憾,您輸了 <font color=#FF6600>".$mony."</font> 元。</font></span><p class=gen>[ <a href=rpg.php?action=dice>再來一盤</a> ] [ <a href=index.php>回論壇首頁</a> ]</p></center></div>
"; } $rpg_dice_result .="<table width="410" cellpadding="0" cellspacing="0" border="0">" ."<tr align="center">" ."<td width="65"><img src="images/dice/run.gif" width="38" height="36" name="run1"></td>" ."<td width="68"><img src="images/dice/run.gif" width="38" height="36" name="run2"></td>" ."<td width="71"><img src="images/dice/run.gif" width="38" height="36" name="run3"></td>" ."<td width="218"><a href="#"><img src="images/dice/button.gif" width="50" height="40" onClick="MM_swapImage('run1','','images/dice/".$randid1.".gif',1);MM_swapImage('run2','','images/dice/".$randid2.".gif',1);MM_swapImage('run3','','images/dice/".$randid3.".gif',1);MM_showHideLayers('Layer_result','','show')" border="0" align="absmiddle"></a>" ."<span class=gen> <-- 按下這裡開始!!</span></td>" ."</tr>" ."</table></body>"; }}else{$rpg_dice_result .="<script language=javascript>" ."var subNo=0;" ."function formCheck()" ."{" ." if (document.theform.pay_money.value == "")" ." {" ." alert("請填寫下注金額");" ." document.theform.pay_money.focus();" ." return false;" ." }" ." subNo=1;" ." return true;" ."}" ."</script>";$rpg_dice_result .="<form name="theform" method="post" action=rpg.php?action=dice onsubmit="return formCheck();">";$rpg_dice_result .="<input type="hidden" name="act" value="bet">";$rpg_dice_result .="<table width=535 border=0 cellspacing=1 cellpadding=3 bgcolor="#003399">";$rpg_dice_result .="<tr bgcolor="#FFFFFF"> " ."<td colspan="4" height="103">" ."<p><input type="radio" name="pay" value="big" checked>" ."<img src="images/dice/big.gif" width="46" height="40">" ."<input type="radio" name="pay" value="small">" ."<img src="images/dice/small.gif" width="46" height="40"> <span class="gen">賠率:2</span></p>" ."<p><input type="radio" name="pay" value="point">" ."<span class="gen">買點數:" ."<input type="text" name="point" value="3" size="2" maxlength="2"> ( 3 - 18 點) 賠率:10</span>" ."</p></td>" ."</tr>" ."<tr bgcolor="#CCCCFF"> " ."<td colspan="4" height="40"><span class="gen">下注:</span>" ."<input type="text" name="pay_money" value="100" size="6"> " ."<input type="submit" name="Submit" value="下注" onclick="if (subNo>0){this.disabled=true; return false;}">" ."</td>" ."</tr></table></form>";}
// 產生資料頁面$page_title = "水怪大陸 RPG 首頁";include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->assign_vars(array( 'USERNAME' => $profiledata['username'], 'AVATAR_IMG' => GetAvatar($profiledata), 'RPG_MONEY' => number_format($profiledata['user_money']), 'RPG_DICE_RESULT' => $rpg_dice_result, 'L_NOWMENU' => '水怪骰子遊戲') );
if ( $_POST['act'] == 'bet' ){ $template->assign_block_vars('bet_result', array());}$template->pparse('menu');$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
還有另一個賽馬改了也是無效
代碼: 選擇全部
<?php
include($phpbb_root_path . 'rpg/function_rpg.'.$phpEx);
if ( !defined('IN_PHPBB') ){ die("Hacking attempt"); exit;}
$returnurl = '<br /><br /><a href="rpg.php?action=race">返回上一頁</a>';
$template->set_filenames(array( 'menu' => 'rpg_header.tpl', 'body' => 'rpg_race.tpl'));
// 取得個人資料$profiledata = get_userdata(intval($userdata['user_id']));include($phpbb_root_path . 'includes/page_header.'.$phpEx);$act = trim($_POST['act']);/*if (!isset($act) or $act=="") { $act="horse";}*/
$postusername = $profiledata['username'];$rpg_race_result = "";if ($HTTP_POST_VARS['act']=="horse"){ $mony=trim(addslashes($_POST['mon'])); $usermoney = $profiledata['user_money']; if ($mony<100 || $mony>10000) { $rpg_race_result .="對不起,您的下注金額不在規定的範圍內!!"; } else if ($usermoney<$mony) { $rpg_race_result .="對不起,您的現金不夠!!"; } else { $sql= "UPDATE clanweb_users SET user_money=user_money-".$mony." WHERE user_id='".$profiledata[user_id]."'"; if( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, "無法更新會員的現金!!", "", __LINE__, __FILE__, $sql); } $horse=Array(1=>"龍在江湖",2=>"不稀",3=>"聾沒耳",4=>"董老大",5=>"不來耳",6=>"泥河魯",7=>"小犬蠢一狼",8=>"蠻得辣"); ?>
<script>function Horse_timelinePlay(tmLnName, myID) {if (document.Horse_Time == null) Horse_initTimelines();tmLn = document.Horse_Time[tmLnName];if(myID == null) { myID = ++tmLn.ID; firstTime=true;}setTimeout('Horse_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);fNew = ++tmLn.curFrame;for (i=0; i<tmLn.length; i++) {sprite = tmLn[i];if (sprite.obj) {numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {keyFrm=1;for (j=0; j<sprite.values.length; j++) {props = sprite.values[j];if (numKeyFr != props.length) {if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];else sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];}else{while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];else sprite.obj[props.prop2][props.prop] = props[keyFrm-1];}}}}}}}function Horse_initTimelines() {document.Horse_Time = new Array();document.Horse_Time[0] = new Array();document.Horse_Time["horse"] = document.Horse_Time[0];<?for ($intj=0;$intj<8;$intj++){for ($i=0;$i<30;$i++){$intnum=pack(c,rand(0,10)+48);$intnum1=$intnum1+$intnum*3;if (!isset($tol)) $tol=$intnum1;else $tol=$tol.",".$intnum1;}if($intnum1 > $fff){$fff=$intnum1;$no=$intj+1;}$intj1=$intj+1;?>document.Horse_Time[0][<?echo $intj;?>]=new String("sprite");document.Horse_Time[0][<?echo $intj;?>].obj=document.all ? document.all["h<?echo $intj1;?>"] : null;document.Horse_Time[0][<?echo $intj;?>].keyFrames=new Array(1,30);document.Horse_Time[0][<?echo $intj;?>].values=new Array(2);document.Horse_Time[0][<?echo $intj;?>].values[0]=new Array(<?echo $tol;?>);document.Horse_Time[0][<?echo $intj;?>].values[0].prop="left";document.Horse_Time[0][<?echo $intj;?>].values[1]=new Array();document.Horse_Time[0][<?echo $intj;?>].values[0].prop2="style";<?$tol=0;$intnum1=0;
}$fff=$fff-15;if($no == 1) {$horsename=$horse[1];}elseif($no == 2) {$horsename=$horse[2];}elseif($no == 3) {$horsename=$horse[3];}elseif($no == 4) {$horsename=$horse[4];}elseif($no == 5) {$horsename=$horse[5];}elseif($no == 6) {$horsename=$horse[6];}elseif($no == 7) {$horsename=$horse[7];}elseif($no == 8) {$horsename=$horse[8];}if($_POST['yourchoose'] == $no){ $jessie = $mony*8; $sql= "UPDATE clanweb_users SET user_money=user_money+".$jessie." WHERE user_id='".$profiledata[user_id]."'"; if( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, "無法更新會員的現金!!", "", __LINE__, __FILE__, $sql); }$message="<br />恭喜, ".$profiledata[username]." 您贏了!!<br />獲得彩金 ".$jessie." 元!!";}else{$message="<br />很遺憾, ".$profiledata[username]." 您輸了....";}/*此處可以加錢的設定,寫到文件*/?>document.Horse_Time[0][8]=new String("sprite");document.Horse_Time[0][9]=new String("sprite");document.Horse_Time[0][9].obj = document.all ? document.all["sysMsg"] : null;document.Horse_Time[0][9].keyFrames=new Array(1,30);document.Horse_Time[0][9].values=new Array();document.Horse_Time[0][9].values[0]=new Array();document.Horse_Time[0][9].values[0].prop="left";document.Horse_Time[0][9].values[1]=new Array();document.Horse_Time[0][9].values[0]=new Array("hidden","inherit");document.Horse_Time[0][9].values[0].prop="visibility";document.Horse_Time[0][9].values[0].prop2="style";for(i=0;i<document.Horse_Time.length;i++){document.Horse_Time[i].curFrame=0;document.Horse_Time[i].delay=200;}}</script>
<body onLoad="Horse_timelinePlay('horse')"><div id=h1 style=position:absolute;top:200px><img src=images/horse/h1.gif></div><div id=h2 style=position:absolute;top:240px><img src=images/horse/h2.gif></div><div id=h3 style=position:absolute;top:280px><img src=images/horse/h3.gif></div><div id=h4 style=position:absolute;top:320px><img src=images/horse/h4.gif></div><div id=h5 style=position:absolute;top:360px><img src=images/horse/h5.gif></div><div id=h6 style=position:absolute;top:400px><img src=images/horse/h6.gif></div><div id=h7 style=position:absolute;top:440px><img src=images/horse/h7.gif></div><div id=h8 style=position:absolute;top:480px><img src=images/horse/h8.gif></div><div id=sysMsg style="position:absolute;width:250;height:50%;left:60%;visibility: hidden"><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor=FF0000><tr bgcolor=FFFFFF><td colspan=2 align=center bgcolor=FF0000><font color=FFFFFF>比賽結果</font><?echo $message;?></td></tr><tr><td width="40%" align=center>第 1 名: (<?echo $no;?>) <?echo $horsename;?></td></tr></table></div><br /><table width="100%" height="20" cellpadding="2" cellspacing="0" border="0"><tr><td><br />您選擇: <b><font color="red"><?echo $_POST['yourchoose'];?></font> <?echo $horse[$_POST['yourchoose']];?></b></td></tr></table><table width=100% cellpadding=5 cellspacing=1 bgcolor=F0F0F0 border=0><tr bgcolor=84CF1D align=right><td height=39 width=<?echo $fff;?></td><td class="gen"><font color=FFFFFF><?echo $horse[1];?></font></td></tr><tr bgcolor=84CF1D align=right><td height=39></td><td class="gen"><font color=FFFFFF><?echo $horse[2];?></font></td></tr><tr bgcolor=84CF1D align=right><td height=39></td><td class="gen"><font color=FFFFFF><?echo $horse[3];?></font></td></tr><tr bgcolor=84CF1D align=right><td height=39></td><td class="gen"><font color=FFFFFF><?echo $horse[4];?></font></td></tr><tr bgcolor=84CF1D align=right><td height=39></td><td class="gen"><font color=FFFFFF><?echo $horse[5];?></font></td></tr><tr bgcolor=84CF1D align=right><td height=39></td><td class="gen"><font color=FFFFFF><?echo $horse[6];?></font></td></tr><tr bgcolor=84CF1D align=right><td height=39></td><td class="gen"><font color=FFFFFF><?echo $horse[7];?></font></td></tr><tr bgcolor=84CF1D align=right><td height=39></td><td class="gen"><font color=FFFFFF><?echo $horse[8];?></font></td></tr></table><br /><? }}// 產生資料頁面$page_title = "水怪大陸 RPG 首頁";$template->assign_vars(array( 'USERNAME' => $profiledata['username'], 'AVATAR_IMG' => GetAvatar($profiledata), 'RPG_MONEY' => number_format($profiledata['user_money']), 'RACE_RESULT' => $rpg_race_result, 'L_NOWMENU' => '水怪賽馬遊戲') );if ( $_POST['act'] == 'horse' ){ $template->assign_block_vars('race_result', array());}$template->pparse('menu');$template->pparse('body');include($phpbb_root_path . 'includes/page_tail.'.$phpEx);?>
請問可以幫我看看嗎?