我似乎无法弄清楚这有什么问题。 谁能请帮忙 它在224行 我真的很感激如果有人能解释我做错了什么,并检查我的整个代码,毫无疑问还有更多的错误.. 谢谢 我查看了所有其他论坛帖子,我也无法通过其他代码来处理它... 因为我知道错误在我的代码中的哪个位置,所以我不知道是什么导致它
<?php
/*------------includes--------------*/
include ('./includes/connections.php');
include ('./includes/brain_file.php');
/*------------includes--------------*/
if(!$_SESSION['playerid']) { die(); }
else
{
$q_ry = array();
$q_ry = "SELECT `my_jail`,`my_hosp`,`steps`
FROM `members`
WHERE `playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'";
$jorh = array();
$jorh = mysql_fetch_array(mysql_query($q_ry));
$j = ($jorh['my_jail']-time()) > '0' ? 1 : 0;
$h = ($jorh['my_hosp']-time()) > '0' ? 1 : 0;
$s = ($jorh['steps']);
echo" <font size = 2> <b></b></font>";
if($j || $h)
{
echo "<br/><b>This page is not viewable while in jail or hospital!</b>";
exit();
}
if($s < '1')
{
echo "<br/><b>You have ran out of steps for today you will be topped up with 50 tomorrow!</b>";
exit();
}
else
{
if($_POST['up']||$_POST['left']||$_POST['right']||$_POST['down']||
$_POST['upright']||$_POST['leftup']||$_POST['downright']||$_POST['leftdown'])
{
$q_ry = array();
$q_ry = "SELECT `xu_id`
FROM `xmas_town_users`
WHERE `xu_playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'
LIMIT 1";
$logged = array();
$logged = mysql_query($q_ry);
if(!mysql_num_rows($logged))
{
$q_ry = array();
$q_ry = "INSERT INTO `xmas_town_users`
VALUES ('NULL',
'".mysql_real_escape_string($_SESSION['playerid'])."',
'".mysql_real_escape_string(time())."',
'25',
'25')";
mysql_query($q_ry);
}
else
{
$q_ry = array();
$q_ry = "UPDATE `xmas_town_users`
SET `xu_lasthit` = '".mysql_real_escape_string(time())."'
WHERE `xu_playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'";
mysql_query($q_ry);
$q_ry = array();
$q_ry = "UPDATE `members`
SET `steps` = `steps` - '1'
WHERE `playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'";
mysql_query($q_ry);
}
$q_ry = array();
$q_ry = "SELECT `xu_y`,`xu_x`
FROM `xmas_town_users`
WHERE `xu_playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'";
$myxandy = array();
$myxandy = mysql_fetch_array(mysql_query($q_ry));
$myx = $myxandy['xu_x'];
$myy = $myxandy['xu_y'];
$up = $_POST['up'];
$left = $_POST['left'];
$right = $_POST['right'];
$down = $_POST['down'];
$upr = $_POST['upright'];
$upl = $_POST['leftup'];
$downr = $_POST['downright'];
$downl = $_POST['leftdown'];
$direction = $up.$left.$right.$down.$upr.$upl.$downr.$downl;
if(!in_array($direction,array('Up','Down','Left','Right','UpRight','LeftUp','DownRight','LeftDown')))
{
$direction = "Up";
}
$xandy = array('Up'=>''.($myx-0).'|'.($myy+1).'',
'Down'=>''.($myx-0).'|'.($myy-1).'',
'Left'=>''.($myx-1).'|'.($myy-0).'',
'Right'=>''.($myx+1).'|'.($myy-0).'',
'UpRight'=>''.($myx+1).'|'.($myy+1).'',
'LeftUp'=>''.($myx-1).'|'.($myy+1).'',
'DownRight'=>''.($myx+1).'|'.($myy-1).'',
'LeftDown'=>''.($myx-1).'|'.($myy-1).'');
$newxandy = explode("|", $xandy[$direction]);
$newx = $newxandy[0];
$newy = $newxandy[1];
if($newx < '1' || $newy < '1' || $newx > '50' || $newy > '50')
{
echo "<b>You have hit the edge of christmas town, you cannot walk no further this way!</b>";
}
else
{
$q_ry = array();
$q_ry = "SELECT `my_jail`,`my_hosp`,`steps`
FROM `members`
WHERE `playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'";
$jorh = array();
$jorh = mysql_fetch_array(mysql_query($q_ry));
$j = ($jorh['my_jail']-time()) > '0' ? 1 : 0;
$h = ($jorh['my_hosp']-time()) > '0' ? 1 : 0;
$s = ($jorh['steps']);
$rand1 = rand(1,20);
$q_ry = array();
$q_ry = "SELECT *
FROM `xmas_outcomes`
WHERE `xo_id` = '$rand1'
LIMIT 1";
$outcome = array();
$outcome = mysql_query($q_ry);
if(mysql_num_rows($outcome))
{
$t = array();
$t = mysql_fetch_array($outcome);
if($t['xo_item'])
{
$rand2 = rand(84,87);
$q_ry = array();
$q_ry = "SELECT `item_name`
FROM `items`
WHERE `item_id` = '$rand2'
LIMIT 1";
$in = array();
$in = mysql_fetch_array(mysql_query($q_ry));
$t['xo_message'] = "<b><font color = 'green'>" . $t['xo_message'];
$t['xo_message'] = str_replace('[item]', $in['item_name'], $t['xo_message']);
$t['xo_message'] .= "</font></b>";
i_credit($_SESSION['playerid'], $rand2, 1);
}
$rand3 = rand(90,100);
$q_ry = array();
$q_ry = "SELECT `item_name`
FROM `items`
WHERE `item_id` = '$rand2'
LIMIT 1";
$in = array();
$in = mysql_fetch_array(mysql_query($q_ry));
$t['xo_message'] = "<b><font color = 'green'>" . $t['xo_message'];
$t['xo_message'] = str_replace('[item]', $in['item_name'], $t['xo_message']);
$t['xo_message'] .= "</font></b>";
i_credit($_SESSION['playerid'], $rand3, 1);
}
else
{
$t['xo_message'] = "<b><font color = 'red'>" . $t['xo_message'];
$t['xo_message'] .= "</font></b>";
$q_ry = array();
$q_ry = "UPDATE `members`
SET `".$t['xo_place']."` = '".mysql_real_escape_string(time()+$t['xo_time'])."',";
if($t['xo_place'] == 'my_hosp')
{
$q_ry.="`hosp_reason` = '".mysql_real_escape_string($t['xo_reason'])."'";
}
else
{
$q_ry.="`jail_reason` = '".mysql_real_escape_string($t['xo_reason'])."'";
}
$q_ry.=" WHERE `playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'";
mysql_query($q_ry);
$q_ry = array();
$q_ry = "DELETE FROM `xmas_town_users`
WHERE `xu_playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'";
mysql_query($q_ry);
}
}
}
else
{
$neutral = array(1=>'You continue to walk your journey through Christmas town,
you find an old house covered in lights, you smash the window but find nothing inside!',
2=>'You continue walking, enjoying the scenery.',
3=>'You hear a sound, you look around and notice a group of elves,
you hide behind a rock, luckily they did not see you!',
4=>'Some carol singers come up to you, you hit them all over the head with a giant candy cane,
they cry and run off calling you an evil scrooge.',
5=>'You find some presents on the ground, you look around to see if anyone can see you,
realizing you are alone you begin to rip the paper,
you find nothing worth keeping!',
6=>'You take a walk through the Christmas town park, nothing here to see but a frozen lake and nuisance kids.',
7=>'You see Santas workshop, you try the door but it is locked.',
8=>'You bump into a elf, he asks you what you are doing here,
you just run and hide at the nearest possible place.',
9=>'You see a reindeer in the middle of a field, you slowly walk up to it, it runs away.',
10=>'You continue walking through Christmas town, it begins to snow,
you get under a tree until it stops.',
11=>'You walk down an old cobble road, you see something shining on the ground,
you pick it up, it is just an old half eaten carrot, you throw it back on the ground.',
12=>'You see Santa with his elves getting the sleigh ready for Christmas day,
you attempt to get inside the giant bag of presents,
unfortunately Santa spots you, you run.',
13=>'You find a Santa 2015 on the ground, you go to pick it up,
a small elf kicks you in the face, you lay on the ground a little dazed. The elf walks off with the Santa 2015');
$t['xo_message'] = "<b>" . $neutral[rand(1,13)] . "</b>";
}
echo "<table width = '80%'>
<tr>
<td align = 'center'>" . $t['xo_message'] . "</td>
</tr>
</table>";
$q_ry = array();
$q_ry = "UPDATE `xmas_town_users`
SET `xu_y` = '".mysql_real_escape_string($newy)."',
`xu_x` = '".mysql_real_escape_string($newx)."'
WHERE `xu_playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'";
mysql_query($q_ry);
}
}
else if($_GET['action'] == 'refreshvisitors')
{
echo "<table border = '0' width = '100%'>
<tr><td align = 'left'><u><b>Users Visiting:</b></u></td></tr>";
$q_ry = array();
$q_ry = "SELECT xu.*,m.playername
FROM `xmas_town_users` xu
LEFT JOIN `members` m
ON xu.xu_playerid = m.playerid
WHERE xu.xu_lasthit >= '".(time()-900)."'
ORDER BY xu.xu_lasthit DESC";
$intown = array();
$intown = mysql_query($q_ry);
while($it = mysql_fetch_array($intown))
{
echo "<tr><td align = 'left'>•<a href='profile.php?XID=".$it['xu_playerid']."'>
<font color = '#FFFFFF'><b>".htmlentities($it['playername'])."</b></font></a></td></tr>";
}
echo "</table>";
}
else if($_GET['action'] == 'refreshchat')
{
echo "<table border = '0' width = '85%' class = 'rounded'>";
$q_ry = array();
$q_ry = "SELECT `xc_id`,`xc_text`
FROM `xmas_town_chat`
ORDER BY `xc_id` DESC
LIMIT 100";
$chats = array();
$chats = mysql_query($q_ry);
while($c = mysql_fetch_array($chats))
{
if($c['xc_id'] % 2) { $color = "#ff0000"; $txtc = "#369801"; } else { $color = "#369801"; $txtc = "#ff0000"; }
echo "";
}
echo "</table>";
}
else if($_GET['action'] == 'post')
{
$q_ry = array();
$q_ry = "SELECT `xu_id`
FROM `xmas_town_users`
WHERE `xu_playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'
LIMIT 1";
$logged = array();
$logged = mysql_query($q_ry);
if(!mysql_num_rows($logged))
{
$q_ry = array();
$q_ry = "INSERT INTO `xmas_town_users`
VALUES ('NULL',
'".mysql_real_escape_string($_SESSION['playerid'])."',
'".mysql_real_escape_string(time())."',
'25',
'25')";
mysql_query($q_ry);
}
else
{
$q_ry = array();
$q_ry = "UPDATE `xmas_town_users`
SET `xu_lasthit` = '".mysql_real_escape_string(time())."'
WHERE `xu_playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."'";
mysql_query($q_ry);
}
if(!$_POST['message'])
{ die(); }
else
{
$_POST['message'] = preg_replace('/[^a-zA-Z0-9?_-\s ]/', '', $_POST['message']);
$text = user_name($_SESSION['playerid']) . ": ".$_POST['message'].".";
$q_ry = array();
$q_ry = "INSERT INTO `xmas_town_chat`
VALUES ('NULL',
'".mysql_real_escape_string($text)."')";
mysql_query($q_ry);
}
}
}
}
?>