Jump to content

DaniIvanov

Members
  • Posts

    12
  • Joined

  • Last visited

DaniIvanov's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. Thanks now it works very well
  2. Yes they both contain the data that I expect them to. Just checked them with var_dump.
  3. I just tried that (also before) and it did not work. It gives FFALSE always even if the value that i pass in to a exists in the log file.
  4. Here is how I am calling the function // Check if participantID already exists and return TRUE or FALSE $some = participantIdFilter(3374); echo $some; When i know that it works I will change 3374 with a variable that generates a rand number. I use 3374 right now because i know for certain that it already exists in the LOG file) Here is the FULL function. I cut out a small piece on the end (of the top post) because i did not think that it was relevant for now function participantIdFilter ($participantID) { $a = $participantID; $log = "uploads/log.txt"; $logRead = fopen($log, "r"); $content = file_get_contents($log); if(strpos($content, $a)){ $search = "TTRUE"; } else { $search = "FFALSE"; } return $search . "/<br />" . $content; if($search == 1) { $participantID = rand(1000, 9999); } }
  5. Hello I have an issue with strpos. I have the following code function participantIdFilter ($participantID) $log = "uploads/log.txt"; $logRead = fopen($log, "r"); $content = file_get_contents($log); if(strpos($content, $participantID)){ $search = "TTRUE"; } else { $search = "FFALSE"; } } The strpos ALWAYS returns false no matter what I do. I know for sure that both $content and $participantID have strings in them. When I change the $participantID within the strpos perimeters with "integers/numbers/ids" it works as expected but as soon as i put in the variable it always result in false. What I am trying to do is open a file and check if participantID is in the file and if it is generate a new one.
  6. I have a couple questions about those MMORPG like khanwars.com. 1. What programming languages do you need to create a web browser game like khanwars? Is PHP, MySQL and Javascript sufficient? Yes, of course it depends on what you want to achieve but take the khanwars.com example. What programming languages do you think they use? 2. How do you go about creating a clickable game map like this one http://www.browsergameslist.com/imgs/ikariam.jpg . or even like http://i.ytimg.com/v...QoDO6NbV0/0.jpg 3. With WebGL can you create a map and overlay building and other icons on top of it using javascript or other languages. 4. Is there a book which explains all about creating browser based mmorpgs; generating the terrain, game dynamics, resource gathering, resource production, military actions. Thanks in advance to anyone who will answer my silly question. I would also like to mention that i am willing to learn anything that is necessary and am willing to invest lots of time in understanding new concepts.
  7. A quick question on the modulus operator. If you look at the code everything from 3 % 3 is very clear 3/3 = 1r0 , 4/3 = r1, 5/3 =r2. What i cannot get and i ve searched google for the answer is why 1%3 is equal to 1 when 3 fits 0 times in 1, and why is 2 % 3 equal to 2 when 2 fits 0 times in 3 as well? echo 0 % 3 . "<br />"; // result 0 echo 1 % 3 . "<br />"; // result 1 echo 2 % 3 . "<br />"; // result 2 echo 3 % 3 . "<br />"; echo 4 % 3 . "<br />"; echo 5 % 3 . "<br />"; echo 6 % 3 . "<br />"; echo 7 % 3 . "<br />"; echo 8 % 3 . "<br />"; echo 9 % 3 . "<br />"; echo 10 % 3 . "<br />";
  8. Thanks for all the replies.I will try the CronJob thing and see how far i can come. I dont know Javascript nor Ajax, perhaps i should learn one of those. They seem important
  9. Hello Christian, I want to create an online game in which you have different resources which accumulate over time. Lets say i have gold, wood and food, and you gather X amount per minute. For example, you have a woodcutter building which produces 10 wood each minute How do you suggest that I shall code this?
  10. Hi TOA, Thanks for the reply I dont want it to wait for 60 seconds and then load the page. I want it to load the page first and then auto-increment the variable every 60 second.
  11. Hi requinix, Maybe i dont understand what you mean with 'it depends on what this variable is and how you use it'. I am going to try and explain it better. I want to have a variable which will contain either an integer or a float. Every 60 seconds PHP should update this variable and add an amount which i will specify in another variable to the first variable, sum both up, and save the result in the first variable. The way I will use the variable is just by echo`ing it on the screen.
  12. Hello PHP Freaks, This is my first post on this forum. I have been learniing PHP for about two weeks now and I would like to know how to do the following. I want to have a variable which every minute updates itself and adds some amount to the old one. For example $a = 1; $b = 1.66; // after 1 minute add $b to $a Is this even possible with PHP or do I need Javascript or AJAX for it Thanks in advance to anyone who replies.
×
×
  • 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.