/dev/null &");
require_once './function_system.php';
require_once './unitchangedform.php';
session_start();
$_GET["id"] = htmlstr($_GET["id"]);
$_GET["viewnum"] = htmlstr($_GET["viewnum"]);
if ($_GET["id"] == "") $_GET["id"] = $_SESSION["roomid"];
else if ($_GET["id"] != $_SESSION["roomid"])
{
$_SESSION[ "makeunit" ]["imageurl"] = "";
$_SESSION[ "makeunit" ]["thumburl"] = "";
}
if ($_SESSION["id"] == "") $_SESSION["roomid"] = $_GET["id"];
$tempquery = "select id, name from room where id = '". $_GET["id"]."'";
$res = mysqli_query($GLOBALS['dbh'], $tempquery);
while ($item = mysqli_fetch_array($res))
{
$_SESSION["roomid"] =$item['id'];
$roomname =htmlspecialchars($item['name']);
}
$roomid = $_SESSION["roomid"];
$sql_str = "select * from room where id = '".$_SESSION["roomid"]."'";
$result = mysqli_query($GLOBALS['dbh'], $sql_str);
while ($item = mysqli_fetch_array($result))
{
$roomrule = $item['rule'];
$roomstatus =$item['status'];
$roomday =$item['day'];
$bonusbegin =$item['bonus_begin'];
$roombonus =$item['bonus'];
$roomnotice =$item['notice'];
$roomexec = $item['exec'];
$roommaker = $item['maker'];
$roomstealth =$item['stealth'];
$imageurl =$item['imageurl'];
}
if (!$result) {
die;
$message = 'Invalid query: ' . mysqli_error() . "\n";
$message .= 'Whole query: ' . $query . "\n";
die;($message. 'SQLエラー..'.$sql_str);
}
$_SESSION["roomstatus"] = $roomstatus;
$_SESSION["roomday"] = $roomday;
if ($_POST["unitnumber"] != "") $_SESSION['unitnumber'] = $_POST["unitnumber"];
else $_SESSION['unitnumber'] = $_GET["unitnumber"];
if ($_SESSION['unitnumber'] == "") $_SESSION['unitnumber'] = 0;
//発言投稿によるメッセージの作成
if ($_POST["message"] != "")
{
$_POST["message"] = encode($_POST["message"]);
$count = 0;
$res = mysqli_query($GLOBALS['dbh'], "select * from message_".$_POST["postroomid"]);
while ($item = mysqli_fetch_array($res))
{
$count++;
}
$owner = $_SESSION[ "s_user" ];
$sql_str = "select * from unit where owner = '".$_SESSION[ "s_user" ] ."' and room_id = '".$_POST["postroomid"]."'";
$result = mysqli_query($GLOBALS['dbh'], $sql_str);
while ($item = mysqli_fetch_array($result))
{
$unitid =$item['id'];
$unitthumburl =$item['thumburl'];
$owner = "";
}
if (!$result) {
die;
$message = 'Invalid query: ' . mysqli_error() . "\n";
$message .= 'Whole query: ' . $query . "\n";
die;($message. 'SQLエラー..'.$sql_str);
}
$remote_host = getenv("REMOTE_HOST");
$ip_address = getenv("REMOTE_ADDR");
if($remote_host == "" || $remote_host == $ip_address)
{
$remote_host = gethostbyaddr($ip_address);
}
$user_agent = getenv("HTTP_USER_AGENT");
if ($_POST['anony']) $_SESSION['mesanony'] = 'checked';
else $_SESSION['mesanony'] = '';
$_POST["message"] = htmlstr($_POST["message"]);
$sql_str = "insert into message_".$_POST["postroomid"] ." (id, room_status, room_day, postunit, owner, text, thumburl, postfor, anonymous, postdate, remote_host, ip_address, user_agent) ";
$sql_str .= sprintf("values (%d, '%s', %d, %d, '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s')",
$count,
$roomstatus,
$roomday,
$unitid,
$owner,
str_replace("\r\n","
",$_POST["message"]),
$unitthumburl,
encode($_POST['postfor']),
$_POST['anony'],
time(),
$remote_host,
$ip_address,
$user_agent
);
$result = mysqli_query($GLOBALS['dbh'], $sql_str);
if (!$result) {
die;
$message = 'Invalid query: ' . mysqli_error() . "\n";
$message .= 'Whole query: ' . $query . "\n";
die;($message. 'SQLエラー..'.$sql_str);
}
$roomid = $_POST["postroomid"];
header("Location: room.php?id=".$_POST["postroomid"]);
exit;
}
?>
$roomid : $roomname
";
if ($imageurl != '') print '
';
print "部屋設定
";
if ($roomstatus != "ready" && $roomstatus != "lost")
{
for ($i = 1; $i <= $roomday; $i++)
{
print " ";
print "$i 日目生存者リスト ";
//if ($i != 1 || $roombonus == 0 || $roomrule == "一本勝負")
//{
print "$i 日目結果 ";
//}
//else print "
";
print "$i 日目マアグヱリテ表記
";
}
}
print "
";
if ($_GET["viewnum"] != 5) print "発言を最新5件のみにする
";
if ($_GET["viewnum"] != "") print "発言をすべて閲覧
";
print "
";
print'注記事項
';
print nl2br($roomnotice);
print "
";
print "
";
if ($_SESSION[ "s_user" ] != "" && $_SESSION[ "s_password" ] != "")
{
$tempquery = "select * from room where id = '". $_SESSION["roomid"]."'";
$res = mysqli_query($GLOBALS['dbh'], $tempquery);
while ($item = mysqli_fetch_array($res))
{
$status = $item['status'];
$maxday = $item['day'];
$lostdate = $item['losttime'];
$minbegin = $item['begin_playernum'];
$nextup = $item['next_updatetime'];
$roomupdate = $item['update_time'];
$wincount = $item['wincount'];
$imageurl = $item['imageurl'];
if ($roomupdate == "+1 second") $roomupdate = "1秒更新";
if ($roomupdate == "+3 minutes") $roomupdate = "3分更新";
if ($roomupdate == "+10 minutes") $roomupdate = "10分更新";
if ($roomupdate == "+30 minutes") $roomupdate = "30分更新";
if ($roomupdate == "+60 minutes") $roomupdate = "60分更新";
if ($roomupdate == "+24 hours") $roomupdate = "24時間更新";
if ($roomupdate == "+48 hours") $roomupdate = "48時間更新";
if ($roomupdate == "+72 hours") $roomupdate = "72時間更新";
if ($roomupdate == "+1 week") $roomupdate = "一週間更新";
if ($roomupdate == "+2 weeks") $roomupdate = "二週間更新";
}
$loging = include_once('check_loginroom.php');
if (!$loging && $status == "ready") print "参加画面へ
";
else if ($status != "end" && $status != "preend" && $status != "lost")
{
if ($wincount == 0) print "キャラ追加
";
$myunit = include_once("check_loginmyunit.php");
if ($loging && $myunit != -1)
{
$_SESSION[ "myunit" ] = $myunit;
unitchangedform($myunit, $roomid);
}
}
$playernum = 0;
$res = mysqli_query($GLOBALS['dbh'], "select * from unit where room_id = '". $roomid. "' and status = 'live'");
if ($res)
{
while ($item2 = mysqli_fetch_array($res))
{
$playernum++;
}
}
print "
現在の生存者は".$playernum."人です。
";
print "次回更新は".date('m/d H時i分s秒', $nextup)."です。
";
$now = strtotime("now");
print date('m/d H時i分s秒', $now). " ". $roomupdate. "
";
if ($status == "ready")
{
$loss = date('m/d H時i分s秒', $lostdate);
print $loss."までに参加者が".$minbegin."人以上集まらなければ、この部屋は自動消滅します。
";
}
if ($wincount == 0)
{
$tempquery = "select * from unit where owner = '".$_SESSION['s_user']."' and room_day = '".$maxday."' and room_id = '". $roomid."' order by id";
$res = mysqli_query($GLOBALS['dbh'], $tempquery);
$tempcount = 0;
if ($res)
{
while ($item = mysqli_fetch_array($res))
{
print "
".$item['name']." ";
$tempcount++;
}
}
print "
";
}
}
?>
0) mysqli_data_seek($result, 0);
$l =$rows;
}
else
{
if ($rows > 0) mysqli_data_seek($result, max(0, $rows - $viewnum));
if ($rows < $viewnum) $l =$rows;
else $l = $viewnum;
}
for ($i = $l; $i > 0; $i--)
{
list($mesid, $mesroomday, $mespostunit, $mesowner, $mestext, $mesthumburl, $mespostfor, $mespostdate, $mesanonymous) = mysqli_fetch_row($result);
$sql_tmp = "select oldunit from unit where id = ". $mespostunit;
$result2 = mysqli_query($GLOBALS['dbh'], $sql_tmp);
mysqli_data_seek($result2, 0);
list($mesoldunit) = mysqli_fetch_row($result2);
if ($mesoldunit != -1) $sql_tmp = "select name from unit where id = ". $mesoldunit;
else $sql_tmp = "select name from unit where id = ". $mespostunit;
$result2 = mysqli_query($GLOBALS['dbh'], $sql_tmp);
mysqli_data_seek($result2, 0);
list($mespostname) = mysqli_fetch_row($result2);
if ($roomstatus != 'preend' && $roomstatus != 'end' && $roomstatus != 'lost')
{
if (returnowner($mespostunit) == $_SESSION["s_user"]) $mescanread = true;
else if ($mespostfor == $_SESSION["s_user"]) $mescanread = true;
else if ($mespostfor == 'all') $mescanread = true;
else $mescanread = false;
}
else $mescanread = true;
if ($mescanread == false) continue;
if ($mespostfor != 'all') $mestarg = "(→".$mespostfor.")";
else $mestarg = "";
if ($roomstatus != 'preend' && $roomstatus != 'end' && $roomstatus != 'lost') $mesid = "";
if ($roomstatus != 'preend' && $roomstatus != 'end' && $roomstatus != 'lost' && $mesanonymous ) $mesanonycheck = true;
else $mesanonycheck = false;
if ($mesowner != "")
{
echo $mesid; echo " ("; echo $mesroomday. "日目) "; echo "[ ".$mesowner." ]"; echo ":"; echo date('m/d H時i分s秒', $mespostdate); echo "
";
}
else if ($mesanonycheck && returnowner($mespostunit) != $_SESSION["s_user"])
{
echo $mesid; echo " ("; echo $mesroomday. "日目) "; echo "???".$mestarg; echo ":"; echo date('m/d H時i分s秒', $mespostdate); echo "
";
}
else if (!$mesanonymous)
{
echo $mesid; echo " ("; echo $mesroomday. "日目) "; echo $mespostname.$mestarg; echo ":"; echo date('m/d H時i分s秒', $mespostdate); echo "
";
}
else
{
echo $mesid; echo " ("; echo $mesroomday. "日目) "; echo $mespostname."(匿名)".$mestarg; echo ":"; echo date('m/d H時i分s秒', $mespostdate); echo "
";
}
$mesroomday = min(6, $mesroomday);
// print '
';
print '
';
print '
';
//print '';
print "";
print "";
if ($mesthumburl != "" && !$mesanonycheck)
{
if (substr($mesthumburl, 0, 1) != "." && substr($mesthumburl, 0, 22) != "http://stara.mydns.jp/")
{
list($width, $height) = getimagesize($mesthumburl);
}
else if (substr($mesthumburl, 0, 22) == "http://stara.mydns.jp/")
{
list($width, $height) = getimagesize("/WWW/" . substr($mesthumburl, 22, mb_strlen($mesthumburl)));
}
else list($width, $height) = getimagesize(dirname(__FILE__) . substr($mesthumburl, 1, mb_strlen($mesthumburl)));
if ($width == '' && $height == '')
{
$width = 64;
$height = 64;
}
if ($width > $height && $width > 64)
{
$height /= $width / 64;
$width = 64;
}
else if ($width <= $height && $height > 64)
{
$width /= $height / 64;
$height = 64;
}
print " ";
}
print " | ";
print "";
echo $mestext; echo " |
";
print '
';
print '
';
// print '
';
}
?>
";
if ($loging)
{
if ($_SESSION[ "makeunit" ]["thumburl"] != "")
{
$mesthumburl = $_SESSION[ "makeunit" ]["thumburl"];
list($width, $height) = getimagesize(dirname(__FILE__) . substr($mesthumburl, 1, mb_strlen($mesthumburl)));
if ($width > $height && $width > 64)
{
$height /= $width / 64;
$width = 64;
}
else if ($width <= $height && $height > 64)
{
$width /= $height / 64;
$height = 64;
}
print "
 | ";
}
}
print '
';
if ($loging && $status != "end" && $status != "lost")
{
print '
匿名発言';
$playernum = 0;
$res = mysqli_query($GLOBALS['dbh'], "select * from unit where room_id = ". $roomid. " and status = 'live'");
if ($res)
{
while ($item2 = mysqli_fetch_array($res))
{
$playerunitid[] = $item2['id'];
$playeroldunitid[] = $item2['oldunit'];
$playernum++;
}
}
if ($playernum != 0)
{
print "
";
}
else
{
print "
";
}
}
else print "
";
print "
";
if(!$loging) print "
";
else print "
";
print '
';
}
//sisya($roomid, $roomday);
?>
mysql_close();?>
戻る