Jump to content


Member Since 06 May 2003
Offline Last Active Today, 02:39 PM

Posts I've Made

In Topic: Getting 503 Error on page that loads every other part

19 November 2014 - 02:25 PM

Take out all of your suppressions (the @ sign before functions) and run it on your server.  What error(s) are you getting?

In Topic: Creating a game serverlist

19 November 2014 - 02:20 PM

Yes there are many ways to do what you want.  One of the simplest and at the same time, highly performant is to use a caching product.  Seems like I've written volumes on this in the past, but the ones to look at are: APC (only if you're using php < 5.5), redis or memcache.


I'd probably recommend you start with Redis because it just has so many features that can come in handy, and it can use memory frugally.  With the small amount of data you need to cache, it should be a very good fit for you.


So-- in summary your code will become:



1. Request serverlist data from redis.

2.  If found - display.  (Coming right out of memory, this will be lightning fast)

3. If not found - get list of game servers.  Store this data to cache with a time-to-live setting you find acceptable.  You can experiment with this setting to see what the sweet spot is for you in terms of freshness of data vs. buffering the users.  Start with 60 seconds probably.



The only fly in the ointment (other than installation and configuration of redis on your server(s) is that you need a php client.  Fortunately there are 2 options: a pure php version (predis) and a php extension written in C (phpredis).  In your case, go with phpredis if you can, but that can become an issue if you don't have the environment or sysadmin experience to navigate pecl or any issues pecl might have compiling phpredis.


I feel obligated to say that you can just dump this stuff in a "file" on the filesystem and use filesystem calls to look at the age of the file, and build your own cache that way as well, but that's old school and once you have redis available you may find that some of its other features enable you to quickly get new information up and running for your users.

In Topic: Hello!

19 November 2014 - 01:56 PM

Hey there, PHPFreaks!  I've had quite the experience in the registration process.  For some reason captchas DO NOT want to work for me here :P  Took me like 12+ tries to get it, usually it's a first try thing.. haha


But, I hope to expand my php knowledge here, as I've been playing with it now for a few months.



Thanks for letting us know about your problems.  We pretty much are aware of this issue, but it doesn't hurt to get feedback from people like yourself about how it's actually functioning (or not).

In Topic: Query Builder Reports

19 November 2014 - 01:55 PM

There is an entire product category ("Business Intelligence tools")  with a number of products that will work with structured data sets, typically your SQL data.  Just a few off the top of my head:  Crystal Reports, Cognos, Tableux, Hyperion and Business Objects.  


Like Barand I've been involved in the design and development of integrated query tools, but these were for large corporations that had very specific business tools and the budget to accomodate the development of these tools.  There are 2 fairly mature ORM's in the PHP world:  Propel which is an active record pattern implementation and Doctrine2 which is a Data Mapper pattern.


Each has its own query builder, which would provide a nice foundation for a custom query tool.  At the end of the day, its typically the UI that offers all the complexity, as you're providing a thin layer above SQL.  You really have to have a significant amount of time, some fairly good requirements, and an interest in investing in a sophisticated UI to pull something like this off successfully.  Also as Barand pointed out in his typical pithy manner, if you're giving them the ability to query "everything" then why not just point them to one of the reporting tools and get them setup.


I'd also point out that many a company has pointed some analysts at a production transaction database and lived to regret it, when a report they'd just designed takes down the entire transaction system.  This is the reason Datamarts and Data warehouses exist.

In Topic: Permissions done properly!

19 November 2014 - 01:36 PM

From a conceptual standpoint, you are showing us one table, when in fact there are several different related tables.  It seems your main interest is not having to determine whether the permissions are stored for a group or a user.  What you have solves that problem but you will still be differentiating those in code, so I'm not sure what the win is, as you've described your use case.


What you have done is similar to acl's systems you can find around. The problem with all these systems is that inevitably you have the following scalability conundrum.



Does this user have the ability to "EDIT" this object?


If you have thousands of users who each could have hundreds of objects, pretty soon you have a table with lots of these rows, and that eventually becomes a scalability limitation.


The alternative answer is that you have some code that does a series of checks.



-Does this user have a ROLE that gives them super powers?

-Is this user in a GROUP that has a ROLE that gives them super powers?

-Is this user the OWNER of this item

and possibly

-has this user been DELEGATED OWNERSHIP of the item, so that they have similar powers?



This can get as complex and nuanced as you want it to, depending on your application.  Utlimately, it comes down to running some code that looks at a number of different possibilities, each possibility needing to be resolved in a minimum amount of time.


This article talks about this conundrum and the confusion surrounding permission systems, acl and how people might solve the problem.  It discusses this in the context of the symfony framework, but presents the way that symfony has an "acl" solution not too far from the one you're tinkering with as it happens (you would have to reverse the actual tables the symfony acl system creates, but they take a somewhat similar approach to yours), and then goes on to explain why acls are typically not the solution to the problems people are trying to solve.  Instead, symfony offers the alternative of "voters" which is an engine allowing you to write simple rules for making these types of permission decisions.  Article is here:  http://knpuniversity...-users-menu-cms

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime