PageRenderTime 122ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/View/game.php

https://bitbucket.org/onlinechessportal/onlinechessgameportal
PHP | 264 lines | 219 code | 34 blank | 11 comment | 19 complexity | dae192c647c5cff86256737937a28794 MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. require '../Model/Connect.php';
  3. require '../Control/RegisterLogic.php';
  4. ob_start();
  5. if (isset($_POST['GameID'])) {
  6. $_SESSION['gameID'] = $_POST['GameID'];
  7. }
  8. ?>
  9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  10. <html xmlns="http://www.w3.org/1999/xhtml">
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  13. <title>Online Chess Portal </title>
  14. <!-- CSS Files -->
  15. <link href="css/reset.css" rel="stylesheet" type="text/css" />
  16. <link href="css/Form.css" rel="stylesheet" type="text/css" />
  17. <link href="css/style.css" rel="stylesheet" type="text/css" />
  18. <link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen" />
  19. <link rel="stylesheet" type="text/css" href="css/jquery.gritter.css" />
  20. <!-- End of CSS Files -->
  21. <!-- Javascript Files -->
  22. <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
  23. <script type="text/javascript" src="javascript/jquery1.3.2.js"></script>
  24. <script type="text/javascript" src="http://www.google.com/jsapi"></script>
  25. <script type="text/javascript">google.load('jquery', '1.5');</script>
  26. <script type="text/javascript" src="js/jquery.gritter.js"></script>
  27. <script type="text/javascript" src="js/jquery.js"></script>
  28. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
  29. <script type="text/javascript">
  30. var time_interval = setInterval(
  31. function ()
  32. {
  33. $('#popup').load('../Control/Notification.php').fadeIn("slow");
  34. }, 5000); // refresh every 5000 milliseconds
  35. </script>
  36. <!-- End of Javascript Files -->
  37. <style type="text/css">
  38. a:focus {
  39. outline: none;
  40. }
  41. #panel {
  42. background: #e6f2ff;
  43. height: 200px;
  44. width:100%;
  45. display: none;
  46. overflow-y: auto;
  47. overflow-x: hidden;
  48. }
  49. .input {
  50. border:1px solid #EEEEEE;
  51. height:auto;
  52. margin:1px;
  53. overflow:hidden;
  54. padding:3px 0 3px 3px;
  55. width:97%;
  56. left:0;
  57. position:absolute;
  58. top:75%
  59. }
  60. .slide {
  61. margin: 0;
  62. padding: 0;
  63. background: #0099cc;
  64. }
  65. .btn-slide {
  66. background: url(images/white-arrow.gif) no-repeat right -50px;
  67. text-align: center;
  68. width: 200px;
  69. height: 20px;
  70. padding: 10px 10px 0 0;
  71. margin: 0 auto;
  72. display: block;
  73. font: Tahoma, Geneva, sans-serif;
  74. color: #000000;
  75. text-decoration: none;
  76. }
  77. .active {
  78. background-position: right 12px;
  79. }
  80. </style>
  81. <script type="text/javascript">
  82. $(document).ready(function(){
  83. $(".btn-slide").click(function(){
  84. $("#panel").slideToggle("slow");
  85. $(this).toggleClass("active"); return false;
  86. });
  87. });
  88. var time_interval = setInterval(
  89. function ()
  90. {
  91. $('#popup').load('../Control/Notification.php').fadeIn("slow");
  92. $('#load_order').load('Chat.php').fadeIn("slow");
  93. }, 1000); // refresh every 5000 milliseconds
  94. /*$("#chat").keyup(function(event){
  95. if(event.keyCode == 13){
  96. alert('enter pressed');
  97. }
  98. });*/
  99. function SubmitChat(elem) {
  100. //alert(id);
  101. message = elem.value;
  102. if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
  103. xmlhttp=new XMLHttpRequest();
  104. } else {// code for IE6, IE5
  105. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  106. }
  107. xmlhttp.onreadystatechange=function() {
  108. if (xmlhttp.readyState==4 && xmlhttp.status==200) {
  109. //alert(xmlhttp.responseText);
  110. if(xmlhttp.responseText.match(/Success/)) {
  111. elem.value = " ";
  112. } else {
  113. elem.value = "Something went wrong."
  114. }
  115. elem.value
  116. }
  117. }
  118. xmlhttp.open("GET","../Control/SubmitChat.php?Id="+<?php echo json_encode($_SESSION['gameID']); ?>+"&Message="+message,true);
  119. xmlhttp.send();
  120. }
  121. </script>
  122. </head>
  123. <body>
  124. <!-- Wrapper -->
  125. <div id="wrapper">
  126. <div id="topbar">
  127. <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' />
  128. <div id="secnav">
  129. <ul>
  130. <li> <a href="../Control/LogoutLogic.php?Reason=Normal">SIGN OUT</a> </li>
  131. <li class="noimg"></li>
  132. </ul>
  133. </div>
  134. <div class="menu">
  135. <ul class="sf-menu">
  136. <li> <?php if($_SESSION['role'] == 'SiteAdmin') {
  137. ?> <a href="SiteAdminProfile.php">
  138. <?php } else { ?>
  139. <a href="MemberProfile.php">
  140. <?php }
  141. $result = mysql_query("SELECT mp_fullname FROM memberprofile WHERE mp_username='".$_SESSION['username']."' ");
  142. $row = mysql_fetch_array($result);
  143. $Rows = mysql_num_rows($result);
  144. if($_SESSION['role'] == 'SiteAdmin' || $Rows == 0) {
  145. echo 'Profile';
  146. } else {
  147. echo $row['mp_fullname'];
  148. }?></a>
  149. </li>
  150. </ul>
  151. </div> </div><!-- menu end-->
  152. <div id="content">
  153. <div class="froms">
  154. <iframe src="webchs/chess.php" width="900" height="645" >
  155. </iframe>
  156. </div></div>
  157. <div id="sidebar">
  158. <div id="panel">
  159. <table width = 100%>
  160. <span id="load_order"></span>
  161. </table>
  162. <input class="input" type="text" onfocus="select();" name="chat" id="chat" onkeydown="if (event.keyCode == 13) SubmitChat(document.getElementById('chat'));"/>
  163. </div>
  164. <?php
  165. $Query1 = "SELECT * FROM `games` WHERE ga_gameid =".$_SESSION['gameID'];
  166. $Info1 = mysql_fetch_assoc(mysql_query($Query1));
  167. $QueryWhite = "SELECT * FROM `user` WHERE us_id ='".$Info1['ga_whiteplayer']."'";
  168. $InfoW = mysql_fetch_assoc(mysql_query($QueryWhite));
  169. $White = $InfoW['us_username'];
  170. $QueryBlack = "SELECT * FROM `user` WHERE us_id ='".$Info1['ga_blackplayer']."'";
  171. $InfoB = mysql_fetch_assoc(mysql_query($QueryBlack));
  172. $Black = $InfoB['us_username'];
  173. if($White == $_SESSION['username']) {
  174. $Opponent = $Black;
  175. } else {
  176. $Opponent = $White;
  177. }
  178. //echo '<script language="javascript">alert("'.$_SESSION['username'].'")</script>';
  179. //echo '<script language="javascript">alert("'.$Opponent.'")</script>';
  180. $Query2 = "SELECT * FROM `memberprofile` WHERE mp_username ='".$Opponent."'";
  181. $Info2 = mysql_fetch_assoc(mysql_query($Query2));
  182. $OpponentName = $Info2['mp_fullname'];
  183. //echo '<script language="javascript">alert("'.$Info2['mp_fullname'].'")</script>';
  184. ?>
  185. <p class="slide"><a href="#" class="btn-slide"><?php echo $OpponentName; ?></a></p>
  186. </div>
  187. <!-- topbar-->
  188. <!-- new code-->
  189. <layer>
  190. <ul id="navigation">
  191. <li class="home"><a href="Home_Login.php" title="Home"></a></li>
  192. <li class="play"><a href="Play.php" title="Play Chess"></a></li>
  193. <li class="ChessBoard"><a href="TraningGames.php" title="Traning Chess Game"></a></li>
  194. <li class="photos"><a href="Inbox.php" title="Inbox"></a></li>
  195. <li class="club"><a href="SearchClub.php" title="Clubs"></a></li>
  196. <li class="settings"><a href="Settings.php" title="Settings"></a></li>
  197. </ul>
  198. </layer>
  199. <script type="text/javascript">
  200. $(function() {
  201. $('#navigation a').stop().animate({'marginLeft':'-90px'},100);
  202. $('#navigation > li').hover(
  203. function () {
  204. $('a',$(this)).stop().animate({'marginLeft':'-70px'},100);
  205. },
  206. function () {
  207. $('a',$(this)).stop().animate({'marginLeft':'-90px'},100);
  208. }
  209. );
  210. });
  211. </script>
  212. <!--new code end -->
  213. <div class="clear"></div>
  214. <div id="footers">
  215. <div style="float:right"><div class="fotterlast">
  216. <a href="#" title="About Us">About Us</a>
  217. |
  218. <a href="#" title="Terms of Service">Terms of Service</a>
  219. |
  220. <a href="#" title="Privacy Statement">Privacy</a>
  221. |
  222. <a href="Contact.php" title="Contact Us">Contact Us</a>
  223. </div></div>
  224. <div style="float:Left"><div class="fotterlastdesing">Designed by SEP_WE_05 Team.</div></div>
  225. </div>
  226. </div>
  227. </div>
  228. </div>
  229. </body>
  230. </html>