Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- page loaded assuming it is the users go !-->
- <body>
- <?php
- //startup scripts
- // Create connection to database
- include 'scripts/sql.php';
- //get list of users
- //$result = mysqli_query($con,"SELECT * FROM y" . $_GET['gid']);
- //while($row = mysqli_fetch_array($result))
- // {
- // echo "<li>" . $row["prop1"] . "</li>";
- // }
- echo $_GET['gid'];
- ?>
- <script>
- //allow the die to roll only once
- var rolled=false;
- //get the game id from the php to the javascript
- var id0 = <?php echo $_GET['gid']; ?>;
- function roll(){
- if(!rolled){
- 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;
- document.getElementById("die").innerHTML=resp;
- senddata(resp);
- }
- }
- xmlhttp.open("GET","die.php" ,true);
- xmlhttp.send();
- rolled=true;
- }
- }
- function senddata(dieval){
- dieval = dieval.substring(1,10);
- var req = "noti.php?id=" + id0 + "&id1=723872387" + "&prop1=" + dieval;
- 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;
- //alert(resp);
- }
- }
- xmlhttp.open("GET",req ,true);
- xmlhttp.send();
- }
- function End(){
- //alert('ending');
- if(rolled){
- alert('end');
- }else
- {
- alert('You must roll before ending your turn');
- }
- }
- </script>
- <table border='1' width="100%" height="100%">
- <tr><td id="die" width="300px" onclick="roll();">Roll dice</td><td rowspan="6">
- <?php
- // Create connection to database
- include 'scripts/sql.php';
- //get users win/total
- $result = mysqli_query($con,"SELECT * FROM X" . $_GET['gid']);
- echo "<table><tr>";
- while($row = mysqli_fetch_array($result))
- {
- echo "<td>";
- echo "<img width='200px' src='https://graph.facebook.com/" . $row['id'] . "/picture' />";
- //get user's name
- $result1 = mysqli_query($con,"SELECT * FROM 'Persons' WHERE 'PID' = '" . $row['id'] . "'");
- while($row1 = mysqli_fetch_array($result1))
- {
- echo $row1['Firstname'] . " " . $row1['Lastname'];
- }
- echo $row['money'];
- echo "</td>";
- }
- echo "</tr></table>";
- ?>
- </td></tr>
- <tr><td onclick="traid();">Traid</td></tr>
- <tr><td onclick="build();">build</td></tr>
- <tr><td onclick="End();">End turn</td></tr>
- <tr><td></td></tr><tr><td></td></tr>
- </table>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment