
Floydian
Members-
Posts
900 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Events
Everything posted by Floydian
-
Re: Adobe CS3 If you live in Zimbabwe or Rawanda, they might not care about copyright laws, but the vast majority of countries do and you can be liable for damages/penalties for breaking copyrights. GIMP is great, it's free, and it's open source. What more could you ask for?
-
Re: [mccode v2] Slots Alrighty, I thought I had secured it, but there's till one more whole. Find: if (isset($_POST['slots']) && is_string($_POST['slots']) && ($_POST['slots'] === "1234")) And edit it to this: if (isset($_POST['slots']) && is_string($_POST['slots']) && ($_POST['slots'] === "1234") and $ir['money'] >= 100) $ir['money'] >= 100 should be set to: $ir['money'] >= AMOUNT_TO_PLAY That will close the remaining whole that allows money to go negative.
-
Re: [mccode v2] Slots I propose one change to the slots. else if ($ir['money'] <= 0) { echo "You don't have any money left! "; echo "Better do some more work! "; } Find that, and then, you need to determine how much it costs per play. The default is 10 bucks. If yours is $100, then 100 is the deal. Now, replace the code above with this: else if ($ir['money'] <= 10) { echo "You don't have enough money left! "; echo "Better do some more work! "; } On the part where $ir['money'] <= AMOUNT AMOUNT is the amount it costs to play on your game. Making this change prevents uses from their cash going negative. If you had 5 bucks, and didn't win, you'd go -5. If you had an unsigned money column, your cash would then skyrocket into the billions, or even quadrilions if you had a bigint column for money.
-
Here is a hard one for you
Floydian replied to AlabamaHit's topic in MySQL, Oracle, Postgress or other DB
Re: Here is a hard one for you I like to run a session counter echo the counter and increment it one if you see it going up by two on each page, you know you have a dual load ;) -
Here is a hard one for you
Floydian replied to AlabamaHit's topic in MySQL, Oracle, Postgress or other DB
Re: Here is a hard one for you It's not a firefox problem. You likely have an img tag with an empty src. Perhaps you didn't have the image ready at the time and put in a [/img] so that you could put in the src later. That will cause the dual load. -
Re: PHP string on string I might be helpful to know what that's called...
-
Re: v1 or v2 v1 isn't free, mccodes lite is free v1 is like 80 bucks I think
-
If you dont have a licence then dont use mccode v2!!!
Floydian replied to wivers's topic in General Discussion
Re: If you dont have a licence then dont use mccode v2!!! It's not worth it because he doesn't support it and provide bug fixes. I wouldn't buy dead software either. -
Re: {REQUEST}Mccode Duping... session lock? only allowing one session per user? if so, that doesn't prevent issues where one person lists an item in a shop, and then gets a friend to buy it at the same time they remove it. lol and that's just one example of crossover between accounts. there is no one fix for it all, but only allowing one session per user is a BIG help.
-
Re: Basic Ajax is easy Yes, ajax is confusing. Anyone that says it wasn't confusing to them at first is either lying or is a genius. Expanding on what BlueDevil said about AJAX being JS, which is right, ajax is built on the HMLHttpRequest object. That is actually part of the part of the DOM (Document Object Modal). JavaScript is granted access to the DOM and thus has access to the XMLHttpRequest object. The main technologies involved in AJAX are typically: JavaScript and XML or JSON JSON is JavaScript, but JavaScript is not JSON. JSON stands for JavaScript Object Notation, and JSON data can be parsed using JavaScript's eval() function. Therefore, if you use JSON instead of XML, your AJAX app is entirely DOM and JavaScript based. That would make it AJA, instead of AJAX ;) lol But we still call it AJAX. Old habits die hard... Anyways, I use asynchronous JavaScript and never did get into the XML part of it. Even the name of the XMLHttpRequest object might be due for a change, removing the XML part of it. Okay, did I bore anyone? :P
-
Re: {REQUEST}Mccode Duping... A price would be dependent on how many areas there are to fix. I could prolly secure a typical bank script in a half hour max. Something like that wouldn't cost much. Doing that to 10 different scripts, that would be a bit more expensive. I will say though that if you are decent with mysql, and once you get the idea down Nyna and I are talking about, it's not too difficult. mysql_affected_rows is going to be an essential part of this though.
-
Re: {REQUEST}Mccode Duping... I have tons of experience fixing these things. There's a number of little tricks that need to be done. Each script that has the problem needs to be edited one by one. So it's not exactly a deal where you can just toss in a few lines of code and the entire game is fixed. Well, that is unless you limited loading pages to one page load per one/two seconds. To stop someone from withdrawing cash from the bank you would do something like this: First, you need to find out how much money they have. Then, when you go to take the money out of the bank, toss in a where clause like this: where money = current_value The idea is, on a dual page load, the cash they have is the same in both instances of the script being executed. And since mysql queries are crafted in a way where it just subtracts the withdrawal from the bank money column, you can toss in that where clause because on the second page load the amount will not match the amount they had at the start of the script. It's tricky, and it's hard to explain, but you just have to trip it up a bit and use the dual page load intricacies to your own advantage. Anyways, if you need someone to help you out, lemme know, but I can't do it for free.
-
Re: text effect I'm not sure what image you are referring to which means you have me at a disadvantage here :P However, I could be technical and say text-decoration is for use as a text effect and thus padding wouldn't be part of it's intended use, but instead, padding would be applied to the container element of the text. border-bottom is interesting because it allows you to have a different underline color from the text color, which text-decoration doesn't give you (not to mention it doesn't give you those fancy grooves either) lol and border bottom can allow the border to extend past the text as well, which can be useful at times.
-
Re: text effect hey hey hey, let's not neglect text-decoration: underline!!! ;)
-
Re: need help wtih this function Snatchy, your expectations and demands seem to dictate that you require paid help. Free help comes and goes. Most of us here are busy too. Sorry we couldn't be as accommodating as think we should be. I do agree there were some pointless posts in this thread. I do know that keeping your cool and being appreciative of the help you have received is the best way to encourage others to step up to the plate with what might be even better help for you. Good luck, and I hope you get the problem solved. ;)
-
Re: need help wtih this function I think this thread might help you fix this problem. http://criminalexistence.com/ceforums/index.php?topic=27036.0
-
I've seen this one asked about so many times, it begs for some splainin... There are a number of php functions that generate errors like this. mysql_fetch_row and mysql_fetch_array being some of the common ones. So what exactly does this mean? Well, these sorts of functions require a MySQL Result Resource to be passed to them. I'm putting MySQL Result Resource in bold and large font twice because I want to really emphasize this. A MySQL Result Resource is what you get when you do a MySQL SELECT query. (Sure there are other ways to get a mysql result resource, but this is going to be the most common) MySQL Result Resource An example of a way to get an MRR (short for MySQL Result Resource for the rest of this thread) might go something like this: $result = mysql_query('select blah from foo'); The mysql_query() function returns one of two things in this case. It returns an MRR It returns a boolean value of FALSE This next section is the most important part of this post! If your query could not be completed, you will get FALSE instead of an MRR. Now, since mysql_fetch_row() and mysql_fetch_array() require an MRR, you can't just plug the $result into these functions! This is because $result might be an MRR or it might be FALSE. So, how do we compensate for this? Glad you asked, because there are two things you want to do. Number one is you want to look for false values. If the $result is false, do an appropriate action, if it isn't false, carry on with what you wanted to do. Then the second thing to do is, if $result is FALSE, find out why it is FALSE. For the first part, all we have to do is this: if ($result === false) { echo "The last query failed!"; } else { echo "The last query was successful"; // put your mysql_fetch_array() or mysql_fetch_row() here! } The second thing to do is: We need to be able to debug our query, so we'll rewrite our query in order to make debugging easier. // First, define your query and store just the query string // in a variable. This allows us to print out the query string as well // as use the query string in a query. $query = "select blah from foo where userid = " . $userid; // Now plug your query string into mysql_query(); $result = mysql_query($query); // Now we need to find out if the query was successful if ($result === false) { // The query was not successful // Display the query string along with a message. echo "The last query failed! The query was: " . $query; } else { // The query was successful, so carry on as normal echo "The last query was successful"; // put your mysql_fetch_array() or mysql_fetch_row() here! } If you've been having problems with the sort of error I'm talking about, please take some time to study this post. If you have questions about it, feel free to post them and I'll do my best to answer them. Please keep your questions to the topic at hand. I am not offering to debug your scripts for you, but am offering to help you understand how to debug them yourself.
-
Sometimes situations arise where we have an array that contains data for multiple users. For each user, there might be an array of data. One such situation that can arise with this pattern is crime stats. There are certainly many more situations that can arise, but I'm going to use a simplified set of crime stats to demonstrate an easy way to sort a multidimensional array of crime stats. First off, our multidimensional array stores stats for each user as a seperate entry in the main array. The key is the userid. This gives us easy access to each user's data. Suppose the array is called: $stats We might access a user's stats like this: $stats[$userid] Now, $stats[$userid] in my example will be an array of stats for this user. It will contain the number of successes and failures they have had at the crime level they are at. Suppose we wanted to devise a way to generate a table that lists users in order of crime level, then by successes. We might also want to have one that sorts the list by crime level and then failures. Sorting the array isn't so easy because the main array uses the userid as the key and an array as the value. What do you sort in order to sort by crime level then successes? You can't sort the key, because that just puts the list in order of the userid's. And sorting by the array is meaningless because comparing one array to the other doesn't tell us if one person has more or less successes in their crime level. This means we need to sort the entire multidimensional array by looking at the individual user's data one at a time and comparing to the others until the entire thing is sorted. Ouch! That's going to require a recursive function. A recursive function? That means that we loop through the data and perform some comparisons. But looping over it just once won't sort it enough so that we can be sure it's completely sorted. We need to keep going through it until we are sure the sort is finished. That's not the easiest thing in the world to do manually. Luckily for us, php gives us a set of array functions that does that for us. We only need to define the sorting algorithm and then that algorithm is applied recursively to the array. Some folks might be thinking, "algorithm????". I could rephrase that and just say, we need a series of "if blocks" that defines how to sort the array. We're going to use the "uasort()" function. This function takes an array, and sorts it according to a user defined method. It takes two parameters. The first one is the array to sort, and the second one is the name of the function to use to sort the array. That's called a "callback". Our callback function is called by uasort() in order to sort the array. It's called many times. It's called however many times are needed in order to sort the array. And that is determined by how large the array is. Hence the reason we need a recursive function, which uasort() is a recursive function. There are a number of sort functions. usort(), there is no "a" in that function name, does exactly what uasort() does, except that the userid's we have used for the key in the main array would be destroyed by the sorting method. In other words, the sorted array would get new keys starting from 0 and going up in sequential order. It produces a true numerically indexed array. But we want an associative array where the key is not numerically indexed. Hence why we use uasort(). The a in uasort() means "associated", as in, associative array, as opposed to a numerically indexed array. To put it simply, uasort() maintains the original keys and does not overwrite them. And now, here's some sample code that you can fun in your browser after you upload the code to your server. It will run out of the box. I am not sure about php 4 compat, but it definitely works with php 5. <?php /* * This script takes a multidimensional array of crime statistics and sorts them. * The structure of the array is as follows: * 1) The main array is an array of userid's * 2) The inner array is an array of stats for each user * 3) The inner array consists of successes, fails, and the crime level * those stats were obtained at. If the person is at crime level 2, * all the stats are for crime level 2. If the person is at crime level 1, * the stats are for crime level one. So, we're assuming that * every time a player moves up to a new crime level, * a new set of crime stats is started for them * * Then we want to sort the main array according to two seperate parameters. * The first sort we want is to sort according to the crime level, with the * lowest crime level first, going to the highest. * Then we want to sort by successes or fails. */ $stats = array( 3465 => array('success' => 234, 'fail' => 542, 'crime_level' => 2), 5224 => array('success' => 621, 'fail' => 824, 'crime_level' => 1), 7236 => array('success' => 723, 'fail' => 801, 'crime_level' => 1), 1035 => array('success' => 172, 'fail' => 152, 'crime_level' => 2), 8256 => array('success' => 263, 'fail' => 103, 'crime_level' => 2), 5770 => array('success' => 95, 'fail' => 34, 'crime_level' => 1) ); // This function sorts the stats array according to crime level, then successes. function sort_by_successes($a, $b) { /* This function compares two parts of the main array at a time. ($a an $b represent those two parts) $a and $b will contain an array, i.e., success => XXX, fail => XXX, crime_level => XXX So, we have access to the inner array for each of the two parts of the main array we are comparing. This function returns -1, 0, or 1. -1 means $a is less than $b, 0 means $a is equal to $b, and 1 means $a is greater than $b */ // Compare crime level first, since that's the first sort parameter. if ($a['crime_level'] < $b['crime_level']) { // $a is a lower crime level than $b return -1; } elseif ($a['crime_level'] > $b['crime_level']) { // $a is a higher crime level than $b return 1; } else { // If we go to the "else" block, then the crime level is equal and we need to compare the success. // In the next function, we'll compare "fail" here instead. (That's the only difference in the two functions) if ($a['success'] < $b['success']) { // $a has less success then $b return -1; } elseif ($a['success'] > $b['success']) { // $a has more success then $b return 1; } else { // $a has the same success as $b return 0; } } } // This function sorts the stats array according to crime level, then failures. // Please see the comments for the sort_by_successes() function. // It works the same as this function, except that here we look at fail instead of success. function sort_by_failures($a, $b) { if ($a['crime_level'] < $b['crime_level']) { return -1; } elseif ($a['crime_level'] > $b['crime_level']) { return 1; } else { if ($a['fail'] < $b['fail']) { return -1; } elseif ($a['fail'] > $b['fail']) { return 1; } else { return 0; } } } // This function displays the sorted array. function display_results($stats_array) { echo '<pre>' . print_r($stats_array, 1) . '</pre>'; } // Display the array before any sorting has been done. echo "<h3>The unsorted crime stats array.</h3>"; display_results($stats); // Use the uasort() function to sort the stats array and maintain the index (That's the userid, so // we don't want that overwritten... uasort() uses a custom sorting function that // we've defined in order to sort by a custom sorting method. uasort($stats, 'sort_by_successes'); // Now display the results echo "<h3>Crime stats sorted by crime level then successes.</h3>"; display_results($stats); // Now, sort the array again, using a different custom sorting method and display the results. uasort($stats, 'sort_by_failures'); echo "<h3>Crime stats sorted by crime level then failures.</h3>"; display_results($stats); Enjoy!
-
Re: Crons VS. Time Stamp I don't see how that is better than a cron? Health is normally a 5 minute cron, and I'd assume most games with a fairly active player base are going to have at least one person on loading pages. Putting a query like that on every page load is far far far more inefficient than a cron. I'd go with this as a general rule: If something only has to do with one person, keep it to that person's page loads. If it has to do with everyone, put it in a cron. So, a query that targets all users is for crons, and a query that targets one user is for an individual's page loads.
-
Re: Doubling in game...? If you have any <img> tags with a src attribute that has no value, er, in plain english, that would look like: If you have something like: $user_pic' alt='> $user_pic'> And the user changed their pic to -> "" In other words, the user put in a NOTHING for an image, and you allow them to do that, then all their pages load twice. Somewhere in your game, there is likely a missing image. I normally just tell folks to put in some fictitious image name if no image is ready for that yet. Something like: And dual page loads are cured. ;)
-
Re: Free Graphics!!! I take it your site is a game site? You might want to think about setting up a site to sell your services on. Even if you go with a free host, like say geocities, or something like that because you're good enough to sell banners, but you also need a website displaying your work.
-
Re: Free Graphics!!! I'll toss a few cents in here. Saint, your banners are looking good ;) I'm sure you'll do good selling banners. I see your web site is "under construction" which is fine, but, I don't see a web site there at all. It's just a place holder search page that some domain company has generated. I'd recommend holding off on putting up links until you have something to link people to. In other words, many times you only get one chance at a first impression, and some folks that click on your link may never go back after seeing nothing there relating to you or your graphics. Your graphics are looking good though, and once you have your site up, they'll look even better.
-
Re: Time Stamp The simple answer is you need to have the user's browser request a page every ten seconds. Anything the user sees or does all begins with them. In order to get something to the user every ten seconds, they have to request it every ten seconds. Normally, this is achieved using a javascript timeout loop. Here's a link to a page that shows how to set up such a loop. -> http://www.w3schools.com/js/js_timing.asp Now, there's basically three ways to exploit this. Have the loop refresh the entire page, refresh and iframe/frame, or load an ajax request.
-
Re: crons not working properly You should get official support from the person you bought the engine from.
-
Re: Filtering out PHP code Now once you have the file cached, are you parsing it through the template again? Seems like it's cached so you don't have to do that. (I could be mistaken, I'm not a template person (mdshare is among others, so I don't claim to be expert or even anything more than noob on this one) ) Were does the need to remove any php come in?