/View/game.php
PHP | 264 lines | 219 code | 34 blank | 11 comment | 19 complexity | dae192c647c5cff86256737937a28794 MD5 | raw file
Possible License(s): LGPL-2.1
- <?php
- require '../Model/Connect.php';
- require '../Control/RegisterLogic.php';
- ob_start();
- if (isset($_POST['GameID'])) {
- $_SESSION['gameID'] = $_POST['GameID'];
- }
- ?>
-
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Online Chess Portal </title>
- <!-- CSS Files -->
- <link href="css/reset.css" rel="stylesheet" type="text/css" />
- <link href="css/Form.css" rel="stylesheet" type="text/css" />
- <link href="css/style.css" rel="stylesheet" type="text/css" />
- <link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen" />
- <link rel="stylesheet" type="text/css" href="css/jquery.gritter.css" />
- <!-- End of CSS Files -->
- <!-- Javascript Files -->
- <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="javascript/jquery1.3.2.js"></script>
- <script type="text/javascript" src="http://www.google.com/jsapi"></script>
- <script type="text/javascript">google.load('jquery', '1.5');</script>
- <script type="text/javascript" src="js/jquery.gritter.js"></script>
- <script type="text/javascript" src="js/jquery.js"></script>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
-
- <script type="text/javascript">
-
- var time_interval = setInterval(
- function ()
- {
- $('#popup').load('../Control/Notification.php').fadeIn("slow");
- }, 5000); // refresh every 5000 milliseconds
-
- </script>
- <!-- End of Javascript Files -->
- <style type="text/css">
- a:focus {
- outline: none;
- }
- #panel {
- background: #e6f2ff;
- height: 200px;
- width:100%;
- display: none;
- overflow-y: auto;
- overflow-x: hidden;
- }
- .input {
- border:1px solid #EEEEEE;
- height:auto;
- margin:1px;
- overflow:hidden;
- padding:3px 0 3px 3px;
- width:97%;
- left:0;
- position:absolute;
- top:75%
- }
- .slide {
- margin: 0;
- padding: 0;
- background: #0099cc;
- }
- .btn-slide {
- background: url(images/white-arrow.gif) no-repeat right -50px;
- text-align: center;
- width: 200px;
- height: 20px;
- padding: 10px 10px 0 0;
- margin: 0 auto;
- display: block;
- font: Tahoma, Geneva, sans-serif;
- color: #000000;
- text-decoration: none;
- }
- .active {
- background-position: right 12px;
- }
- </style>
- <script type="text/javascript">
- $(document).ready(function(){
-
- $(".btn-slide").click(function(){
- $("#panel").slideToggle("slow");
- $(this).toggleClass("active"); return false;
- });
-
-
- });
-
- var time_interval = setInterval(
- function ()
- {
- $('#popup').load('../Control/Notification.php').fadeIn("slow");
- $('#load_order').load('Chat.php').fadeIn("slow");
- }, 1000); // refresh every 5000 milliseconds
-
- /*$("#chat").keyup(function(event){
- if(event.keyCode == 13){
- alert('enter pressed');
- }
- });*/
-
- function SubmitChat(elem) {
- //alert(id);
- message = elem.value;
- if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp=new XMLHttpRequest();
- } else {// code for IE6, IE5
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function() {
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- //alert(xmlhttp.responseText);
- if(xmlhttp.responseText.match(/Success/)) {
- elem.value = " ";
- } else {
- elem.value = "Something went wrong."
- }
- elem.value
- }
- }
- xmlhttp.open("GET","../Control/SubmitChat.php?Id="+<?php echo json_encode($_SESSION['gameID']); ?>+"&Message="+message,true);
- xmlhttp.send();
- }
-
- </script>
-
-
- </head>
- <body>
- <!-- Wrapper -->
- <div id="wrapper">
- <div id="topbar">
- <img src="images/icon1.png" alt="logo" width="42" height="41" class="logo" id='test' /><img src="images/logo.gif" alt="logo" width="322" height="41" class="logo1" id='test' />
-
- <div id="secnav">
- <ul>
- <li> <a href="../Control/LogoutLogic.php?Reason=Normal">SIGN OUT</a> </li>
- <li class="noimg"></li>
- </ul>
- </div>
-
- <div class="menu">
- <ul class="sf-menu">
-
- <li> <?php if($_SESSION['role'] == 'SiteAdmin') {
- ?> <a href="SiteAdminProfile.php">
- <?php } else { ?>
- <a href="MemberProfile.php">
- <?php }
- $result = mysql_query("SELECT mp_fullname FROM memberprofile WHERE mp_username='".$_SESSION['username']."' ");
- $row = mysql_fetch_array($result);
- $Rows = mysql_num_rows($result);
- if($_SESSION['role'] == 'SiteAdmin' || $Rows == 0) {
- echo 'Profile';
- } else {
- echo $row['mp_fullname'];
- }?></a>
- </li>
-
- </ul>
-
- </div> </div><!-- menu end-->
-
-
- <div id="content">
- <div class="froms">
- <iframe src="webchs/chess.php" width="900" height="645" >
- </iframe>
-
- </div></div>
- <div id="sidebar">
- <div id="panel">
- <table width = 100%>
- <span id="load_order"></span>
- </table>
- <input class="input" type="text" onfocus="select();" name="chat" id="chat" onkeydown="if (event.keyCode == 13) SubmitChat(document.getElementById('chat'));"/>
- </div>
- <?php
- $Query1 = "SELECT * FROM `games` WHERE ga_gameid =".$_SESSION['gameID'];
- $Info1 = mysql_fetch_assoc(mysql_query($Query1));
-
- $QueryWhite = "SELECT * FROM `user` WHERE us_id ='".$Info1['ga_whiteplayer']."'";
- $InfoW = mysql_fetch_assoc(mysql_query($QueryWhite));
- $White = $InfoW['us_username'];
-
- $QueryBlack = "SELECT * FROM `user` WHERE us_id ='".$Info1['ga_blackplayer']."'";
- $InfoB = mysql_fetch_assoc(mysql_query($QueryBlack));
- $Black = $InfoB['us_username'];
-
- if($White == $_SESSION['username']) {
- $Opponent = $Black;
- } else {
- $Opponent = $White;
- }
- //echo '<script language="javascript">alert("'.$_SESSION['username'].'")</script>';
- //echo '<script language="javascript">alert("'.$Opponent.'")</script>';
-
- $Query2 = "SELECT * FROM `memberprofile` WHERE mp_username ='".$Opponent."'";
- $Info2 = mysql_fetch_assoc(mysql_query($Query2));
- $OpponentName = $Info2['mp_fullname'];
- //echo '<script language="javascript">alert("'.$Info2['mp_fullname'].'")</script>';
- ?>
- <p class="slide"><a href="#" class="btn-slide"><?php echo $OpponentName; ?></a></p>
- </div>
- <!-- topbar-->
- <!-- new code-->
- <layer>
- <ul id="navigation">
- <li class="home"><a href="Home_Login.php" title="Home"></a></li>
- <li class="play"><a href="Play.php" title="Play Chess"></a></li>
- <li class="ChessBoard"><a href="TraningGames.php" title="Traning Chess Game"></a></li>
- <li class="photos"><a href="Inbox.php" title="Inbox"></a></li>
- <li class="club"><a href="SearchClub.php" title="Clubs"></a></li>
- <li class="settings"><a href="Settings.php" title="Settings"></a></li>
-
- </ul>
-
- </layer>
-
- <script type="text/javascript">
- $(function() {
- $('#navigation a').stop().animate({'marginLeft':'-90px'},100);
-
- $('#navigation > li').hover(
- function () {
- $('a',$(this)).stop().animate({'marginLeft':'-70px'},100);
- },
- function () {
- $('a',$(this)).stop().animate({'marginLeft':'-90px'},100);
- }
- );
- });
- </script>
- <!--new code end -->
- <div class="clear"></div>
- <div id="footers">
-
-
- <div style="float:right"><div class="fotterlast">
- <a href="#" title="About Us">About Us</a>
- |
- <a href="#" title="Terms of Service">Terms of Service</a>
- |
- <a href="#" title="Privacy Statement">Privacy</a>
- |
- <a href="Contact.php" title="Contact Us">Contact Us</a>
- </div></div>
-
- <div style="float:Left"><div class="fotterlastdesing">Designed by SEP_WE_05 Team.</div></div>
-
- </div>
- </div>
- </div>
- </div>
- </body>
- </html>