Jump to content

proxximo

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by proxximo

  1. Thanks a ton. Setting a database variable to sold fixed it. Appreciated!
  2. This solution still allows the issue to persist. I tried in this form as well as creating a function and calling it onClick. Its driving me absolutely nuts! But thank you very much for a quick response _EmilsM!
  3. Hey Guys, I am creating a php text based game and during testing I have found a HUGE exploitable problem. During purchasing or selling items by clicking on a link (which then uses a MySQL query to updated the database), if you click the link multiple times before the next page loads you can sell one item multiple time, thus making quite a bit of in game currency really quickly. I have found a quick patch using javascript but it is not a solution I really want to stick with seeing as it uses an alert box... var clicked = false; function processClick() { if (clicked) return; clicked = true; alert("Your item has been sold"); } Basically I call the above function which stops them from clicking multiple times by popping an alert box. My question is... is there a better way to disable multiple clicks in this way, as I generally only like to use alert boxes for debugging and really slows down he pace of the game. Not to mention it looks terrible. Any help would be great. All of my google searches have left me with no clear alternative. Thanks! Proxximo
  4. Thanks for taking the time to respond Phailip. It is much appreiated!
  5. Hi there, I am the creator of a php, text based game. Recently we have gotten a composer to create some really great music for us, however with the game being set up as it currently is, that is to say click - page change, adding music is a little tricky. The advice I need is a solution for adding music that doesnt interrupt when the page changes. My first thought was to run the game in an iframe and have the music being played at html top level, but I am unsure if this is the best route to take, mostly because I would like to be able to change the music depending on what is happening in game (i.e. combat, visiting town, exploring, etc.) I was hoping to get some input before I move ahead with any solution. Does anyone know of a solution that would take cre of the following. -Does not interrupt the music when the page changes, as the scripts run constantly, changing the page to tell what your character is up to. -Can change the music from the php game -Keeps the interface clean Thanks a ton for your help guys and gals! If any more information is needed, I would be glad to give it. Proxximo
  6. I believe I may have found the problem. It is my testing environment that wont allow me to use this correctly. I think it will sort itself out once I put it on the live server.
  7. I am still having a little snag on the code. I have gotten everything to work pretty well. When the page loads, the div is invisible. When I hover over my element it becomes visible, the only problem is that the div just shows up on the page where it is rather than hovering with my pointer. Any ideas?
  8. Ok I got everything to display the way I want it to and all, the only thing I cant figure out is how to make the div display where my mouse is. Right now it displays where I have the Div set on the page. Any help there xtop?
  9. I forgot to mention that the information will be pulled from a MySQL database using php with the location index.php?do=itempopup:$code Thanks ahead of time
  10. Hello all. I am having a problem with an idea, and Im not quite sure how to make it work. I have spent the last three hours on google looking for a way, but to no avail. Here is the idea: I have a game inventory page with pictures of your equipment. What I want to happen is when you hover over the image it will display a hovering box with all of the items statistics. During my searching I was able to find something similar but it used a popup window. If anyone has the code needed to achieve this or a searchable phrase that would send me to the right place I would really appreciate the help. Thanks Proxx
  11. THanks, Ill try that, I tried Browser restriction and it didnt work, thanks a bunch
  12. I was wondering if there was a way to restrict certain browsers from viewing a webpage. If so does anyone know where to find some snippets of code for doing so, or can anyone help me do so for my page? Thanks ahead of time. Proxximo
  13. I figured it out! Needed to have the global variables added into each function like: <?php function fight() { global $userrow; if ($userrow["currentfight"] == 1){ $monsterdb = ""; $monsterdb = getDatabase(monsterdb); } } function getDatabase(&$monsterdb) { global $userrow; process ....... return monsterdb; } ?> Works great now, thanks to all that helped me along
  14. $userrow is a global variable, should I set it outside the functions like <?php global $userrow fight(){ } monsterDatabase() { } ?>
  15. My problem to this point is I am running a function that is supposed to pull a string value from a separate function, to use later. I also use an index for all of my functions called index.php . The error I am getting is "Table does not exist" From what I can see the monsterDatabase function is not sending any value back or sending a blank value. The script tests fine when the code from monsterDatabase is put right above the doquery function, however I am wanting to write it as its own function, since I have that piece of script (500 lines long) written 4 other times in the same script. I tried searching for a solution via the web but only come up empty handed. Any help would be greatly appreciated. Here is the code in the index.php script elseif ($do[0] == "monsterDatabase") { include('fight.php'); monsterDatabase(&$monsterdb); } The main function that is calling for the value is called fight() function fight() { if ($userrow["currentfight"] == 1) { $newmonsterdb = monsterDatabase(&$monsterdb); $monsterquery = doquery("SELECT * FROM {{table}} ORDER BY RAND() LIMIT 1", $newmonsterdb); //The doquery function is working fine, tests great when I just post the script from monsterDatabase //above it } } The function that is supposed to return the value is obviously monsterDatabase and looks like this (shortened from 500 lines down to just make the point) function monsterdatabase(&$monsterdb){ if ($userrow["currentarea"] == "Outside Proxximos Fortress") { $monsterdb = "monsterproxximos"; } elseif ($userrow["currentarea"] == "Training Grounds") { $monsterdb = "townmonster2"; } elseif ($userrow["currentarea"] == "Outside Oasis of Otium") { $monsterdb = "townmonsteroasis"; } elseif ($userrow["currentarea"] == "Outside Skyfall Peak") { $monsterdb = "townmonsterskyfall"; } elseif ($userrow["currentarea"] == "Outside Aloren") { $monsterdb = "townmonsteraloren"; } return $monsterdb; } If any more information is needed please do not hesitate to respond and I will get it up as quickly as possible. Thanks Proxximo
  16. I have a question regarding functions returning value to other functions in php. Up until now I just make everything happen in one function, but I am finding more and more that I will need to do the same thing 5 times and rather than having the same code five times in my function i figured i would just write a function for that process and pass the value back to the original location. So here is my question, how in the world do you do that in php. In C++ to pass by reference you have something like: int main() { passReference(int & value1, int & value2); return 0; } void passReference(int & value1, int & value2) { .....processes here } Is this done the same way in php? what would the basic outline of a reference function look like. Use my example above and I should be able to figure it out from there. Thanks a ton! Proxximo
  17. I am currently coding a game. I am wanting to cut down server load by hiding a form for a certain amount of time every time the page loads. Explaination: On the game page you click on a compass (my form) to move your character. The php script moves the character and loads the new page. What I want to happen is when the new page loads to hide the compass for a certain amount of time. This is to keep players from clicking the form 5 times really fast and moving that amount of spaces loading the page once. I figured this would be a javascript situation and my javascript is non existant. Can anyone help? If you need more info please let me know and I will post it ASAP! Thanks
  18. I was wondering if there was a way to restrict certain browsers from viewing a webpage. If so does anyone know where to find some snippets of code for doing so, or can anyone help me do so for my page? Thanks ahead of time. Proxximo
  19. I set up a new table devoted to nothing but users potions. I have it print out every query that goes through the doquery() function. And i made sure that the userpotions table isnt used anywhere else no matter what... I ran the script. When it prints out all of the querys it shows that the input should be 1,0,0,0 and it shows that query only being run one time. But when I go to the table it is input as 1,1,0,0. So the next question is can this script run twice and only show one run through the doquery() printout?
  20. I dont do anyhting after that update except show the user they bought a potion ... $sql = "UPDATE {{table}} SET $potions gold='$newgold' WHERE id='$userid' LIMIT 1"; print "About to run $sql<br>"; $updatequery = doquery($sql, "users"); exit(0) $page .= "<center>Thank you for purchasing the ".$itemsrow["name"].".<br /><img src= $apothimage><br /><br />You may return to <a href=\"index.php?do=religiousdistrict\">town</a>, or the <a href=\"index.php?do=apothacary\">apothacary</a>, or use the navigation buttons on the left to start exploring.</center>"; $title = "Potion Purchased"; display($page, $title); } ?> so now Im really stumped..
  21. Where will the code: file_put_contents("script_ran" . posix_getpid(), "Someone ran me!"); print "Someone ran me!" to? Will it print to a document somewhere?
  22. Ok I ran the exit function and it worked great. So that means the script is beiing run twice? How do I find out how, why and where?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.