@PamukBilisim;

Bu şekilde daha iyi sanki ;

Alıntı
<?php
	
	/* 
	 * SAINTX » Taş Kağıt Makas Oyunu
	 * 
	 * @author: Ogün KARAKUŞ
	 * @web: http://saintx.net
	 * @email: im@saintx.net
	 * @createdAt: 02.12.2013
	 * @lastUpdate: 02.12.2013
	 */
	
	$user_agent = (isset($_SERVER["HTTP_USER_AGENT"])) ? getenv("HTTP_USER_AGENT") : null;
	
	if(!is_null($user_agent)) {
		if(PHP_VERSION >= "4.0.4pl1" && (strstr($user_agent, "compatible") || strstr($user_agent, "Gecko"))) {
			if(extension_loaded("zlib")) {
				$do_gzip_compress = false;
				
				ob_start("ob_gzhandler");
			} else {
				$do_gzip_compress = false;
			}
		} else if(PHP_VERSION > "4.0") {
			if(strstr(getenv("HTTP_ACCEPT_ENCODING"), "gzip")) {
				if(extension_loaded("zlib")) {
					$do_gzip_compress = true;
					
					ob_start();
					ob_implicit_flush(0);
					
					header("Content-Encoding: gzip, deflate");
				} else {
					$do_gzip_compress = false;
				}
			}
		} else {
			$do_gzip_compress = false;
		}
	}
	
	session_name("SAINTX");
	
	session_set_cookie_params((60 * 60 * 6));
	
	session_start();
	
@	error_reporting(E_ALL);
	
@	set_time_limit(0);
	
