Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'scripts/fblog.php';
- // Create connection to database
- include 'scripts/sql.php';
- //SQL Table Persons - PID key, Firstname, Lastname,Gender
- $result = mysqli_query($con,"SELECT PID FROM Persons WHERE PID='" . $user_profile['id'] . "'");
- $Signedup = "";
- while($row = mysqli_fetch_array($result))
- {
- $signedup = $row['PID'];
- }
- if ($signedup == "")
- {
- echo "<script> window.location = 'http://calander.site90.net/monopoly/signup.php' </script>";
- }
- //close connection to db
- mysqli_close($con);
- ?>
- <head>
- <link rel="stylesheet" type="text/css" href="style.css">
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
- <script src="scripts/deed.js"></script>
- <script src="scripts/create.js"></script>
- <script src="scripts/play.js"></script>
- <script>
- var Vdeed = true;
- function loadMain(){
- if(Vdeed){
- if(gameid==0){
- loading();
- var xmlhttp;
- 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){
- document.getElementById("the").innerHTML=xmlhttp.responseText;
- }
- }
- xmlhttp.open("GET","main.php?id=" + <?php echo $user_profile['id']; ?> ,true);
- xmlhttp.send();
- }else{
- play(gameid);
- }
- }}
- function AllowDeed(){
- Vdeed =true;
- }
- var Players = new Array();
- function loading(){
- document.getElementById("the").innerHTML="<h1>Loading stuff...</h1>";
- }
- var id0 = <?php echo $user_profile['id']; ?>;
- var gameid = 0;
- //is it this users go?
- function isgo(gamid){
- //send request
- var xmlhttp;
- 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){
- document.getElementById("the").innerHTML=xmlhttp.responseText;
- }
- }
- xmlhttp.open("GET","game.php?gid=" + gamid + "&id=" + id0,true);
- xmlhttp.send();
- }
- function isngo(gamid){
- //send request
- var xmlhttp;
- 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){
- document.getElementById("the").innerHTML=xmlhttp.responseText;
- }
- }
- xmlhttp.open("GET","ogame.php?gid=" + gamid + "&id=" + id0,true);
- xmlhttp.send();
- }
- function play(gamid){
- loading();
- gameid = gamid;
- //check weather it is this users go or not
- var xmlhttp;
- 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){
- var response=xmlhttp.responseText;
- if(response.substring(0,1) == "1"){
- //its the users go
- isgo(gamid);
- }
- else{
- //its not the users go
- isngo(gamid);
- }
- }
- }
- xmlhttp.open("GET","isgo.php?gid=" + gamid + "&id=" + id0,true);
- xmlhttp.send();
- }
- function sub(){
- //The request takes time, tell the user this
- document.getElementById("the").innerHTML= "<h1>Creating your game, please wait...</h1>";
- //build request
- var reques = "creategame.php" + "?p6=" + id0;
- var n = 0;
- for(i=0;i<6;i++){
- if (Players[i] != null){
- reques = reques + "&p" + i + "=" + Players[i];
- }
- else
- {
- n++;
- }
- }
- if(n>5){
- alert('Hay, no players selected!');
- }
- else{
- //send request
- var xmlhttp;
- 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){
- document.getElementById("the").innerHTML=xmlhttp.responseText;
- }
- }
- xmlhttp.open("GET",reques,true);
- xmlhttp.send();
- }
- }
- function senddata(dieval){
- dieval = dieval.substring(1,10);
- //id#game id, id1#playerid, prop1#properistion
- var req = "noti.php?id=" + gameid + "&id1=" + id0 + "&prop1=" + dieval;
- //alert(req);
- //loading();
- var xmlhttp;
- 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){
- var resp = xmlhttp.responseText;
- moveme(gameid,id0,dieval);
- }
- }
- xmlhttp.open("GET",req ,true);
- xmlhttp.send();
- }
- function End(){
- if(rolled){
- nextgo(gameid);
- alert('Go ended!');
- play(gameid);
- }else
- {
- alert('You must roll before ending your turn');
- }
- }
- function checkend(){
- if (gameid!=0){
- //check weather it is this users go or not
- var xmlhttp;
- 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){
- var response=xmlhttp.responseText;
- if(response.substring(0,1) == "1"){
- //its the users go
- End();
- }
- }
- }
- xmlhttp.open("GET","isgo.php?gid=" + gamid + "&id=" + id0,true);
- xmlhttp.send();
- }
- }
- </script>
- </head>
- <body onload="loadMain();">
- <table border="1" class="a1" style=""><tr>
- <?php
- //Draw the map
- // Create connection to database
- include 'scripts/sql.php';
- //use $i as a counter, for 0<$i<=10{first line} for 10<$i<=28{[($i-10)/2]th line} for 28<$i<38{10th line)
- $i=0
- //SQL Table Property
- $result = mysqli_query($con,"SELECT * FROM Property");
- while($row = mysqli_fetch_array($result))
- {
- if($i=11 or $i=13){
- //before the 12th,13th: </tr><tr>
- echo "</tr><tr>";
- }
- if($i == 12){
- //if middle needs putting in
- echo '<td id="the" colspan="9" rowspan="9">';
- echo '<h1>Loading please wait...</h1>';
- echo '</td>';
- }
- if($i % 2 == 1 and $i<28 and $i>13){
- //even i in main body
- echo "</tr><tr>";
- }
- //Draw this [sql] row's property
- if($row['Band']==null){
- //not a banded place
- echo '<td class="property">' . $row['name'] . "</td>";
- }elseif($row['Band']=="Train" OR $row['Band']=="Utility"){
- //Train or utility
- //show the ablilty to show deed but not the colored band
- echo '<td class="property" onclick="loadDeed(' . "'" . $row['id'] . "'" . ')">';
- echo $row['name'] . "</td>";
- }else{
- //property with band
- echo '<td class="property" ><table class="property"><tr>';
- echo '<td id="' . $row['Band'] . '"</td></tr>';
- echo '<tr><td onclick="loadDeed(' . "'" . $row['id'] . "'" . ')">';
- echo $row['name'] . '</td></tr></table></td>';
- }
- //increase the counter
- $i++;
- }
- //close connection to db
- mysqli_close($con);
- ?>
- </tr></table>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment