Jump to content
MakeWebGames

Floydian

Members
  • Posts

    900
  • Joined

  • Last visited

    Never

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Floydian's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Floydian

    PHP Load Times

    It seems like both of you are measuring the php processing time. The biggest time consuming part of delivering a web page to a user is sending the data over the wire. Another issue that hugely dominates over php processing time is javascript execution time (and possibly locking of the browser during script execution). One can easily shave a tenth of a second by focusing on those areas, which is far more time than all of the times listed in the first two posts (measured by the hundredths and thousandths, as opposed to tenths). Therefore, if you php execution time stays well below the time it takes to deliver a page to a user, then it's not worth focusing on optimizing the php execution times. Cheers
  2. Thanks TwiztedFake for posting the problem and the solution. I apologize for not responding sooner. I've been slammed busy. I'll push out a 1.0.3 version very soon to correct that error. The 1.0.3 will also contain one php 4 compatibility update as well. Cheers   PS Please post any bugs here. I will investigate any bugs that come up.
  3. @CrimGame.com: flattery will get you nowhere :P Thanks for the compliments. @Rasheed Saeed: Again, thanks for the compliments. @reek13: What character encoding is that page using? I need to know the character encoding that the browser uses. If you know how to change that, set it to UTF-8 @Enuf: Thanks for the suggestion. This is a replacement for the ***stock*** gangs. Therefore, it cannot have features the stock gangs do not have. However, there is a plugin system built into this mod and you are more than welcome to make a gang image staff menu plugin for this. Once they plugin is made, people that use your plugin would only need to edit their gang list to show these images, and add a field to the db. I'll definitely check out your work, if you rise to the task of making the plugin. Cheers
  4. Add this after the other functions you added: if(!function_exists(array_combine)) { function array_combine($arr1, $arr2) { $out = array(); $arr1 = array_values($arr1); $arr2 = array_values($arr2); foreach($arr1 as $key1 => $value1) { $out[(string)$value1] = $arr2[$key1]; } return $out; } }
  5. Add this code right after the array_diff_key() fix:   if (!function_exists(array_fill_keys)) { function array_fill_keys($keys, $value) { return array_combine($keys,array_fill(0,count($keys),$value)); } }   Cheers
  6. Alrighty, to fix the array_diff_key error, find this code at the very top of yourgang.php:   <?php   Replace that with this code:   <?php if (!function_exists('array_diff_key')) { function array_diff_key() { $arrs = func_get_args(); $result = array_shift($arrs); foreach ($arrs as $array) { foreach ($result as $key => $v) { if (array_key_exists($key, $array)) { unset($result[$key]); } } } return $result; } }   This fix is only needed for folks using php < 5.1 So if you're using php 5.0.x or php 4.x.x, you need this fix. This will also be included in the 1.1 release. Cheers
  7. Thanks for reporting the errors mixerman212. That was very helpful. I didn't realize array_diff_key() is only available in php 5.1 or greater. Both of those errors are php 4 compatibility issues. I'll look into a workaround for this. The array diff key one will take some time, but the first one can be fixed by finding this code in the public/gang_list.php file: /**/ $atoz = range('A', 'Z'); $all_selected = ' selected'; foreach ($atoz as $key => &$value) { if (strtoupper($letter) === $value) { $selected = ' selected'; $all_selected = ''; } else { $selected = ''; } $value = <<<EOT [url="gangs.php?action=gang_list&letter=$value"]$value[/url] EOT; } unset($value); $atoz = implode(' ', $atoz);   Replace the code above with the code below: /**/ $atoz = range('A', 'Z'); $all_selected = ' selected'; foreach ($atoz as $key => $value) { if (strtoupper($letter) === $value) { $selected = ' selected'; $all_selected = ''; } else { $selected = ''; } $atoz[$key] = <<<EOT [url="gangs.php?action=gang_list&letter=$value"]$value[/url] EOT; } $atoz = implode(' ', $atoz);   This edit is only necessary for folks running php 4. If you're running php 5, this edit is not needed. I'll post a fix for the other one, and include these in a 1.1 version very soon.
  8. GANG REPLACEMENT This is a replacement for Mccodes V2 gangs. It replaces all of the gang pages except for the organized crimes. If you are looking for a gang script that has none of the same old bugs that plague mccodes, then you have found the solution right here! The same programming excellence that has made the Horizons Game Engine the most secure browser game engine, has created the new fantastic gang replacement mod. Without further ado, the mod can be downloaded at the following link: http://makewebgames.io/index.php?page=DownloadDBData&dataID=33 SCREENSHOTS [tabmenu] [tab=Public Gang Pages] The list of gangs (note that it is paginated, and can be filtered by the gang's first letter of their name. Gang war list: Another view of the gang war list: A gang's public profile page: [tab=Private Gang Pages] Donation page: Your gang's member list: Your gang's index page: Your gang's summary: Your gang's wars: [tab=Gang Staff Pages] War management: Vault management: Staff management: Gang settings management: Gang staff menu: [tab=Official Plugins] Organized Crimes -- [go] Hit and Run -- [go] Coming soon! [/tabmenu] FEATURES Designed as a drop in replacement for mccodes version 2 gangs. Has a plugin design that allows new gang content to be dropped into the gangs. Gangs with no members are automatically deleted when a user attempts to view that gang. Players listed as being in a gang that doesn't exist are automatically reset. Gang wars between gangs that don't exist are automatically deleted. The page that lists all gangs is paginated and grouped alphabetically. No more mile long lists of gangs! Players are limited to a predetermined number of applications that can be pending at any given time. Therefore they can not apply to more gangs than the "max_application" setting. Players have the ability to see the applications they have submitted and they can cancel them as well. Gang files are consolidated into fewer files. Files like creategang.php, gangcentral.php, gangwars.php. You only need to keep gangs.php and yourgang.php. gangs.php is the portal to all public gang pages. yourgang.php is the portal to all private (my gang/my gang staff) pages. Players are asked for confirmation before kicking gang members, leaving the gang, or disbanding the gang. There are too many more features to list here! INSTALLATION First and foremost, this is a drop in replacement for mccodes gangs, and as such, you simply copy the files into your game. Make sure to preserve the relative paths. There are subfolders for most of the gang scripts. Secondly, the gangs.php and yourgang.php has an mccodes lite header code in it. You need to replace with your own header code. This is pretty straighforward, and pretty much means simply adding this: include('globals.php'); SUPPORT This mod is fully supported. Any bugs/errors will be addressed by an update/patch if needed. Errors arising from problems caused by the installation, or customizations resulting in incompatibility with the mod are not covered. The mod is distributed as is. You can pretty much do what you want with it. The only caveat is that any derived works must be distributed with a copy of software. Any plugins that are files that were not part of the "official" gang replacement mod can be distributed without any caveat. It's only when you edit one of the files that is included in the official mod, or you edit a file which is a descendant of a file that is included in the official mod that you need to distribute the software with your new file. FEEDBACK If you download this mod, please post some feedback here whether your feedback is positive or critical. I would love to hear your thoughts on this mod. TRY BEFORE YOU INSTALL You can see the mod in action by going here: PHP Horizons Mccode Mods Enjoy! VERSION HISTORY 1.0.0 Initial Release 1.0.1 Added a new css style ------- Fixed two php 4 compatibility issues ------- Added a call to $h->endpage() in gangs.php and yourgang.php ------- Added an instruction to the README to clarify the installation process. 1.0.2 ------- Fixed one php 4 compatibility issue 1.0.3 NOT YET RELEASED ------- Will hopefully fix any remaining php 4 compatibility issues. ------- This update will be available very soon.
  9. After a successful beta test, the gang mod is being released today! Once the download link becomes available in the script vault, I'll post an announcement in the free mods forum, along with screen shots. Cheers
  10. Just a quick update for the folks who are anxiously awaiting the release of the gang replacement mod. The beta test is going well. So far only one bug has been found and that bug was very minor. Gang attack logs showed any fights that were won as "drawn". That has been fixed. I want to thank the folks who are beta testing. The final release of the gang replacement mod should be within the week. I have the first official plugin for the gang replacement mod about 50% complete. It's a large mod that will be priced very attractively. The staff panel (the game staff, not the gang staff) for this will include an ajax simulator... :O now what might the game staff need a simulator for? Feel free to post your speculations!
  11. Ignore the code posted below, it's just to document the yourgang.php file and put a timestamp on it.   <?php /** * @name gangs.php * @author Floydian * @link [url]http://www.phphorizons.com/[/url] * @version P1.0.0 * @copyright All rights reserved by Floydian and PHP Horizons 2009,2010 */ ##################################################### # HEADER CODE -- You may need to use the header # # code that is included in your game. For instance, # # if you are running mccodes vs 2, you would need # # to remove the below code and include globals.php # ##################################################### session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); $gq=mysql_query("SELECT g.* FROM gangs g WHERE g.gangID={$ir['gang']}"); $gangdata=mysql_fetch_array($gq); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); ###################### # END OF HEADER CODE # ###################### error_reporting(E_ALL); define('GANG_MODULE', true, true); // gangID, gangNAME, gangDESC, gangPREF, gangSUFF, gangMONEY, gangCRYSTALS, gangRESPECT, gangPRESIDENT, gangVICEPRES, gangCAPACITY, gangCRIME, gangCHOURS, gangAMENT include('./gangs/config.php'); $gvars = new GangVars(); $gvars->setPage('private'); include('./gangs/content.php');
  12. Thanks for the offer. I'm very interested in getting folks using the mod in number. I am 99.99% confident about it working fine on a version 2 game. The aspects of testing I'm looking to flesh out are what happens when there are 20 gangs, 15 wars, and lots of activity.   You certainly may add your 2 pence ;) This mod only includes stock mccodes version 2 features because it's intended to be a drop in replacement. I.e., it does not require altering the gangs table and adding a gangPIC field. It would be great to see a mod that adds in those features. Cheers and thanks for your replies and interest in the gang mod.
  13. I'm looking for one or two game owners to beta test my new free gang mod. The mod is finished, and ready to be released, but I want to put it into a live game for real testing before I release this to the general public. This gang mod is and will always be entirely free. Anyone will be allowed to make mods that can plugin to it. They can give those mods away for free or they can sell them. I haven't decided on the exact license that I will release this under because I need a license that will allow folks to make additions to the software and sell it. Now you know that the software you would be beta testing will always be freely available and you will not ever have to remove it from your game. Why replace mccodes gangs with my gang mod? There are many reasons. Below are a number of those reasons:   If you want to see what this mod looks like, you can go to my site and make an account: http://mccode.phphorizons.com/ This is a drop in replacement for mccodes version 2 gangs. If you aren't running version 2 software, please don't contact me about beta testing. You will be able to install the mod yourself when I release it, but I am looking to test this mod on an mccodes version 2 game.   I should also mention that this mod comes with support. Whist I can tell you that the code is a million times more secure than standard mccodes, and that I've taken every precaution against allowing any bugs/exploitable code, there is always a chance that I did something wrong. If any are found, patches will be released. Game owners will be expected to install these patches themselves, but I will be supporting this mod for free. There will be a max of two beta testers, so hurry and contact me as soon as possible so that you can be the first to use this kick ass mod!   This mod does not require editing any of your existing files. You simply replace gangs.php and yourgang.php, and then copy a new folder to your game called gangs which contains the files that form the basis of the gang plugin system. Once you have done that, your gangs should work as they did before, so long as they are pretty close to stock mccodes 2 gangs.
  14. Floydian

    question

    That's a good way to do things. Selecting all the fields from the users table might be inefficient if there are lots of fields. What really costs the most is doing the query in the first place, regardless of whether you select 2 or 20 fields. But if your users table has 100 fields, and you can select just 10 of them, that might start getting into a situation where there's a good savings in not selecting everything. Now your script could use some improvements though. Number one, instead of using -1 as the default, null is prefered. null is the default value for unset php variables, and it really makes sense to use that. And secondly, you run a mysql escape on the userid. What you really should do is run abs(intval()) on that. Lastly, that concatenation you're doing in that query is not doing anything for ya there. It'd be easier to read the code if you didn't use concatenation there. Now if that concatenation was having an effect, I'd say keep it, but it really isn't doing anything different from just plugging the variable into a string.   function user($sql, $user=null) { global $connect; $sql=mysql_real_escape_string($sql); if (is_null($user)) { $user=$_SESSION['id']; } else { $user=abs(intval($user)); } $qry = mysql_query("SELECT `$sql` FROM `users` WHERE id=$user"); return mysql_fetch_array($qry); }
  15. This is just my two cents. I personally use and recommend Zend Studio 5.5 Yeah, that's 5.5, not 6, and not 7. Reason: Since Zend 6 and the move from being a native windows app to being an Eclipse plugin, Zend changed a lot. If you like Eclipse PDT, then you will probably like Zend 7, but if you liked Zend 5.5, then you will definitely want to try Zend 7 before you pay for it... From what I can tell, Eclipse PDT has pretty much everything Zend 7 has. PDT = free and Zend 7 = $400 big ones. cheers! PS: I do use Eclipse PDT whenever I'm doing PHP 5.3 specific code since Zend 5.5 does not support PHP 5.3 style namespaces or anonymous functions.
×
×
  • Create New...