@	ini_set("html_errors", false);
	
	define("SAINTX", true);
	
	define("TURKISH_CHARS_HEX_VALS", "{\"\u00d6\":\"Ö\",\"\u00c7\":\"Ç\",\"\u015e\":\"Ş\",\"\u0130\":\"İ\",\"\u011e\":\"Ğ\",\"\u00f6\":\"ö\",\"\u00e7\":\"ç\",\"\u015f\":\"ş\",\"\u0131\":\"ı\",\"\u00fc\":\"ü\",\"\u011f\":\"ğ\"}");
	
	function str_encode($string) {
		$replace_char_list = json_decode(TURKISH_CHARS_HEX_VALS, true);
		
		return str_replace(
			array_keys($replace_char_list),
			array_values($replace_char_list),
			str_replace(" ", "&nbsp;", htmlentities($string, ENT_COMPAT, "UTF-8", true))
		);
	}
	
	function str_decode($string) {
		$replace_char_list = json_decode(TURKISH_CHARS_HEX_VALS, true);
		
		return str_replace(
			array_values($replace_char_list),
			array_keys($replace_char_list),
			str_replace("&nbsp;", " ", html_entity_decode($string, ENT_COMPAT, "UTF-8"))
		);
	}
	
	function is_ssl() {
		if(isset($_SERVER["HTTPS"]))
			if("on" == strtolower(getenv("HTTPS")))
				return true;
			if("1" == getenv("HTTPS"))
				return true;
		else if(isset($_SERVER["SERVER_PORT"]) && ("443" == getenv("SERVER_PORT")))
			return true;
		else
			return false;
	}
	
	function get_current_url() {
		$scheme = (is_ssl()) ? "https" : "http";
		$host = getenv("HTTP_HOST");
		$base_path = str_replace("\\", "/", getenv("SCRIPT_NAME"));
		
		return sprintf("%s", sprintf("%s://%s%s", $scheme, $host, $base_path));
	}
	
	if(array_key_exists("choice", $_POST)) {
		header("Content-Type: application/json; charset=UTF-8");
		
		$output = null;
		
		$choice = (strlen($_POST["choice"]) <= 0) ? null : $_POST["choice"];
		
		$items = array(
			(object) array(
				"value" => (object) array(
					"en_US" => "rock",
					"tr_TR" => str_encode("Taş"),
					"tr_TR_2" => str_encode("Taşı")
				)
			),
			(object) array(
				"value" => (object) array(
					"en_US" => "paper",
					"tr_TR" => str_encode("Kağıt"),
					"tr_TR_2" => str_encode("Kağıdı")
				)
			),
			(object) array(
				"value" => (object) array(
					"en_US" => "scissor",
					"tr_TR" => str_encode("Makas"),
					"tr_TR_2" => str_encode("Makası")
				)
			)
		);
		
		$messages = (object) array(
			"draw" => (object) array(
				"title" => str_encode("Berabere!"),
				"body" => str_replace(
					"__CHOICE__", "<strong>%s</strong>",
					str_encode(
						"İkinizde __CHOICE__ seçtiniz. Durum berabere, şansını tekrardan dene istersen?"
					)
				)
			),
			"lose" => (object) array(
				"title" => str_encode("Kaybettiniz!"),
				"body" => str_replace("__BR__", "<br />", str_replace(
					array(
						"__WINNER__",
						"__CHOICE__",
						"__CHOICE_STATUS__",
						"__WINNER_CHOICE__",
						"__WINNER_CHOICE_STATUS__"
					),
					array(
						"<strong>%s</strong>",
						"<strong>%s</strong>",
						"%s",
						"<strong>%s</strong>",
						"<strong>%s</strong>"
					),
					str_encode(
						"Kaybettiniz! __WINNER__ kazandı! Siz __CHOICE__ seçtiniz.__BR____WINNER__ ise __WINNER_CHOICE__ seçti. Bu durumda __WINNER_CHOICE_STATUS__, __CHOICE_STATUS__."
					)
				))
			),
			"won" => (object) array(
				"title" => str_encode("Kazandınız!"),
				"body" => str_replace("__BR__", "<br />", str_replace(
					array(
						"__WINNER__",
						"__LOSER__",
						"__CHOICE__",
						"__CHOICE_STATUS__",
						"__LOSER_CHOICE__",
						"__LOSER_CHOICE_STATUS__"
					),
					array(
						"<strong>%s</strong>",
						"<strong>%s</strong>",
						"<strong>%s</strong>",
						"%s",
						"<strong>%s</strong>",
						"<strong>%s</strong>"
					),
					str_encode(
						"Tebrikler, __WINNER__ kazandınız! Siz __CHOICE__ seçtiniz.__BR____LOSER__ ise __LOSER_CHOICE__ seçti. Bu durumda __LOSER_CHOICE_STATUS__, __CHOICE_STATUS__."
					)
				))
			)
		);
		
		$random_number = rand(0, 2);
		
		$item = $items[$random_number];
		
		$output = (object) array(
			"data" => (object) array(
				"title" => null,
				"body" => null
			)
		);
		
		if(!is_null($choice)) {
			
			if($choice == $item->value->en_US) {
				$output->data->title = $messages->draw->title;
				$output->data->body = sprintf($messages->draw->body, $item->value->tr_TR_2);
			} else {
				
				if($item->value->en_US == $items[0]->value->en_US && $choice == $items[2]->value->en_US) {
					$output->data->title = $messages->lose->title;
					$output->data->body = sprintf(
						$messages->lose->body,
						"Bilgisayar",
						strtolower($items[2]->value->tr_TR_2),
						"Bilgisayar",
						strtolower($items[0]->value->tr_TR_2),
						$items[0]->value->tr_TR,
						strtolower($items[2]->value->tr_TR_2) . " <strong>kırdı</strong>"
					);
				}
				
				if($item->value->en_US == $items[1]->value->en_US && $choice == $items[0]->value->en_US) {
					$output->data->title = $messages->lose->title;
					$output->data->body = sprintf(
						$messages->lose->body,
						"Bilgisayar",
						strtolower($items[0]->value->tr_TR_2),
						"Bilgisayar",
						strtolower($items[1]->value->tr_TR_2),
						$items[1]->value->tr_TR,
						strtolower($items[0]->value->tr_TR_2) . " <strong>yedi</strong>"
					);
				}
				
				if($item->value->en_US == $items[2]->value->en_US && $choice == $items[1]->value->en_US) {
					$output->data->title = $messages->lose->title;
					$output->data->body = sprintf(
						$messages->lose->body,
						"Bilgisayar",
						strtolower($items[1]->value->tr_TR_2),
						"Bilgisayar",
						strtolower($items[2]->value->tr_TR_2),
						$items[2]->value->tr_TR,
						strtolower($items[1]->value->tr_TR_2) . " <strong>kesti</strong>"
					);
				}
				
				if($item->value->en_US == $items[2]->value->en_US && $choice == $items[0]->value->en_US) {
					$output->data->title = $messages->won->title;
					$output->data->body = sprintf(
						$messages->won->body,
						"Siz",
						strtolower($items[0]->value->tr_TR_2),
						"Bilgisayar",
						strtolower($items[2]->value->tr_TR_2),
						$items[0]->value->tr_TR,
						strtolower($items[2]->value->tr_TR_2) . " <strong>kırdı</strong>"
					);
				}
				
				if($item->value->en_US == $items[0]->value->en_US && $choice == $items[1]->value->en_US) {
					$output->data->title = $messages->won->title;
					$output->data->body = sprintf(
						$messages->won->body,
						"Siz",
						strtolower($items[1]->value->tr_TR_2),
						"Bilgisayar",
						strtolower($items[0]->value->tr_TR_2),
						$items[1]->value->tr_TR,
						strtolower($items[0]->value->tr_TR_2) . " <strong>yedi</strong>"
					);
				}
				
				if($item->value->en_US == $items[1]->value->en_US && $choice == $items[2]->value->en_US) {
					$output->data->title = $messages->won->title;
					$output->data->body = sprintf(
						$messages->won->body,
						"Siz",
						strtolower($items[2]->value->tr_TR_2),
						"Bilgisayar",
						strtolower($items[1]->value->tr_TR_2),
						$items[2]->value->tr_TR,
						strtolower($items[1]->value->tr_TR_2) . " <strong>kesti</strong>"
					);
				}
			}
		}
		
		exit(json_encode($output));
	}
	
	header("Content-Type: text/html; charset=UTF-8");
	
