Jump to content
MakeWebGames

Damond

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by Damond

  1. After a bit of reading I have found that a better way to redirect a user with a bad answer or a blank answer is to us a META refresh directed at the right page. So replacing: header("Location: macro1.php?refer={$_POST['refer']}");   With: echo '<META http-equiv="refresh" content="5;URL= /macro1.php?refer=' . $_POST['refer'] . '"">';   Solves the problem of "cannot add header information, headers already sent" Giving it a 5 second delay allows the user time to read their mistake before being redirected.
  2. [MENTION=71587]~Rob0t[/MENTION] Thanks for the info. I will have to do a lot more reading to figure out how to correct my mistakes that you have pointed out.
  3. [MENTION=68711]KyleMassacre[/MENTION] Thanks for the response but it looks like once again we have posted at the exact same time. LOL I did finally figure out the proper way of using the system and have it implemented on my site. I updated my OP with the instructions.
  4. Simple question. Has anyone changed to using reCaptcha to limit auto refreshers and if so what is the process? Every thing I am reading is telling me it has to be on a form submit, but I'm looking more for it to pop up after checking if you have done it in the last hour on certain pages. I have a small captcha system now but it is very dated and I have a few users who are blind. Their screen readers are not able to read our current captcha system. Now I have three or four telling me that after entering the code correctly, the very next time the code comes up the display is blank. They are having to clear their cache and reopen the game to get the code to display. All of these problems are pointing me at replacing the captcha system. UPDATE: As I am a novice coder, less then 1yr experience, it is not very often that I get a chance to answer a question posted here. I find myself reading and learning from the other coders more then offering advice. That changes a little today with me answering my own post. I am going to explain in detail how to implement googles new reCaptcha v2.0 in McCodes v2. It has taken me several day to do it but at last it works and I am ready at last to share what I have learned with a community that has taught me so much. So here we go. Step 1: Signing up. First thing you need to do is signup for the FREE service by going to the site http://recaptcha.net Here you will need to assign a name to the captcha you are going to use for your own later use. Basically if you are going to use several different captchas on the same site you can name them to make them easier to find later if you need to make updates. Next enter your domain. And then a contact email for notification of anyone tampering with your system. Register the info and it will take you to a new page where it is going to show you a public key and a privet key. These two things are the most important of the whole system. Under the keys it will show you client side coding well as server side coding. This is where I started having problems. Apparently on the server side coding they already expect you to have a certain level of coding knowledge that as a novice I just didn't have. There are no examples of the coding to work off of nor are there really clear instructions. Don't worry thought after hours of searching and trying different bits of code I finally got all this to work. Step 2: Adding in the coding. This is actually much simpler then it seems. You are going to need to update three PHP pages. header.php, macro1.php, and macro2.php We will start with the header.php A very simple addition: This little bit of code calls for googles recaptcha api javascript. Make sure that you place it BEFORE the closing head tag in the header. </head> <script src="https://www.google.com/recaptcha/api.js" async defer></script>   Next macro1.php When I first started this page was 50 - 60 lines long. It was generating images and number letter combinations... Now reCaptcha take care of all of that for you. You will see the generate widget comment. The line of code right under it is what displays the reCaptcha widget on your site. Replace == YOUR PUBLIC KEY == with the public key generated on the register site. That is now the whole page. <?php include "globals.php"; // make sure user is supposed to be here if(!$set['validate_on'] || $ir['verified']) { showErrMsg("What are you doing on this page?"); } // the page that sent you here $ref=$_GET['refer']; print "<h3>Captcha</h3><hr /> <div class=minion_hunt> This is a necessary evil to prevent cheating. It resets every hour. <br><br> <sub>**Five failures in a row will result in 1 day on the banished isle**</sub></div><br> // form <form action='macro2.php' method='post'> // carry over the starting page <input type='hidden' name='refer' value='{$_GET['refer']}' /> // generate the widget for the captcha <div class='g-recaptcha' data-theme='dark' data-sitekey='== YOUR PUBLIC KEY =='></div> //must have a submit button <input type='submit' value='Verify' /></form>"; $h->endpage(); ?>   Finally the big one macro2.php This page is going to verify the data from the captcha. Here is where the google explanation gets a little fuzzy... They tell you to use a json obj to verify the response from the captcha.. ok... what is a json obj? I still have no idea.. But after hours and hours of searching I found the right way to write the code. // make sure user is supposed to be here if(!$set['validate_on'] || $ir['verified']) { die("What are you doing on this page?"); } if(isset($_POST['g-recaptcha-response'])) $captcha=$_POST['g-recaptcha-response']; // If the captcha is blank send them back if(!$captcha){ echo '<h2>Please check the the captcha form.</h2>'; header("Location: macro1.php?refer={$_POST['refer']}"); exit; } // Check the response from google REPLACE: YOUR PRIVET CODE with the privet code from registration. $response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=YOUR PRIVET CODE&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']), true); // If they fail send them back to try again update failed = +1 if($response['success'] == false) { echo '<h2>You failed the captcha!</h2>'; $db->query("UPDATE users SET failed=failed+1 WHERE userid={$userid}"); header("Location: macro1.php?refer={$_POST['refer']}"); exit; } else { $ref=$_POST['refer']; $db->query("UPDATE users SET verified=1 WHERE userid={$userid}"); header("Location: $ref"); } ?>   And thats all there is to it. Google does all the rest of the work. There is no need to upload a captcha DB or js file anymore. I really hope that this helps someone else out there to use this new reCaptcha system.
  5. OK guys I'm still working on my minions system but now I am trying to get them to fight each other. I have the basic coding for it done but I'm having a little trouble with the win/lose system. I'm trying to use a WHILE statement with two conditions.   while (($lose >= 0) || ($lose2 >= 0)){ // Attack $myrand = rand(1,3); if ($myrand ==1){ $type = "Human"; $q = $db->fetch_row($db->query("SELECT base FROM minions WHERE id=1")); $base = $q['base']; $suc = rand(1,10); $tot = $suc + $base; } else if ($myrand==2){ $type = "Elf"; $q = $db->fetch_row($db->query("SELECT base FROM minions WHERE id=2")); $base = $q['base']; $suc = rand(1,10); $tot = $suc + $base; } else { $type = "Dwarf"; $q = $db->fetch_row($db->query("SELECT base FROM minions WHERE id=3")); $base = $q['base']; $suc = rand(1,10); $tot = $suc + $base; } //Defend $myrand2 = rand(1,3); if ($myrand2 ==1){ $type2 = "Human"; $q2 = $db->fetch_row($db->query("SELECT base FROM minions WHERE id=1")); $base2 = $q2['base']; $suc2 = rand(1,10); $tot2 = $suc2 + $base2; } else if ($myrand==2){ $type2 = "Elf"; $q2 = $db->fetch_row($db->query("SELECT base FROM minions WHERE id=2")); $base2 = $q2['base']; $suc2 = rand(1,10); $tot2 = $suc2 + $base2; } else { $type2 = "Dwarf"; $q2 = $db->fetch_row($db->query("SELECT base FROM minions WHERE id=3")); $base2 = $q2['base']; $suc2 = rand(1,10); $tot2 = $suc2 + $base2; } if ($tot > $tot2){ $lose = $lose; $lose2 = $lose2 - 1; $result = "Player two loses 1 of ".number_format($perc).""; } else if ( $tot == $tot2) { $lose = $lose; $lose2 = $lose2; $result = "It was a tie"; } else { $lose = $lose-1; $lose2 = $lose2; $result = "Player one loses 1 of ".number_format($perc).""; } print" $result<br>"; }   I have been searching and reading on trying to do this in this fashion but I can't find anything pointing me in the right direction. Now this code DOES actually work. It just doesn't stop when one or the other hits 0. Player two loses 1 of 10 Player two loses 1 of 10 Player two loses 1 of 10 Player one loses 1 of 10 Player one loses 1 of 10 Player one loses 1 of 10 Player one loses 1 of 10 Player two loses 1 of 10 Player two loses 1 of 10 Player two loses 1 of 10 It was a tie Player two loses 1 of 10 Player one loses 1 of 10 Player two loses 1 of 10 Player two loses 1 of 10 Player two loses 1 of 10 Player two loses 1 of 10 Player one loses 1 of 10 Player one loses 1 of 10 Player two loses 1 of 10 Player one loses 1 of 10 Player two loses 1 of 10 Player two loses 1 of 10 It was a tie Player one loses 1 of 10 Player one loses 1 of 10 Player one loses 1 of 10   Random: 3 Type: Dwarf Base: 6 Multi: 1 Total: 7 Win/lose: -1 <----- Here Random: 2 Type: Dwarf Base: 6 Multi: 5 Total: 11 Win/lose: -4 <----- And here
  6. I have been working on a new mod for my game, the first I have ever coded completely on my own, and it seems I have left a huge opening for abuse. Lucky for me I have only opened up a small part of the system to a few selected beta testers and they have been checking different ways to try and get around my security and pointed out any flaws. This one how ever I'm not exactly sure how to fix, so I turn to the MWG community once again for a solution. Here is a small snippet of the coding in question.   <?php // clicking this link adds +1 to north and sets capture row to 1 // Runs a random to determine if anything is found and how many. Can not exceed 50 if ($minions['north_south']>=50){ echo'<center><img src="images/north.png"></center>'; } else { echo '<center><a href="minion_hunt2.php?step=north"><img src="images/north.png"></a></center>'; } // If something is found this is printed $result = "You moved north and found: $amt2 $type!"; $convert = "<a href='minion_hunt2.php?step=capture&amt=$amt2&type=$type' class='button'>Capture Them?</a>"; // clicking the above link runs another random to determine success or failure in the capturing of minions. // sets capture to 0 so page can not be refreshed. ?>   So the problem is all a user needs to do is click a direction and it sets capture to 1. Even if I changed it to set only if they actually find something my existing problem would still be there. If the users clicks a direction then changes the URL to say: ?step=capture&amt=10000&type=dwarves They can decide how many they found and of what type and nothing in my coding is stopping them. How can I stop this? I can't release this system with that hole there would be too many people spreading this URL cheat around.
  7. Ok so I talked with [MENTION=65518]Kyle[/MENTION] yesterday for a bit and we tried to do a little debugging. The coding has changed a little. In the header: I don't know why there are two different ones I think it has something to do with the AJAX chat we are using as well as something else. <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>   move.php : <?php include_once('globals_nonauth.php'); $userid = $_POST['userid']; $minions=$db->fetch_row($db->query("SELECT * FROM user_minions WHERE userid=$userid")); $_POST['direction'] = array_key_exists('direction', $_GET) && in_array($_GET['direction'], ['north', 'east', 'south', 'west']) ? $_GET['direction'] : null; switch($_POST['direction']) { case 'north': // do north stuff if ($minions['north_south']>=50){ $db->query("UPDATE user_minions SET north_south=50 WHERE userid=$userid"); print"You can't move any farther north!"; echo '<META http-equiv="refresh" content="5;URL= /minion_hunt.php"">'; } if ($minions['north_south']>=0 && $minions['north_south']<=49){ $db->query("UPDATE user_minions SET north_south=north_south+1 WHERE userid=$userid"); echo "You have just moved". $_POST['direction']; } break; case 'east': // do east stuff if ($minions['east_west']>=50){ $db->query("UPDATE user_minions SET east_west=50 WHERE userid=$userid"); print"You can't move any farther east!"; echo '<META http-equiv="refresh" content="5;URL= /minion_hunt.php"">'; } else { $db->query("UPDATE user_minions SET east_west=east_west+1 WHERE userid=$userid"); echo "You have just moved". $_POST['direction']; } break; case 'south': // do east stuff if ($minions['north_south']<=0){ $db->query("UPDATE user_minions SET north_south=0 WHERE userid=$userid"); print"You can't move any farther south!"; echo '<META http-equiv="refresh" content="5;URL= /minion_hunt.php"">'; } else { $db->query("UPDATE user_minions SET north_south=north_south-1 WHERE userid=$userid"); echo "You have just moved". $_POST['direction']; } break; case 'west': // do east stuff if ($minions['east_west']<=0){ $db->query("UPDATE user_minions SET east_west=0 WHERE userid=$userid"); print"You can't move any farther west!"; echo '<META http-equiv="refresh" content="5;URL= /minion_hunt.php"">'; } else { $db->query("UPDATE user_minions SET east_west=east_west-1 WHERE userid=$userid"); echo "You have just moved". $_POST['direction']; } break; } ?>   minion_hunt.php: <?php include "globals.php"; if(($ir['jail'] || $ir['hospital']) && $ir['user_level'] !=2) { showErrMsg("This page cannot be accessed while on Moa Isle or Regeneration."); } $minions=$db->fetch_row($db->query("SELECT * FROM user_minions WHERE userid=$userid")); if ($minions['location']!=$ir['location'] && $minions['north_south']!=0 && $minions['east_west']!=0){ $loc=$db->fetch_row($db->query("SELECT cityname FROM cities WHERE cityid={$minions['location']}")); showErrMsg("You are searching the forest in ".$loc['cityname'].". You must move to 0,0 there first."); } if ($minions['location']==0){ $db->query("UPDATE user_minions SET location={$ir['location']} WHERE userid=$userid"); } else if ($minions['location']!=$ir['location'] && $minions['north_south']==0 && $minions['east_west']==0){ $db->query("UPDATE user_minions SET location={$ir['location']} WHERE userid=$userid"); } print" <div class='box-style5'> <div class='title7c'> <h2>Minion Hunting</h2> </div> </div> <div class='box-style5'> <div class='title7e'> <h2>Location: ".$minions['north_south'].",".$minions['east_west']."<br> Endurance: ".$minions['endurance']."</h2> </div> </div>"; //notification echo '<div id="notificationArea"></div>'; print" <table width=75%> <tr> <td colspan=3>"; if ($minions['north_south']==50){ print"<center><img src='images/north.png'></center>"; } else { echo '<center><a href="#" class="directional" id="north"><img src="images/north.png"></a></center>'; } print" </td> </tr> <tr> <td>"; if ($minions['east_west']<=0){ print"<img src='images/west.png'>"; } else { echo '<a href="#" class="directional" id="west"><img src="images/west.png"></a>'; } print" </td> <td><img src='images/forest.png'></td> <td> "; if ($minions['east_west']==50){ print"<img src='images/east.png'>"; } else { echo '<a href="#" class="directional" id="east"><img src="images/east.png"></a>'; } print" </td> </tr> <tr> <td colspan=3>"; if ($minions['north_south']<=0){ print"<center><img src='images/south.png'></center>"; } else { echo '<center><a href="#" class="directional" id="south"><img src="images/south.png"></a></center>'; } print" </td> </tr> </table> <div id=isla-quest> Here you can search the forest of Aniari looking for minions to recruit. <br><br>You will find a variety of creatures such as Humans, Elves, and Dwarves. You can try and recruit any group of them you come across, but remember that they don't always agree. <br><br> You have a limited endurance for these hunts. When it is gone you will have to wait for it to refill before you can start looking again.<br><br> Also if your wish to search the forest of another city you must first move back to location 0,0 in the forest that you are currently searching. </div> "; ?> <script> (function() { $('.directional').on('click',function(e){ var direction = $(this).attr('id'); $.ajax({ method: "POST", url: "move.php", data: { userid: <?php echo $userid; ?>, direction: direction } }).done(function( msg ) { $( "#notificationArea" ).html( msg ); console.log(msg); }).fail(function(req,msg) { $( "#notificationArea" ).html('Request failed: ' + msg ); }); e.preventDefault(); }); }); </script>   Using the error console there are no errors, and no warnings, yet we can't seem to get any response from the AJAX. There is no text posted. There is no update to the data base.
  8. [MENTION=50378]Guest[/MENTION] I have been trying to get up with you for a couple of days now. Seems our schedules are just not lining up. Anyone else out there care to give me a hand with this? I'm completely stuck on this project until I can get this working.
  9. [MENTION=68711]KyleMassacre[/MENTION] I did mention that AJAX was way over my head didn't I? :p So normally I have a coding partner that can help me figure this stuff out but as he has no net for the next few weeks I am on my own. I get that I needed to create a new page called move.php and put my case stuff in there. Where I am getting stuck is the AJAX script. Here is my full page code.   <?php include "globals.php"; if(($ir['jail'] || $ir['hospital']) && $ir['user_level'] !=2) { showErrMsg("This page cannot be accessed while on Moa Isle or Regeneration."); } $minions=$db->fetch_row($db->query("SELECT * FROM user_minions WHERE userid=$userid")); if ($minions['location']!=$ir['location'] && $minions['north_south']!=0 && $minions['east_west']!=0){ $loc=$db->fetch_row($db->query("SELECT cityname FROM cities WHERE cityid={$minions['location']}")); showErrMsg("You are searching the forest in ".$loc['cityname'].". You must move to 0,0 there first."); } if ($minions['location']==0){ $db->query("UPDATE user_minions SET location={$ir['location']} WHERE userid=$userid"); } else if ($minions['location']!=$ir['location'] && $minions['north_south']==0 && $minions['east_west']==0){ $db->query("UPDATE user_minions SET location={$ir['location']} WHERE userid=$userid"); } print" <div class='box-style5'> <div class='title7c'> <h2>Minion Hunting</h2> </div> </div> <div class='box-style5'> <div class='title7e'> <h2>Location: ".$minions['north_south'].",".$minions['east_west']."<br> Endurance: ".$minions['endurance']."</h2> </div> </div> <div id='notificationArea'></div> <table width=75%> <tr> <td colspan=3>"; if ($minions['north_south']==50){ print"<center><img src='images/north.png'></center>"; } else { print"<center><a href='#' class='directional' id='north'><img src='images/north.png'></a></center></a> <script> $('.directional').on('click',function(e){ var direction = $(this).attr('id'); $.ajax({ method: 'POST', url: 'move.php', data: { userid: $userid, direction: direction } }).done(function( msg ) { $( 'notificationArea' ).html( it works ); }).fail(function(req,msg) { $( 'notificationArea' ).html('Request failed: ' + msg ); }); e.preventDefault(); }); </script>"; } print" </td> </tr> <tr> <td>"; if ($minions['east_west']<=0){ print"<img src='images/west.png'>"; } else { print"<a href='#' class='directional' id='west'><img src='images/west.png'>"; } print" </td> <td><img src='images/forest.png'></td> <td> "; if ($minions['east_west']==50){ print"<img src='images/east.png'>"; } else { print"<a href='#' class='directional' id='east'><img src='images/east.png'></a>"; } print" </td> </tr> <tr> <td colspan=3>"; if ($minions['north_south']<=0){ print"<center><img src='images/south.png'></center>"; } else { print" <center><a href='#' class='directional' id='south'><img src='images/south.png'></a></center></a>"; } print" </td> </tr> </table> <div id=isla-quest> Here you can search the forest of Aniari looking for minions to recruit. <br><br>You will find a variety of creatures such as Humans, Elves, and Dwarves. You can try and recruit any group of them you come across, but remember that they don't always agree. <br><br> You have a limited endurance for these hunts. When it is gone you will have to wait for it to refill before you can start looking again.<br><br> Also if your wish to search the forest of another city you must first move back to location 0,0 in the forest that you are currently searching. </div> "; ?>   The finished page should work something like this: [ATTACH=CONFIG]2185[/ATTACH] The top box: Location: The first number should change +1 for north -1 for south. Second number should change +1 for east -1 for west. Both need to stop at 0 and at 50. My original code was a count behind so it kept going over and under. Endurance: Should drop by 1 each move. (Not as worried about this as I am getting the location to work.) Under that box will be another information box that pops up when you actually find something. "You found a group of 22 Humans." Something like that. The very last thing, something else I'm not as worried about until I can get the location to work, is we want to make it to where you can't refresh the page. I don't want someone sitting in one spot and refreshing to make the random run over and over until they find something. They should be forced to change locations. I know its a lot and I'm not asking for someone to recode my page. I just need some education in using the ajax correctly.
  10. So I used the anchor method and figured out how to work it with a switch:   print"<center><a href='?direction=north'><img src='images/north.png'></center></a>";   My switch: $_GET['direction'] = array_key_exists('direction', $_GET) && in_array($_GET['direction'], ['north', 'east', 'south', 'west']) ? $_GET['direction'] : null; switch($_GET['direction']) { case 'north': $db->query("UPDATE user_minions SET north_south=north_south+1 WHERE userid=$userid"); if ($minions['north_south']>50){ $db->query("UPDATE north_south=50 WHERE userid=$userid"); } break; case 'east': $db->query("UPDATE user_minions SET east_west=east_west+1 WHERE userid=$userid"); if ($minions['east_west']>50){ $db->query("UPDATE east_west=50 WHERE userid=$userid"); } break; case 'south': $db->query("UPDATE user_minions SET north_south=north_south-1 WHERE userid=$userid"); if ($minions['north_south']<0){ $db->query("UPDATE north_south=0 WHERE userid=$userid"); } break; case 'west': $db->query("UPDATE user_minions SET east_west=east_west-1 WHERE userid=$userid"); if ($minions['east_west']<0){ $db->query("UPDATE east_west=0 WHERE userid=$userid"); } break; }   I'm running into the issue that the location is not updating correctly. It is always one behind which forced me to add another if statement. I did like the way [MENTION=68711]KyleMassacre[/MENTION] showed me with the ajax but I would have no idea how to add other actions such as update db or random events like the chance of finding an item.
  11. But won't a switch make it change pages?
  12. [MENTION=68711]KyleMassacre[/MENTION] Thanks for the advice. While I agree ajax would be cool that is even farther away from any coding I know how to do... So lets go with your anchor: <a href="?direction=up" id="upArrow"><img src="yourImagePathHere.ext"/></a>   If I use this method would I just move on to something like:   if (direction=up]{ $db->query("UPDATE DB HERE"); }
  13. Hello again everyone. Here I go jumping into something that is way over my head in the terms of coding skill, but what better way to learn to swim then by jumping into the deep end? So here is the idea. I have a screen that has a little map and four direction arrows. I'm trying to figure out how to code things so that when you click on one of the arrows it updates your location with out changing pages. I know the page will refresh. My limited coding skills are telling me to use a form or a switch but I know both of these are wrong. There must be a simpler way of doing this that I just don't see. Here is a shot of the screen I am working with. Each of the arrows is already a link that goes no where. [ATTACH=CONFIG]2183[/ATTACH]
  14. Normally I am much more carful when writing my CSS, but I am just back from a very long summer season of work and was in a rush to get a new system out. I use Coda which I just found out could have verified my CSS and shown me the error right away. This is what I get for being in a hurry. :p
  15. Did you get any kind of error code? [MENTION=64684]Dayo[/MENTION] [MENTION=71663]IllegalPigeon[/MENTION] Thank you so much! I have been beating my head against that for days now and it was simply a bracket missed in a copy and paste. I feel like an idiot now.
  16. [MENTION=71663]IllegalPigeon[/MENTION] the site is http://flightofdragons.net [MENTION=68711]KyleMassacre[/MENTION] $ir is a global called to in the header, and the links to all the CSS pages are in the top of the header, so yes we are calling to it. As I said in my first post this system HAS been working up until just the other day. If you echo our $ir['temp'] you get a number 1,2,or 3. function temp_change() { global $ir, $c, $userid, $h; print" <div class='box-style5'> <div class='title7c'> <h2>Template</h2> </div> </div> <form action='preferences.php?action=tempchange2' method='post'> <table width=90%> <tr> <td><img src=images/red.png width=180></td><td><img src=images/blue.png width=180></td><td><img src=images/green.png width=180></td> </tr> <tr> <td><center><input type='submit' name='1' value='Red' id=submit></center></td> <td><center><input type='submit' name='2' value='Blue' id=submit></center></td> <td><center><input type='submit' name='3' value='Green' id=submit></center></td> </tr> </table></form><br> <a href='preferences.php' class='button2'>Back</a> "; } function do_temp_change() { global $ir, $c, $userid, $h, $db; print"<div id=text3>"; if ($_POST['1']) { $db->query("UPDATE users SET temp=1 WHERE userid={$userid}"); print"Your template has been changed to Red, you will see this on your next click."; } if ($_POST['2']) { $db->query("UPDATE users SET temp=2 WHERE userid={$userid}"); print"Your template has been changed to Blue, you will see this on your next click."; } if ($_POST['3']) { $db->query("UPDATE users SET temp=3 WHERE userid={$userid}"); print"Your template has been changed to Green, you will see this on your next click."; } print"</div>"; }
  17. [MENTION=68711]KyleMassacre[/MENTION] I have tried your suggestion and my results are exactly the same. When using the blue or green templates that div is seen but not displayed properly. Copying the code to the red template it is displayed correctly with the blue colors.
  18. I will give it a shot and see what happens.
  19. All my DIV's are exactly the same. The only difference is in each CSS page each is color code used. Here is an example: print "<div id=isla-quest><table width=95%> <tr> <td><b>Strength:</b> {$ir['strength']} [Ranked: {$ir['strank']}]</td> <td><b>Agility:</b> {$ir['agility']} [Ranked: {$ir['agirank']}]</td> </tr> <tr> <td><b>Defense:</b> {$ir['defense']} [Ranked: {$ir['guarank']}]</td> <td><b>Speed:</b> {$ir['speed']} [Ranked: {$ir['spdrank']}]</td> </tr> <tr> <td><b>Labour:</b> {$ir['labour']} [Ranked: {$ir['labrank']}]</td> <td><b>IQ: </b> {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td> </tr> <tr> <td colspan='2' align=center><b>Total stats:</b> "; $print = $db->query("SELECT * FROM statsbonus WHERE userid = {$userid}"); if ($db->num_rows($print) > 0) { print"{$t} [Ranked: $trank]"; } else { print"{$ts} [Ranked: $tsrank]"; } print"</td> </tr> </table> </div>";   This is right out of my index page. This code never changes. Only the colors based on each CSS page.
  20. Hello everyone. Its not often that you will find me posting here looking for help but I have a problem with my CSS that I just can't put my finger on. Hopefully someone here can help. So my site offers three color themes, because lets face it my preferred colors may not be the preferred colors of all my player. Moving on.... To change between the colors we added a row to the users table and a function in the preferences that allows you to change between any of the three with just a click. Make make the change work we added a bit of code to the top of the header.   <?php if ($ir['temp']==3) { print "<link href='CSS/loggedin3.css' rel='stylesheet' type='text/css' media='all'>"; } elseif ($ir['temp']==2) { print "<link href='CSS/loggedin2.css' rel='stylesheet' type='text/css' media='all'>"; } else { print "<link href='CSS/loggedin.css' rel='stylesheet' type='text/css' media='all'>"; } ?>   Pretty simple. Each CSS page is exactly like the other with the exception of calling to a different images folder and color codes. Here is where things get interesting. This is what each index page of the site is supposed to look like.: [ATTACH=CONFIG]2180[/ATTACH] Now when switching to the blueish color template: [ATTACH=CONFIG]2181[/ATTACH] And just to prove that the CSS is correct, here is the code copied and pasted into the red color template: [ATTACH=CONFIG]2182[/ATTACH] For five plus months this system has worked perfectly. Now all of the sudden its not. When I use inspect element it shows me the div is there, and the proper CSS but for some reason it is not displaying on either or the secondary color templates. Anyone with an idea of what I could have done to cause this? I have been updating the site but there is nothing I have done that should have anyway changed the CSS or the way it is displayed. Just incase it is needed here is the CSS for that box:   #isla-quest { -webkit-border-top-left-radius: 15px; -webkit-border-top-right-radius: 15px; -webkit-border-bottom-left-radius: 15px; -webkit-border-bottom-right-radius: 15px; -moz-border-radius-topleft: 15px; -moz-border-radius-topright: 15px; -moz-border-radius-bottomleft: 15px; -moz-border-radius-bottomright: 15px; border-top-left-radius: 15px; border-top-right-radius: 15px; border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; background: rgba(78,0,0,1); -moz-box-shadow: 0px 0px 10px #888; -webkit-box-shadow: 0px 0px 10px #888; box-shadow: 0px 0px 10px #888; border: 1px solid #4F4F4F; padding: 5px; z-index: 1000; text-shadow: 2px 1px 0px rgba(0,0,0,.5); text-transform: uppercase; font-family: 'Droid Serif', serif; font-size: 12px; color: #FFFFFF; }
  21. [MENTION=65371]sniko[/MENTION] Perfect. Thank you very much it works like a charm.
  22. My game has been up and running live for almost two months now, 850+ accounts and counting. So like a good admin I have been listening to my players suggestions and implementing the good ones as quickly as I can. I've come to one that is giving me a bit of problem so I turn back to the MWG community to point me in the right direction. In the item market file there is already coding to remove items that you have placed on the market. What if you have several items and want to remove them all at once? Its a real pain looking through a massive listing for each of your items and pulling them one at a time. Enter the Remove All button. I have some coding in place but I keep getting only one item removed.. Granted I don't have to look for my items it just removes them one after another as I keep clicking the button, but its still not doing what it should. First the switch case: case "removeall": remove_all(); break;   Then the code to show you the button or not $q2 = $db->query("SELECT * FROM itemmarket WHERE imADDER=$userid"); if ($db->num_rows($q2)>=1){ $r = $db->fetch_row($q2); print"<br><a href='itemmarket.php?action=removeall&ID={$r['imID']}' class='button'>Remove All</a><br>"; }   Then my Remove all function: function remove_all() { global $db, $ir, $c, $userid, $h; $q = $db->query("SELECT im.*,i.* FROM itemmarket im LEFT JOIN items i ON im.imITEM=i.itmid WHERE imID={$_GET['ID']} AND imADDER=$userid"); if (!$db->num_rows($q)) { print "<div id=text3>Error, either this item does not exist, or you are not the owner.<br /> <a href='itemmarket.php'><strong>Back</strong></a>"; $h->endpage(); exit; } while ($ra = $db->num_rows($q)>0){ $r = $db->fetch_row($q); item_add($userid, $r['imITEM'], $r['imQTY']); $i = ($db->insert_id()) ? $db->insert_id() : 99999; $db->query("DELETE FROM itemmarket WHERE imID={$_GET['ID']}"); $db->query("INSERT INTO imremovelogs VALUES (NULL, {$r['imITEM']}, {$r['imADDER']}, $userid, {$r['imID']}, $i, unix_timestamp(), '{$ir['username']} removed a ".$db->escape($r['itmname'])." from the item market.')"); } print "All item removed from market!<br /> <a href='itemmarket.php'><strong>Back</strong></a></div>"; }   I feel like I am right there but just missing one little vital part that I just can't put my finger on.
  23. Thanks [MENTION=65371]sniko[/MENTION]!! I will be sure to put that to good use as we have already had to upgrade the account.
  24. [MENTION=69670]Script47[/MENTION] Thank you very much. Several month of design and coding just in the layout of that one. I have the feeling that if it looks good then people feel more welcomed.
  25. This is outstanding!! I have been using a live version of [MENTION=65371]sniko[/MENTION] 's real time chat and even upgraded to the first paid package. All my players really seem to like what we have created together. I have done a little CSS work to it of course to take it away from the plain box it started as and blend it more to my game environment. So Flight of Dragons is a Text based MMORPG. Like most other browser based games it is free to play with the option to donate for a few added bonuses. Flight of Dragons offers you the chance to take on the role of a mighty dragon! There a eight dragon types to chose from, four evil, and four good. Each has it own advantages and disadvantages. We have a very unique weapons system, where you are the weapon. As your character levels your natural weapons, Breath weapon, and claw/bite weapon, automatically get stronger. We have a very lively and interactive community that is all the stronger for the addition of this real time chat using the pusher system. Come and check us out, May 15th is out 30 days live celebration, and we have already reached 550+ Accounts! http://flightofdragons.net
×
×
  • Create New...