submit.php

来自「中国象棋online web版的线上棋牌游戏。 能建房间」· PHP 代码 · 共 31 行

PHP
31
字号
<?php
include "./functions.php";
include "./dbconnect.php";

$query = mysql_query("select * from `room` where `ID` = '".$_GET[roomid]."'");
$chess = mysql_result($query, 0, chess);

$chess_explode = explode(",", $chess);

for($c = "", $i = 0;$i < sizeof($chess_explode);$i ++)
{
	$new_chess = $chess_explode[$i];
	if($i + 1 == $_GET[from])
	$new_chess = "blank";
	if($i + 1 == $_GET[to])
	{
		if($chess_explode[$i] != "blank")
		$eated = $chess_explode[$i];
		$new_chess = $chess_explode[$_GET[from] - 1];
	}
	
	$c .= $new_chess.",";
}

if($_GET[site] == guest)
$flag = host;
else
$flag = guest;

mysql_query("update `room` set `chess` = '$c', `flag` = '$flag', `moved` = '".$_GET[from].",".$_GET[to]."', `eated` = '$eated' where `ID` = '".$_GET[roomid]."' limit 1");
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?