?><!DOCTYPE html>
<!--[if lt IE 7]>
	<html class="no-js lt-ie9 lt-ie8 lt-ie7" xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<![endif]-->
<!--[if IE 7]>
	<html class="no-js lt-ie9 lt-ie8" xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<![endif]-->
<!--[if IE 8]>
	<html class="no-js lt-ie9" xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<![endif]-->
<!--[if gt IE 8]><!-->
	<html class="no-js" xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<!--<![endif]-->
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
		<!--[if lt IE 9]>
			<meta http-equiv="X-UA-Compatible" content="IE=9,chrome=1" />
		<![endif]-->
		<title><?=str_encode("Taş Kağıt Makas Oyunu");?></title>
		<meta name="author" content="<?=str_encode("Ogün KARAKUŞ");?>" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="icon" type="image/x-icon" href="http://saintx.net/assets/img/favicon.ico" />
	</head>
	<body>
		<div id="wrapper" class="container">
			<article id="container" class="row">
				<section id="site" class="panel panel-default col-12-lg">
					<div class="panel-heading text-left">
						<code class="label label-info"><?=str_encode("Taş");?></code>&nbsp;<code class="label label-warning"><?=str_encode("Kağıt");?></code>&nbsp;<code class="label label-success"><?=str_encode("Makas");?></code>&nbsp;<code class="label label-danger"><?=str_encode("Oyunu");?></code>
					</div>
					<form id="site-form" class="panel-body text-center" method="post" onsubmit="javascript:return false">
						<input type="hidden" id="choice-value" name="choice" />
						<div class="btn-group">
							<button type="button" id="choice-button-1" data-value="rock" class="btn btn-info btn-lg"><?=str_encode("Taş");?></button>
							<button type="button" id="choice-button-2" data-value="paper" class="btn btn-warning btn-lg"><?=str_encode("Kağıt");?></button>
							<button type="button" id="choice-button-3" data-value="scissor" class="btn btn-success btn-lg"><?=str_encode("Makas");?></button>
						</div>
						<div class="clearfix height-25"></div>
						<button type="submit" class="btn btn-danger btn-lg"><?=str_encode("Hadi Bakalım!");?></button>
					</form>
				</section>
			</article>
			<footer class="text-right">
				<small>&copy;&nbsp;<?=date("Y");?>,&nbsp;<a href="http://saintx.net/" title="<?=str_encode("Ogün KARAKUŞ");?>" target="_blank" rel="external nofollow"><?=str_encode("Ogün KARAKUŞ");?></a></small>
				<br />
				<em>
					<small><?=str_encode("her şeyi sana yazdım ");?>&hellip;</small>
				</em>
			</footer>
		</div>
		<div aria-hidden="false" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal" class="modal fade">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button aria-hidden="true" data-dismiss="modal" class="close" type="button">&times;</button>
						<h4 id="myModalTitle" class="modal-title">&nbsp;</h4>
					</div>
					<div id="myModalBody" class="modal-body">&nbsp;</div>
					<div class="modal-footer">
						<button data-dismiss="modal" class="btn btn-default btn-danger" type="button"><?=str_encode("Kapat");?></button>
					</div>
				</div>
			</div>
		</div>
		<script type="text/javascript">window.onerror=function(a,b,c){console.log({url:b,line:c,message:a})}</script>
		<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
		<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
		<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/js/bootstrap.min.js"></script>
		<script type="text/javascript">
			function buttonHandler(buttonId) {
				var button = $("button#choice-button-" + buttonId);
				
				$("input#choice-value").val(button.data("value"));
				
				for(var i = 1; i <= 3; ++i)
					$("button#choice-button-" + i).removeClass("active");
				
				
				button.addClass("active");
				
				return false;
			}
			
			$(function() {
				$("button#choice-button-1").click(function() {
					return buttonHandler("1");
				});
				
				$("button#choice-button-2").click(function() {
					return buttonHandler("2");
				});
				
				$("button#choice-button-3").click(function() {
					return buttonHandler("3");
				});
				
				$("form#site-form").submit(function() {
					if($("input#choice-value").val().length > 0) {
						$.ajax({
							url: "<?=get_current_url();?>",
							type: "POST",
							data: $("form#site-form").serialize(),
							dataType: "json",
							async: true,
							cache: false
						}).done(function(response) {
							$("input#choice-value").val("");
							
							for(var i = 1; i <= 3; ++i)
								$("button#choice-button-" + i).removeClass("active");
							
							$("h4#myModalTitle").html(response.data.title);
							$("div#myModalBody").html("<p>" + response.data.body + "</p>");
						
							$("div#myModal").modal("show");
						}).fail(function(jqXHR, status) {
							$("input#choice-value").val("");
							
							for(var i = 1; i <= 3; ++i)
								$("button#choice-button-" + i).removeClass("active");
							
							console.log("Request failed; " + status);
						});
					} else {
						$("h4#myModalTitle").html("<?=str_encode("Hata!");?>");
						$("div#myModalBody").html("<?=str_encode("Oyun bozanlık yapmanın anlamı yok! Lütfen bi' seçim yap!");?>");
						
						$("div#myModal").modal("show");
					}
				});
			});
		</script>
		<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap-theme.min.css" />
		<style type="text/css">body{padding-top:50px;padding-bottom:50px}label,input[type="radio"]{cursor:pointer}.height-25{width:100%;height:15px}</style>
	</body>
</html><?php
	
	if($do_gzip_compress) {
		$gzip_contents = ob_get_contents();
		
		ob_end_clean();
		
		$gzip_size = strlen($gzip_contents);
		$gzip_crc32 = crc32($gzip_contents);
		
		$gzip_contents = gzcompress($gzip_contents, 9);
		$gzip_contents = substr($gzip_contents, 0, (strlen($gzip_contents) - 4));
		
		echo "\x1f\x8b\x08\x00\x00\x00\x00\x00" . $gzip_contents . pack("V", $gzip_crc) . pack("V", $gzip_size);
	}
Oynamak isteyen olursa buradan oynayabilir.