This script displays a user-submitted page stored in the database, but it requires a value for itemid to know which database row to retrieve.

"); if (strncmp($_SERVER["SCRIPT_NAME"], $_SERVER["REQUEST_URI"], $minlen) == 0) { $itemid = asciify($_REQUEST["itemid"]); connect_to_database(); $itemrow = table_row("Item", "ItemID", $itemid); if (empty($itemrow)) { $itemid = get_field("ItemID", "OldItemIDs", "OldID", $itemid); $itemrow = table_row("Item", "ItemID", $itemid); } $prefix = substr($itemid, 0, 2); $tail = substr($itemid, 2); $location = ""; if ($prefix == "MZ") $location = "zillions/" . $tail; elseif ($prefix == "ML") $location = "link/" . $tail; elseif ($prefix == "MP") $location = "play/" . $tail; elseif ($itemrow["Type"] == "Piece") $location = "ideas/" . $tail; elseif ($itemrow["Type"] == "Fiction") $location = "fiction/" . $tail; elseif ($itemrow["Type"] == "Contest") $location = "contest/" . $tail; elseif (($itemrow["Type"] == "Game") && (($itemrow["AuthorID"] == $itemrow["InventorID"]) || ($itemrow["AuthorID"] == $itemrow["InventorID2"]) || ($itemrow["AuthorID2"] == $itemrow["InventorID"]) || ($itemrow["AuthorID2"] == $itemrow["InventorID2"]))) $location = "invention/" . $tail; elseif ($itemrow["Type"] == "Game") $location = "report/" . $tail; elseif ($itemrow["Type"] == "Review") $location = "review/" . $tail; if (!empty($location)) { header ("Location: http://www.chessvariants.com/{$location}"); exit(); } } // The ItemID must be in ASCII. Make sure it is. elseif (!empty($_REQUEST["itemid"]) && ($_REQUEST["itemid"] != asciify($_REQUEST["itemid"]))) { $location = "http://www.chessvariants.com" . asciify(urldecode(getenv("REQUEST_URI"))); header("Location: {$location}"); exit(); } ?> $value) { $$key = $value; } } /* if (isset($_SERVER['QUERY_STRING'])) { $baseurl = urldecode($_SERVER['QUERY_STRING']); parse_str($baseurl); } */ } if (empty($itemid)) { echo ("

No item id specified!

"); exit(); } connect_to_database(); if (empty($itemrow)) $itemrow = table_row("Item", "ItemID", $itemid); if (empty($itemrow)) { $itemid = get_field("ItemID", "OldItemIDs", "OldID", $itemid); $itemrow = table_row("Item", "ItemID", $itemid); } if (empty($itemrow) || empty($itemrow["ItemID"]) || !empty($itemrow["IsDeleted"])) { http_response_code(404); // if $itemrow is set, the 404 script will use it instead of looking up the row again include ROOT . "/404.php"; exit(); } // $pagetitle = $itemrow["Summary"]; // $type = $itemrow["Type"]; // $authorid = $itemrow["AuthorID"]; // $authorid2 = $itemrow["AuthorID2"]; // $categories = $itemrow["Categories"]; /* $item = $dbh->prepare("SELECT * FROM Item WHERE ItemID = :itemid"); $item->bindParam(":itemid", $itemid); $item->bindColumn("Summary", $pagetitle); $item->bindColumn("Type", $type); $item->bindColumn("AuthorID", $authorid); $item->bindColumn("AuthorID2", $authorid2); $item->bindColumn("Categories", $categories); if (!$item->execute()) { echo "

Error performing query:

";
	print_r ($item->errorInfo());
	$item->debugDumpParams();
	exit();
}

if (!($row = $item->fetch())) {
	$oldid = $dbh->prepare("SELECT * FROM OldItemIDs WHERE OldID = :itemid");
	$oldid->bindParam(":itemid", $itemid);
	$oldid->bindColumn("ItemID", $itemid);
	
	if (!$oldid->execute()) {
		echo "

Error performing query:

";
		print_r ($item->errorInfo());
		$item->debugDumpParams();
		exit();
	}
	if ($oldid->fetch()) {
		if (!$item->execute()) {
			echo "

Error performing query:

";
			print_r ($item->errorInfo());
			$item->debugDumpParams();
			exit();
		}
		if (!($row = $item->fetch())) {
			die ("The ItemID {$itemid} could not be found.");
		}
	}
	else {
		die ("The ItemID {$itemid} could not be found.");
	}
}
*/
?>


\n{$itemrow["Summary"]}");
if ($itemrow["IsHidden"])
	echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";

if ($itemrow["Type"] == "Game")
	$keywords = "Strategy board game,chess variant";
elseif ($itemrow["Type"] == "Problem")
	$keywords = "Chess variant problem";
elseif ($itemrow["Type"] == "Zillions")
	$keywords = "Zillions-of-Games,software,computer program,strategy board game,chess variant";
elseif ($itemrow["Type"] == "Piece")
	$keywords = "Chess variant pieces";
elseif ($itemrow["Type"] == "Java")
	$keywords = "Java applet";
elseif ($itemrow["Type"] == "PBM")
	$keywords = "Game Courier,game server,play-by-mail,strategy board game,chess variant,play online";
else
	$keywords = "Chess variants";

$keyword = array(
	"chess" => "Chess",
	"1d" => "1D Chess,one-dimensional chess",
	"3d" => "3D Chess,Tri-Dimensional Chess,Three-Dimensional Chess",
	"4d" => "4D Chess,Four-Dimensional Chess",
	"Large" => "Large Chess variant",
	"Small" => "Small Chess variant",
	"Multiplayer" => "Multiplayer Chess variant",
	"Oriental" => "Oriental Chess variant",
	"Historical" => "Historical Chess variant",
	"Dice" => "Chess variant played with dice",
	"Cards" => "Chess variant played with cards",
	"Wargame" => "Wargame,Wargaming",
	"Shape" => "Chess variant with unusual board shape",
	"Hexagonal" => "Hexagonal Chess variant",
	"Round" => "Round Chess variant,Circular Chess variant",
	"IncompleteInfo" => "Imperfect Information Chess Variant,Incomplete Information",
	"UnequalArmies" => "Chess variant with unequal armies",
	"Commercial" => "Commercial Chess variant",
	"Usual-Moving" => "Chess played with different piece movements",
	"Usual-MovingOpponent" => "Chess played by moving opponent's pieces",
	"Usual-MultiMove" => "Chess played with multiple moves per turn",
	"Usual-BoardRules" => "Chess with different board rules",
	"Usual-Winning" => "Chess with different winning conditions",
	"Usual-Setups" => "Chess with a different setup",
	"Usual-Capturing" => "Chess with pieces capturing differently",
	"Usual-Other" => "Like Chess but different",
	"Usual-Modest" => "Modest Chess variant",
	"Crossover" => "Crossover,Hybrid",
	"Singleplayer" => "Single player Chess variant",
	"XiangqiBased" => "Xiangqi,Xiang Qi,Chinese Chess",
	"ShogiBased" => "Shogi,Japanese Chess"
);

$cat = explode(",", $itemrow["Categories"]);
foreach ($cat as $val) {
	if (isset($keyword[$val]))
		$keywords .= ",{$keyword[$val]}";
}
if (strlen($itemid) > 64)
	die ("itemid too long");

$description = get_field("LinkDescription", "IndexEntry", "ItemID", $itemid, "PrimaryLink", 1);

$row3 = table_row("Images", "ItemID", $itemid);

$ismembersubmitted = 1;
if (!empty($image)) {
	echo("\n");
}
if (!empty($description)) {
	echo ("\n");
	echo ("\n");
}
echo ("\n");
if ($itemrow["AuthorID"] && empty($itemrow["AuthorID2"]))
	printf ("\n", personid2name($itemrow["AuthorID"]));
elseif ($itemrow["AuthorID"])
	printf ("\n", personid2name($itemrow["AuthorID"]), personid2name($itemrow["AuthorID2"]));
echo ("\n\n\n");
$langcode = array (
	"English" => "en",
	"Spanish" => "es",
	"French" => "fr",
	"German" => "de",
	"Italian" => "it",
	"Dutch" => "nl",
	"Russian" => "ru",
	"Chinese" => "zh",
	"Japanese" => "ja"
);
echo "";
?>


DISCLAIMER: The ideas expressed on this page are the creative work of its author, %s, and they might not be shared by others responsible for this website. They do not represent any convention, consensus, or standard regarding piece names.
", $itemrow["AuthorID"], personid2name($itemrow["AuthorID"])); elseif (empty($itemrow["AuthorID2"])) printf ("

DISCLAIMER: The ideas expressed on this page are the creative work of its author, %s, and they might not be shared by others responsible for this website.
", $itemrow["AuthorID"], personid2name($itemrow["AuthorID"])); else printf ("

DISCLAIMER: The ideas expressed on this page are the creative work of its authors, %s and %s, and they might not be shared by others responsible for this website..
", $itemrow["AuthorID"], personid2name($itemrow["AuthorID"]), $itemrow["AuthorID2"], personid2name($itemrow["AuthorID2"])); } if (empty($revision)) display_user_submission($itemid); else display_user_submission($itemid, $revision); if (array_key_exists("iseditor", $_SESSION)) { if ($_SESSION["iseditor"]) { include("indexmaintinc.php"); } } include("../footer.php"); echo ("\n"); ?>